-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
38 lines (28 loc) · 1.43 KB
/
build.js
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
var fs = require("fs");
const fse = require("fs-extra");
const child_process = require("child_process");
if (fs.existsSync("./public/static")) {
fs.rmdirSync("./public/static", { recursive: true });
}
if (fs.existsSync("./public/lib")) {
fs.rmdirSync("./public/lib", { recursive: true });
}
fse.copySync("./node_modules/@tinialabs/vscode-web/dist", "./public/static");
fse.copySync("./node_modules/semver-umd", "./public/lib/semver-umd");
fse.copySync("./node_modules/vscode-oniguruma", "./public/lib/vscode-oniguruma");
fse.copySync("./node_modules/vscode-textmate", "./public/lib/vscode-textmate");
if(fs.existsSync('./public/static/extensions/vscode-fs-memfs')){
fs.rmdirSync('./public/static/extensions/vscode-fs-memfs', { recursive: true })
}
child_process.execSync('git clone https://github.com/microsoft/vscode-web-playground.git public/static/extensions/vscode-fs-memfs', {stdio: 'inherit'});
process.chdir('public/static/extensions/vscode-fs-memfs');
fse.rmdirSync('.git', { recursive: true });
child_process.execSync('yarn', {stdio: 'inherit'});
child_process.execSync('yarn compile', {stdio: 'inherit'});
process.chdir('../../../..');
const packageJSON = fs.readFileSync(
"./public/static/extensions/vscode-fs-memfs/package.json"
);
const extensions = [{ packageJSON: JSON.parse(packageJSON), extensionPath: "vscode-fs-memfs"}]
const content = `var memfs=${JSON.stringify(extensions)}`;
fs.writeFileSync("./public/memfs.js", content);