Skip to content

Commit 119dff3

Browse files
authored
perf(build): optimize build scripts for parallel execution and remove redundant checks (#24307)
1 parent 7c4b497 commit 119dff3

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

packages/vscode-ide-companion/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"scripts": {
109109
"prepackage": "npm run generate:notices && npm run check-types && npm run lint && npm run build:prod",
110110
"build": "npm run build:dev",
111-
"build:dev": "npm run check-types && npm run lint && node esbuild.js",
111+
"build:dev": "node esbuild.js",
112112
"build:prod": "node esbuild.js --production",
113113
"generate:notices": "node ./scripts/generate-notices.js",
114114
"prepare": "npm run generate:notices",

scripts/build.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,32 @@ if (!existsSync(join(root, 'node_modules'))) {
3232

3333
// build all workspaces/packages
3434
execSync('npm run generate', { stdio: 'inherit', cwd: root });
35-
execSync('npm run build --workspaces', { stdio: 'inherit', cwd: root });
35+
36+
if (process.env.CI) {
37+
console.log('CI environment detected. Building workspaces sequentially...');
38+
execSync('npm run build --workspaces', { stdio: 'inherit', cwd: root });
39+
} else {
40+
// Build core first because everyone depends on it
41+
console.log('Building @google/gemini-cli-core...');
42+
execSync('npm run build -w @google/gemini-cli-core', {
43+
stdio: 'inherit',
44+
cwd: root,
45+
});
46+
47+
// Build the rest in parallel
48+
console.log('Building other workspaces in parallel...');
49+
const workspaceInfo = JSON.parse(
50+
execSync('npm query .workspace --json', { cwd: root, encoding: 'utf-8' }),
51+
);
52+
const parallelWorkspaces = workspaceInfo
53+
.map((w) => w.name)
54+
.filter((name) => name !== '@google/gemini-cli-core');
55+
56+
execSync(
57+
`npx npm-run-all --parallel ${parallelWorkspaces.map((w) => `"build -w ${w}"`).join(' ')}`,
58+
{ stdio: 'inherit', cwd: root },
59+
);
60+
}
3661

3762
// also build container image if sandboxing is enabled
3863
// skip (-s) npm install + build since we did that above

0 commit comments

Comments
 (0)