From d7a08bd54202e8a305b641f7d878ae34d4e05d89 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Thu, 2 Nov 2023 11:08:14 -0700 Subject: [PATCH] Speed up update-xterm script by combining module installs --- scripts/update-xterm.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/update-xterm.js b/scripts/update-xterm.js index 01833fbb959..5f465efb43c 100644 --- a/scripts/update-xterm.js +++ b/scripts/update-xterm.js @@ -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 }); } } }