fix: prevent stale native version and skip npm-bin rewrite on pnpm
This commit is contained in:
+3
-2
@@ -18,10 +18,11 @@
|
||||
"prepare": "husky",
|
||||
"version:sync": "node scripts/sync-version.js",
|
||||
"version": "npm run version:sync && git add cli/Cargo.toml",
|
||||
"native:clean": "cargo clean --manifest-path cli/Cargo.toml -p agent-browser-stealth",
|
||||
"build": "tsc",
|
||||
"build:native": "npm run version:sync && cargo build --release --manifest-path cli/Cargo.toml && node scripts/copy-native.js",
|
||||
"build:native": "npm run version:sync && npm run native:clean && cargo build --release --manifest-path cli/Cargo.toml && node scripts/copy-native.js",
|
||||
"build:linux": "npm run version:sync && docker compose -f docker/docker-compose.yml run --rm build-linux",
|
||||
"build:macos": "npm run version:sync && (cargo build --release --manifest-path cli/Cargo.toml --target aarch64-apple-darwin & cargo build --release --manifest-path cli/Cargo.toml --target x86_64-apple-darwin & wait) && cp cli/target/aarch64-apple-darwin/release/agent-browser bin/agent-browser-darwin-arm64 && cp cli/target/x86_64-apple-darwin/release/agent-browser bin/agent-browser-darwin-x64",
|
||||
"build:macos": "npm run version:sync && npm run native:clean && (cargo build --release --manifest-path cli/Cargo.toml --target aarch64-apple-darwin & cargo build --release --manifest-path cli/Cargo.toml --target x86_64-apple-darwin & wait) && cp cli/target/aarch64-apple-darwin/release/agent-browser bin/agent-browser-darwin-arm64 && cp cli/target/x86_64-apple-darwin/release/agent-browser bin/agent-browser-darwin-x64",
|
||||
"build:windows": "npm run version:sync && docker compose -f docker/docker-compose.yml run --rm build-windows",
|
||||
"build:all-platforms": "npm run version:sync && (npm run build:linux & npm run build:windows & wait) && npm run build:macos",
|
||||
"build:docker": "docker build -t agent-browser-builder -f docker/Dockerfile.build .",
|
||||
|
||||
@@ -161,7 +161,19 @@ function showPlaywrightReminder() {
|
||||
* Fix npm's bin entry on global installs to use the native binary directly.
|
||||
* This provides zero-overhead CLI execution for global installs.
|
||||
*/
|
||||
function isPnpmGlobalInstall() {
|
||||
const ua = process.env.npm_config_user_agent || '';
|
||||
return ua.includes('pnpm/');
|
||||
}
|
||||
|
||||
async function fixGlobalInstallBin() {
|
||||
// pnpm already manages global shims in its own bin dir.
|
||||
// Rewriting links via `npm prefix -g` can create stale links in unrelated paths
|
||||
// (e.g. /opt/homebrew/bin), which then shadow pnpm's up-to-date shims.
|
||||
if (isPnpmGlobalInstall()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform() === 'win32') {
|
||||
await fixWindowsShims();
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user