npx / bunx storebound always run the newest version: a copy started from the npx or bunx cache re-runs the command as storebound@<newest> when npm has a newer one (registry asked at most every 10 minutes, 1.5 s timeout; off with STOREBOUND_NO_UPDATE=1, in CI and offline); a project install gets a one-line note instead
This commit is contained in:
parent
3381673ae6
commit
14ffe3545a
3 changed files with 86 additions and 0 deletions
15
tests/self-update.test.ts
Normal file
15
tests/self-update.test.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import { expect, test } from 'bun:test';
|
||||
import { newer, runner } from '../cli/lib/self-update';
|
||||
|
||||
test('npx / bunx caches are swapped for the newest version, a project install only gets a note', () => {
|
||||
expect(runner('/Users/you/.npm/_npx/1a2b/node_modules/storebound/dist/storebound.mjs')).toBe('npx');
|
||||
expect(runner('C:\\Users\\x\\AppData\\Local\\npm-cache\\_npx\\1a2b\\node_modules\\storebound\\dist\\storebound.mjs')).toBe('npx');
|
||||
expect(runner('/Users/you/.bun/install/cache/storebound@0.8.12@@@1/dist/storebound.mjs')).toBe('bunx');
|
||||
expect(runner('/Users/you/app/node_modules/storebound/dist/storebound.mjs')).toBe('project');
|
||||
expect(runner('/Users/you/storebound/cli/index.ts')).toBe('other');
|
||||
expect(newer('0.8.13', '0.8.12')).toBe(true);
|
||||
expect(newer('0.8.12', '0.8.12')).toBe(false);
|
||||
expect(newer('0.9.0', '0.8.99')).toBe(true);
|
||||
expect(newer('0.8.12', '0.8.13')).toBe(false);
|
||||
expect(newer('0.8.12', '0.8.12-rc.1')).toBe(true);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue