mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-02 01:11:24 -07:00
perf(build): optimize build scripts for parallel execution and remove redundant checks (#24307)
This commit is contained in:
@@ -32,7 +32,32 @@ if (!existsSync(join(root, 'node_modules'))) {
|
||||
|
||||
// build all workspaces/packages
|
||||
execSync('npm run generate', { stdio: 'inherit', cwd: root });
|
||||
execSync('npm run build --workspaces', { stdio: 'inherit', cwd: root });
|
||||
|
||||
if (process.env.CI) {
|
||||
console.log('CI environment detected. Building workspaces sequentially...');
|
||||
execSync('npm run build --workspaces', { stdio: 'inherit', cwd: root });
|
||||
} else {
|
||||
// Build core first because everyone depends on it
|
||||
console.log('Building @google/gemini-cli-core...');
|
||||
execSync('npm run build -w @google/gemini-cli-core', {
|
||||
stdio: 'inherit',
|
||||
cwd: root,
|
||||
});
|
||||
|
||||
// Build the rest in parallel
|
||||
console.log('Building other workspaces in parallel...');
|
||||
const workspaceInfo = JSON.parse(
|
||||
execSync('npm query .workspace --json', { cwd: root, encoding: 'utf-8' }),
|
||||
);
|
||||
const parallelWorkspaces = workspaceInfo
|
||||
.map((w) => w.name)
|
||||
.filter((name) => name !== '@google/gemini-cli-core');
|
||||
|
||||
execSync(
|
||||
`npx npm-run-all --parallel ${parallelWorkspaces.map((w) => `"build -w ${w}"`).join(' ')}`,
|
||||
{ stdio: 'inherit', cwd: root },
|
||||
);
|
||||
}
|
||||
|
||||
// also build container image if sandboxing is enabled
|
||||
// skip (-s) npm install + build since we did that above
|
||||
|
||||
Reference in New Issue
Block a user