mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
dev script
This commit is contained in:
parent
2388c80c74
commit
2bb41a1402
|
@ -6,17 +6,9 @@
|
|||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
const cp = require('child_process');
|
||||
const product = require('../../product.json');
|
||||
const root = path.resolve(path.join(__dirname, '..', '..', '..'));
|
||||
|
||||
async function exists(path) {
|
||||
try {
|
||||
await fs.stat(path);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
const product = require('../product.json');
|
||||
const root = path.resolve(path.join(__dirname, '..', '..'));
|
||||
const exists = (path) => fs.stat(path).then(() => true, () => false);
|
||||
|
||||
async function exec(cmd, opts = {}) {
|
||||
return new Promise((c, e) => {
|
||||
|
@ -30,14 +22,13 @@ async function cloneOrPull(ext) {
|
|||
const folder = path.join(root, folderName);
|
||||
|
||||
if (!await exists(folder)) {
|
||||
const url = `${ext.repo}.git`;
|
||||
await exec(`git clone ${url}`, { cwd: root });
|
||||
await exec(`git clone ${ext.repo}.git`, { cwd: root });
|
||||
} else {
|
||||
await exec(`git pull`, { cwd: folder });
|
||||
}
|
||||
}
|
||||
|
||||
async function main() {
|
||||
async function syncExtensions() {
|
||||
for (const ext of product.builtInExtensions) {
|
||||
console.log(`👉 ${ext.name}`);
|
||||
await cloneOrPull(ext);
|
||||
|
@ -45,8 +36,14 @@ async function main() {
|
|||
}
|
||||
|
||||
if (require.main === module) {
|
||||
main().catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
const { program } = require('commander');
|
||||
|
||||
program.version('0.0.1');
|
||||
|
||||
program
|
||||
.command('sync-extensions')
|
||||
.description('Clone or pull extension repositories alongside vscode')
|
||||
.action(syncExtensions);
|
||||
|
||||
program.parseAsync(process.argv);
|
||||
}
|
|
@ -33,6 +33,7 @@
|
|||
"@typescript-eslint/parser": "^3.3.0",
|
||||
"applicationinsights": "1.0.8",
|
||||
"azure-storage": "^2.1.0",
|
||||
"commander": "^7.0.0",
|
||||
"electron-osx-sign": "^0.4.16",
|
||||
"esbuild": "^0.8.30",
|
||||
"iconv-lite-umd": "0.6.8",
|
||||
|
|
|
@ -529,6 +529,11 @@ commander@^2.8.1:
|
|||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
||||
integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg==
|
||||
|
||||
commander@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-7.0.0.tgz#3e2bbfd8bb6724760980988fb5b22b7ee6b71ab2"
|
||||
integrity sha512-ovx/7NkTrnPuIV8sqk/GjUIIM1+iUQeqA3ye2VNpq9sVoiZsooObWlQy+OPWGI17GDaEoybuAGJm6U8yC077BA==
|
||||
|
||||
compare-version@^0.1.2:
|
||||
version "0.1.2"
|
||||
resolved "https://registry.yarnpkg.com/compare-version/-/compare-version-0.1.2.tgz#0162ec2d9351f5ddd59a9202cba935366a725080"
|
||||
|
|
Loading…
Reference in a new issue