This repository was archived by the owner on Jan 12, 2026. It is now read-only.
forked from Felx-B/vscode-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
90 lines (80 loc) · 2.32 KB
/
Copy pathbuild.js
File metadata and controls
90 lines (80 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const process = require("process");
const child_process = require("child_process");
const fs = require("fs");
const fse = require("fs-extra");
const { version } = require("./package.json");
const vscodeVersion = version.split("-")[0];
function error(msg) {
console.info("\x1b[31merror %s\x1b[0m", msg);
}
function ok(msg) {
console.info("\x1b[32m%s\x1b[0m", msg);
}
function note(msg) {
console.info("\x1b[90m%s\x1b[0m", msg);
}
function exec(cmd, opts) {
console.info("\x1b[36m%s\x1b[0m", cmd);
return child_process.execSync(cmd, opts);
}
const requiredTools = ["node", "npm", "git", "python"];
note(`required tools ${JSON.stringify(requiredTools)}`);
for (const tool of requiredTools) {
try {
child_process.execSync(`${tool} --version`, { stdio: "ignore" });
} catch (e) {
error(`"${tool}" is not available.`);
//process.exit(1);
}
}
ok("required tools installed");
const node_version_out = child_process.execSync(`node -v`);
const node_version = node_version_out.toString().trim();
if (node_version < "v20.0") {
error(`Want node > 20. Got "${node_version}"`);
process.exit(1);
}
if (!fs.existsSync("vscode")) {
note("cloning vscode");
exec(
`git clone --depth 1 https://github.com/microsoft/vscode.git -b ${vscodeVersion}`,
{
stdio: "inherit",
}
);
} else {
ok("vscode already installed");
note("delete vscode folder to clone again");
}
//replace max-old-space-size=8192 with 4096 in package.json (hack for gh actions)
const vscodePackagePath = "vscode/package.json";
let packageContent = fs.readFileSync(vscodePackagePath).toString();
packageContent = packageContent.replace(
/max-old-space-size=8192/g,
"max-old-space-size=4096"
);
fs.writeFileSync(vscodePackagePath, packageContent);
note("changing directory to vscode");
process.chdir("vscode");
if (!fs.existsSync("node_modules")) {
exec("npm install", {
stdio: "inherit",
env: {
...process.env,
ELECTRON_SKIP_BINARY_DOWNLOAD: 1,
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1,
},
});
} else {
ok("node_modules exists. Skipping npm install");
}
// Use simple workbench
note("copying workbench file");
/*fs.copyFileSync(
"../workbench.ts",
"src/vs/code/browser/workbench/workbench.ts"
);*/
// Compile
note("starting compile");
exec("npm run gulp vscode-web-min", { stdio: "inherit" });
ok("compile completed");