Skip to content

Commit

Permalink
Speed up update-xterm script by combining module installs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Nov 2, 2023
1 parent c343e86 commit d7a08bd
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions scripts/update-xterm.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,36 @@ async function update() {

const pkg = require(path.join(vscodeDir, 'package.json'));

const modulesWithVersion = [];
for (const m of moduleNames) {
const moduleWithVersion = `${m}@${latestVersions[m]}`;
if (pkg.dependencies[m] === latestVersions[m]) {
console.log(`Skipping ${moduleWithVersion}, already up to date`);
continue;
}
modulesWithVersion.push(moduleWithVersion);
}

if (modulesWithVersion.length > 0) {
for (const cwd of [vscodeDir, path.join(vscodeDir, 'remote'), path.join(vscodeDir, 'remote/web')]) {
console.log(`${path.join(cwd, 'package.json')}: Updating ${moduleWithVersion}`);
cp.execSync(`yarn add ${moduleWithVersion}`, { cwd });
console.log(`${path.join(cwd, 'package.json')}: Updating\n ${modulesWithVersion.join('\n ')}`);
cp.execSync(`yarn add ${modulesWithVersion.join(' ')}`, { cwd });
}
}

const backendOnlyModulesWithVersion = [];
for (const m of backendOnlyModuleNames) {
const moduleWithVersion = `${m}@${latestVersions[m]}`;
if (pkg.dependencies[m] === latestVersions[m]) {
console.log(`Skipping ${moduleWithVersion}, already up to date`);
continue;
}
backendOnlyModulesWithVersion.push(moduleWithVersion);
}
if (backendOnlyModulesWithVersion.length > 0) {
for (const cwd of [vscodeDir, path.join(vscodeDir, 'remote')]) {
console.log(`${path.join(cwd, 'package.json')}: Updating ${moduleWithVersion}`);
cp.execSync(`yarn add ${moduleWithVersion}`, { cwd });
console.log(`${path.join(cwd, 'package.json')}: Updating\n ${backendOnlyModulesWithVersion.join('\n ')}`);
cp.execSync(`yarn add ${backendOnlyModulesWithVersion.join(' ')}`, { cwd });
}
}
}
Expand Down

0 comments on commit d7a08bd

Please sign in to comment.