mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
perf(build): optimize build scripts for parallel execution and remove redundant checks (#24307)
This commit is contained in:
@@ -108,7 +108,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"prepackage": "npm run generate:notices && npm run check-types && npm run lint && npm run build:prod",
|
"prepackage": "npm run generate:notices && npm run check-types && npm run lint && npm run build:prod",
|
||||||
"build": "npm run build:dev",
|
"build": "npm run build:dev",
|
||||||
"build:dev": "npm run check-types && npm run lint && node esbuild.js",
|
"build:dev": "node esbuild.js",
|
||||||
"build:prod": "node esbuild.js --production",
|
"build:prod": "node esbuild.js --production",
|
||||||
"generate:notices": "node ./scripts/generate-notices.js",
|
"generate:notices": "node ./scripts/generate-notices.js",
|
||||||
"prepare": "npm run generate:notices",
|
"prepare": "npm run generate:notices",
|
||||||
|
|||||||
+26
-1
@@ -32,7 +32,32 @@ if (!existsSync(join(root, 'node_modules'))) {
|
|||||||
|
|
||||||
// build all workspaces/packages
|
// build all workspaces/packages
|
||||||
execSync('npm run generate', { stdio: 'inherit', cwd: root });
|
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
|
// also build container image if sandboxing is enabled
|
||||||
// skip (-s) npm install + build since we did that above
|
// skip (-s) npm install + build since we did that above
|
||||||
|
|||||||
Reference in New Issue
Block a user