mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-23 19:44:30 -07:00
fix(release): exclude ripgrep binaries from npm tarballs (#25841)
This commit is contained in:
@@ -20,8 +20,7 @@
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"vendor"
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@a2a-js/sdk": "0.3.11",
|
||||
|
||||
@@ -179,6 +179,27 @@ try {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 2b. Copy host-platform ripgrep binary into the bundle for the SEA.
|
||||
// (npm tarballs omit these to stay under the registry upload limit.)
|
||||
const ripgrepVendorSrc = join(root, 'packages/core/vendor/ripgrep');
|
||||
const ripgrepVendorDest = join(bundleDir, 'vendor', 'ripgrep');
|
||||
if (existsSync(ripgrepVendorSrc)) {
|
||||
const rgBinName = `rg-${process.platform}-${process.arch}${
|
||||
process.platform === 'win32' ? '.exe' : ''
|
||||
}`;
|
||||
const rgSrc = join(ripgrepVendorSrc, rgBinName);
|
||||
if (existsSync(rgSrc)) {
|
||||
mkdirSync(ripgrepVendorDest, { recursive: true });
|
||||
cpSync(rgSrc, join(ripgrepVendorDest, rgBinName), { dereference: true });
|
||||
console.log(`Copied ${rgBinName} to bundle/vendor/ripgrep/`);
|
||||
} else {
|
||||
console.warn(
|
||||
`Warning: bundled ripgrep binary not found for ${process.platform}/${process.arch} at ${rgSrc}. ` +
|
||||
`The SEA will fall back to system grep at runtime.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Stage & Sign Native Modules
|
||||
const includeNativeModules = process.env.BUNDLE_NATIVE_MODULES !== 'false';
|
||||
console.log(`Include Native Modules: ${includeNativeModules}`);
|
||||
@@ -304,6 +325,23 @@ if (existsSync(policyDir)) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add ripgrep binary (copied in step 2b). Must be registered here so that
|
||||
// sea-launch.cjs extracts it to runtimeDir/vendor/ripgrep/ on startup; the
|
||||
// runtime resolver in packages/core/src/tools/ripGrep.ts uses __dirname-
|
||||
// relative paths to find it.
|
||||
if (existsSync(ripgrepVendorDest)) {
|
||||
const rgFiles = globSync('*', { cwd: ripgrepVendorDest, nodir: true });
|
||||
for (const rgFile of rgFiles) {
|
||||
const fsPath = join(ripgrepVendorDest, rgFile);
|
||||
const relativePath = join('vendor', 'ripgrep', rgFile);
|
||||
const content = readFileSync(fsPath);
|
||||
const hash = sha256(content);
|
||||
const assetKey = `vendor:${rgFile}`;
|
||||
assets[assetKey] = fsPath;
|
||||
manifest.files.push({ key: assetKey, path: relativePath, hash: hash });
|
||||
}
|
||||
}
|
||||
|
||||
// Add assets from Staging
|
||||
if (includeNativeModules) {
|
||||
addAssetsFromDir('node_modules/@lydell', 'node_modules/@lydell');
|
||||
|
||||
@@ -108,19 +108,7 @@ if (!existsSync(bundleMcpSrc)) {
|
||||
cpSync(bundleMcpSrc, bundleMcpDest, { recursive: true, dereference: true });
|
||||
console.log('Copied bundled chrome-devtools-mcp to bundle/bundled/');
|
||||
|
||||
// 7. Copy pre-built ripgrep vendor binaries
|
||||
const ripgrepVendorSrc = join(root, 'packages/core/vendor/ripgrep');
|
||||
const ripgrepVendorDest = join(bundleDir, 'vendor', 'ripgrep');
|
||||
if (existsSync(ripgrepVendorSrc)) {
|
||||
mkdirSync(ripgrepVendorDest, { recursive: true });
|
||||
cpSync(ripgrepVendorSrc, ripgrepVendorDest, {
|
||||
recursive: true,
|
||||
dereference: true,
|
||||
});
|
||||
console.log('Copied ripgrep vendor binaries to bundle/vendor/ripgrep/');
|
||||
}
|
||||
|
||||
// 8. Copy Extension Examples
|
||||
// 7. Copy Extension Examples
|
||||
const extensionExamplesSrc = join(
|
||||
root,
|
||||
'packages/cli/src/commands/extensions/examples',
|
||||
|
||||
Reference in New Issue
Block a user