everything-dev
Version:
A consolidated product package for building Module Federation apps with oRPC APIs.
37 lines (35 loc) • 1.28 kB
JavaScript
let node_fs = require("node:fs");
let node_path = require("node:path");
let glob = require("glob");
//#region src/utils/workspace-subtree.ts
/**
* The ignore set both sides of a source handoff agree on: `bos import`
* classifies files under it, and source archives published by the deploy
* train (#406) exclude it — so an imported archive never smuggles in
* build output, VCS state, or local .bos state. Keep this list in sync
* with nothing else: it is the single source of truth.
*/
const WORKSPACE_SUBTREE_IGNORE = [
"**/node_modules/**",
"**/.git/**",
"**/dist/**",
"**/.bos/**",
"**/.every-plugin/**"
];
/** Sorted, file-only list of the workspace subtree at `root`, under the shared ignore set. */
async function listWorkspaceSubtreeFiles(root, workspace) {
const matches = await (0, glob.glob)(`${workspace}/**`, {
cwd: root,
nodir: true,
dot: true,
absolute: false,
ignore: WORKSPACE_SUBTREE_IGNORE
});
const files = [];
for (const match of matches) if ((0, node_fs.lstatSync)((0, node_path.join)(root, match)).isFile()) files.push(match);
return files.sort();
}
//#endregion
exports.WORKSPACE_SUBTREE_IGNORE = WORKSPACE_SUBTREE_IGNORE;
exports.listWorkspaceSubtreeFiles = listWorkspaceSubtreeFiles;
//# sourceMappingURL=workspace-subtree.cjs.map