mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
fix(browser): postinstall installs the pinned agent-browser range
The postinstall fallback ran `npm install -g agent-browser@latest`. It now installs the range from the package's own dependencies (^0.41.0), so the global CLI cannot drift from the tested version. Re-applies #1452 (its 0.6.0 pin had gone stale). Co-authored-by: sjursky <10976569+sjursky@users.noreply.github.com> Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
1 parent
09bd1bf304
commit
eae0767527
2 files changed
+22
-1
No files matched your search
@@ -23,7 +23,7 @@
|
||||
"test:e2e": "vitest run tests/e2e",
|
||||
"lint": "eslint src/",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"postinstall": "node -e \"const{execSync}=require('child_process');try{execSync('agent-browser --version',{stdio:'ignore'});}catch{console.log('\\n📦 Installing agent-browser globally...');try{execSync('npm install -g agent-browser@latest',{stdio:'inherit'});console.log('✅ agent-browser installed successfully!');}catch(e){console.log('⚠️ Could not install agent-browser globally. Run manually:\\n npm install -g agent-browser@latest');}}\""
|
||||
"postinstall": "node -e \"const{execSync}=require('child_process');const v=require('./package.json').dependencies['agent-browser'];try{execSync('agent-browser --version',{stdio:'ignore'});}catch{console.log('\\n📦 Installing agent-browser globally...');try{execSync('npm install -g agent-browser@'+v,{stdio:'inherit'});console.log('✅ agent-browser installed successfully!');}catch(e){console.log('⚠️ Could not install agent-browser globally. Run manually:\\n npm install -g agent-browser@'+v);}}\""
|
||||
},
|
||||
"dependencies": {
|
||||
"agent-browser": "^0.41.0",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join } from 'node:path';
|
||||
|
||||
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json');
|
||||
const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
|
||||
|
||||
describe('postinstall agent-browser install', () => {
|
||||
const postinstall: string = pkg.scripts.postinstall;
|
||||
|
||||
it('never installs an unpinned agent-browser@latest', () => {
|
||||
expect(postinstall).not.toMatch(/agent-browser@latest/);
|
||||
});
|
||||
|
||||
it('installs the same agent-browser range the package depends on', () => {
|
||||
expect(pkg.dependencies['agent-browser']).toBeTruthy();
|
||||
expect(postinstall).toContain("require('./package.json').dependencies['agent-browser']");
|
||||
expect(postinstall).toContain("'npm install -g agent-browser@'+v");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user