| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import { execSync } from 'node:child_process'; |
| import { existsSync } from 'node:fs'; |
| import { dirname, join } from 'node:path'; |
| import { fileURLToPath } from 'node:url'; |
|
|
| const __dirname = dirname(fileURLToPath(import.meta.url)); |
| const root = join(__dirname, '..'); |
|
|
| |
| if (!existsSync(join(root, 'node_modules'))) { |
| execSync('npm install', { stdio: 'inherit', cwd: root }); |
| } |
|
|
| |
| execSync('npm run generate', { 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 { |
| |
| console.log('Building @google/gemini-cli-core...'); |
| execSync('npm run build -w @google/gemini-cli-core', { |
| stdio: 'inherit', |
| cwd: root, |
| }); |
|
|
| |
| 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 --no-install npm-run-all --parallel ${parallelWorkspaces.map((w) => `"build -w ${w}"`).join(' ')}`, |
| { stdio: 'inherit', cwd: root }, |
| ); |
| } |
|
|
| |
| |
| try { |
| execSync('node scripts/sandbox_command.js -q', { |
| stdio: 'inherit', |
| cwd: root, |
| }); |
| if ( |
| process.env.BUILD_SANDBOX === '1' || |
| process.env.BUILD_SANDBOX === 'true' |
| ) { |
| execSync('node scripts/build_sandbox.js -s', { |
| stdio: 'inherit', |
| cwd: root, |
| }); |
| } |
| } catch { |
| |
| } |
|
|