Skip to content

Commit 1073795

Browse files
committed
Update sync-helper.json
1 parent 0289f8f commit 1073795

File tree

1 file changed

+72
-34
lines changed

1 file changed

+72
-34
lines changed

scripts/sync-helper.js

Lines changed: 72 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,23 @@
1-
/*---------------------------------------------------------------------------------------------
2-
* Copyright (c) Microsoft Corporation. All rights reserved.
3-
* Licensed under the MIT License. See License.txt in the project root for license information.
4-
*--------------------------------------------------------------------------------------------*/
1+
/* eslint-disable header/header */
2+
53
const path = require('path');
64
const fs = require('fs');
75
const https = require('https');
86

97
const pickKeys = [
10-
'extensionTips', 'extensionImportantTips', 'keymapExtensionTips',
11-
'configBasedExtensionTips', 'extensionKeywords', 'extensionAllowedBadgeProviders',
12-
'extensionAllowedBadgeProvidersRegex', 'extensionAllowedProposedApi',
13-
'extensionEnabledApiProposals', 'extensionKind', 'languageExtensionTips'
8+
'extensionTips',
9+
'extensionImportantTips',
10+
'keymapExtensionTips',
11+
'configBasedExtensionTips',
12+
'extensionKeywords',
13+
'extensionAllowedBadgeProviders',
14+
'extensionAllowedBadgeProvidersRegex',
15+
'extensionAllowedProposedApi',
16+
'extensionEnabledApiProposals',
17+
'extensionKind',
18+
'languageExtensionTips'
1419
];
1520

16-
async function start() {
17-
const releasePath = path.join(__dirname, '../product-release.json');
18-
if (!fs.existsSync(releasePath)) {
19-
console.error('product-release.json is not exists, please copy product.json from VSCode Desktop Stable');
20-
return;
21-
}
22-
const branchProduct = JSON.parse(fs.readFileSync(path.join(__dirname, '../product.json')).toString());
23-
const releaseProduct = JSON.parse(fs.readFileSync(releasePath).toString());
24-
const tmpProductPath = path.join(__dirname, '../product-tmp.json');
25-
for (let key of pickKeys) {
26-
branchProduct[key] = releaseProduct[key];
27-
}
28-
fs.writeFileSync(tmpProductPath, JSON.stringify(branchProduct, null, 4));
29-
30-
if (keysDiff(branchProduct, releaseProduct)) {
31-
// allow-any-unicode-next-line
32-
console.log('📦 check if you need these keys or not');
33-
}
34-
await checkProductExtensions(branchProduct);
35-
// allow-any-unicode-next-line
36-
console.log('📦 you can copy product-tmp.json file to product.json file and resolve logs above by yourself');
37-
// allow-any-unicode-next-line
38-
console.log('✅ done');
39-
}
40-
4121
const AllowMissKeys = [
4222
'win32SetupExeBasename',
4323
'darwinCredits',
@@ -88,6 +68,60 @@ const AllowMissKeys = [
8868
'darwinUniversalAssetId',
8969
];
9070

71+
const propiertaryExtension = [
72+
'ms-vscode-remote.remote-containers',
73+
'ms-dotnettools.csharp',
74+
'ms-vscode.cpptools-extension-pack',
75+
'ms-azure-devops.azure-pipelines',
76+
'msazurermtools.azurerm-vscode-tools',
77+
'ms-azuretools.vscode-bicep',
78+
'usqlextpublisher.usql-vscode-ext',
79+
'ms-azuretools.vscode-azureterraform',
80+
'VisualStudioExptTeam.vscodeintellicode-completions',
81+
'ms-vsliveshare.vsliveshare',
82+
'ms-toolsai.vscode-ai-remote',
83+
'GitHub.codespaces',
84+
'ms-vscode.azure-repos',
85+
'ms-vscode.remote-repositories',
86+
'ms-vscode-remote.remote-wsl',
87+
'ms-vscode-remote.remote-ssh',
88+
'GitHub.copilot',
89+
'GitHub.copilot-nightly',
90+
'GitHub.remotehub',
91+
'GitHub.remotehub-insiders',
92+
'ms-python.vscode-pylance',
93+
'ms-vscode.azure-sphere-tools-ui',
94+
'ms-azuretools.vscode-azureappservice',
95+
];
96+
97+
async function start() {
98+
const localPath = path.join(__dirname, '../product.json');
99+
const releasePath = path.join(__dirname, '../product-release.json');
100+
if (!fs.existsSync(releasePath)) {
101+
console.error('product-release.json is not exists, please copy product.json from VSCode Desktop Stable');
102+
return;
103+
}
104+
105+
const branchProduct = JSON.parse(await fs.promises.readFile(localPath, { encoding: 'utf8' }));
106+
const releaseProduct = JSON.parse(await fs.promises.readFile(releasePath, { encoding: 'utf8' }));
107+
const tmpProductPath = path.join(__dirname, '../product-tmp.json');
108+
for (let key of pickKeys) {
109+
branchProduct[key] = releaseProduct[key];
110+
}
111+
112+
await fs.promises.writeFile(tmpProductPath, JSON.stringify(branchProduct, null, '\t'));
113+
114+
if (keysDiff(branchProduct, releaseProduct)) {
115+
// allow-any-unicode-next-line
116+
console.log('📦 check if you need these keys or not');
117+
}
118+
await checkProductExtensions(branchProduct);
119+
// allow-any-unicode-next-line
120+
console.log('📦 you can copy product-tmp.json file to product.json file and resolve logs above by yourself');
121+
// allow-any-unicode-next-line
122+
console.log('✅ done');
123+
}
124+
91125
function keysDiff(branch, release) {
92126
const toMap = (ret, e) => {
93127
ret[e] = true;
@@ -130,6 +164,10 @@ async function checkProductExtensions(product) {
130164

131165
// Check if extensions exists in openvsx
132166
for (let id of uniqueExtIds) {
167+
if (propiertaryExtension.includes(id)) {
168+
continue;
169+
}
170+
133171
const openvsxUrl = `https://open-vsx.org/api/${id.replace(/\./g, '/')}`;
134172
const ok = await urlExists(openvsxUrl);
135173
if (!ok) {
@@ -149,4 +187,4 @@ async function urlExists(url) {
149187
});
150188
}
151189

152-
start().then().catch(console.error);
190+
start().catch(console.error);

0 commit comments

Comments
 (0)