-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreateDevManifest.js
42 lines (36 loc) · 1.18 KB
/
createDevManifest.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
const fs = require("fs");
const manifestPath = "./ado-gh-codespaces-extension.json";
const newManifestPath = "./ado-gh-codespaces-extension-dev.json";
const ExtensionId = "ADOGitHubCodespaces";
const DevExtensionId = "ADOGitHubCodespacesDev";
const manifest = fs.readFileSync(manifestPath).toString();
const newManifest = JSON.parse(
manifest.split(ExtensionId).join(DevExtensionId)
);
const addDev = (str) => {
return str ? str + " (DEV)" : str;
};
const versionString = Date.now().toString();
const devManifestData = {
baseUri: "https://localhost:3000",
public: false,
version: `${versionString.slice(0, 1)}.${versionString.slice(
1,
7
)}.${versionString.slice(7, 13)}`,
name: addDev(newManifest.name),
description: addDev(newManifest.description),
contributions: newManifest.contributions.map((contribution) => ({
...contribution,
properties: {
name: addDev(contribution.properties.name),
text: addDev(contribution.properties.text),
...contribution.properties,
},
description: addDev(contribution.description),
})),
};
fs.writeFileSync(
newManifestPath,
JSON.stringify(Object.assign({}, newManifest, devManifestData), null, 2)
);