mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-16 04:50:29 -07:00
refactor: derive optionalDependencies from root instead of hardcoding
Instead of maintaining a hardcoded allowlist of native modules, copy all optionalDependencies from the root package.json and exclude only gemini-cli-devtools. Less brittle if new native deps are added in the future.
This commit is contained in:
@@ -35,27 +35,10 @@ if (fs.existsSync(sourceBundleDir)) {
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read native module versions from root package.json
|
// Inherit optionalDependencies from root package.json, excluding dev-only packages.
|
||||||
const rootPkg = readJson('package.json');
|
const rootPkg = readJson('package.json');
|
||||||
const rootOptional = rootPkg.optionalDependencies || {};
|
const optionalDependencies = { ...(rootPkg.optionalDependencies || {}) };
|
||||||
|
delete optionalDependencies['gemini-cli-devtools'];
|
||||||
const nativeModules = [
|
|
||||||
'@lydell/node-pty',
|
|
||||||
'@lydell/node-pty-darwin-arm64',
|
|
||||||
'@lydell/node-pty-darwin-x64',
|
|
||||||
'@lydell/node-pty-linux-x64',
|
|
||||||
'@lydell/node-pty-win32-arm64',
|
|
||||||
'@lydell/node-pty-win32-x64',
|
|
||||||
'keytar',
|
|
||||||
'node-pty',
|
|
||||||
];
|
|
||||||
|
|
||||||
const optionalDependencies = {};
|
|
||||||
for (const mod of nativeModules) {
|
|
||||||
if (rootOptional[mod]) {
|
|
||||||
optionalDependencies[mod] = rootOptional[mod];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update @google/gemini-cli package.json for bundled npm release
|
// Update @google/gemini-cli package.json for bundled npm release
|
||||||
const cliPkgPath = 'packages/cli/package.json';
|
const cliPkgPath = 'packages/cli/package.json';
|
||||||
|
|||||||
Reference in New Issue
Block a user