Skip to content

Commit 43394cb

Browse files
committed
build(vscode-ide-companion): skip OS junk files when copying templates
cpSync copied packages/core/templates verbatim, so .DS_Store files from the developer machine ended up inside the packaged .vsix. Filter them (and other OS/tooling artifacts) out during the copy and report how many were skipped.
1 parent 7e7af33 commit 43394cb

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

‎scripts/build-vscode-companion.js‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
import { spawnSync } from "node:child_process";
22
import { cpSync, existsSync, rmSync } from "node:fs";
3-
import { dirname, join } from "node:path";
3+
import { basename, dirname, join } from "node:path";
44
import { fileURLToPath } from "node:url";
55

66
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
77

8+
// OS/tooling junk that must never end up inside the packaged extension,
9+
// regardless of what happens to live in packages/core/templates/.
10+
const EXCLUDED_NAMES = new Set([".DS_Store", ".AppleDouble", ".LSOverride", "Thumbs.db", "desktop.ini", "__MACOSX"]);
11+
812
function run(command, args, label) {
913
console.log(`\n[${label}] ${command} ${args.join(" ")}`);
1014
const result = spawnSync(command, args, { stdio: "inherit", cwd: root, shell: true });
@@ -30,8 +34,23 @@ if (!existsSync(templatesSrc)) {
3034
}
3135

3236
rmSync(templatesDest, { recursive: true, force: true });
33-
cpSync(templatesSrc, templatesDest, { recursive: true, dereference: true });
34-
console.log("\n[3/4] Copied templates from core → vscode-ide-companion/templates/");
37+
38+
let skipped = 0;
39+
cpSync(templatesSrc, templatesDest, {
40+
recursive: true,
41+
dereference: true,
42+
filter: (source) => {
43+
if (EXCLUDED_NAMES.has(basename(source))) {
44+
skipped++;
45+
return false;
46+
}
47+
return true;
48+
},
49+
});
50+
console.log(
51+
`\n[3/4] Copied templates from core → vscode-ide-companion/templates/` +
52+
(skipped > 0 ? ` (skipped ${skipped} junk file(s))` : "")
53+
);
3554

3655
run("npm", ["run", "package", "--workspace=deepcode-vscode"], "4/4 Package .vsix");
3756

0 commit comments

Comments
 (0)