-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathvs_code.js
53 lines (52 loc) · 1.14 KB
/
vs_code.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const {
pluck,
ex,
rn,
rf,
wf,
join,
stringify,
extBaseKeys,
} = require("./util");
async function main() {
const packageStr = (await rf(join(process.cwd(), "package.json"))).toString();
const packageJSON = JSON.parse(packageStr);
try {
const vsCode = stringify(
pluck(
packageJSON,
extBaseKeys.concat([
"homepage",
"displayName",
"publisher",
"engines",
"categories",
"contributes",
"activationEvents",
]),
{},
{
name: "30-seconds-of-typescript",
devDependencies: {
"@types/vscode": "^1.34.0",
vsce: "^1.77.0",
},
}
)
);
await ex("npm run code-gen ");
await rn("package.json", "_package.json");
await wf("package.json", vsCode);
if (process.argv.includes("--publish")) {
await ex("yarn vsce publish -p $VS_TOKEN");
} else {
await ex("yarn vsce package");
}
await rn("_package.json", "package.json");
} catch (error) {
console.log(error);
} finally {
await wf("package.json", packageStr);
}
}
main();