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