mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
## What was wrong `pi update --extensions` first looks up the newest version of each npm package with `npm view`. If that version is newer than the installed one, pi runs `npm install <name>@latest`. The two commands read different registry documents, and each is cached separately. Shortly after a publish, `npm view` can already report the new version while `npm install` still resolves the old one. npm then exits successfully, pi prints "Updated packages", and the startup banner lists the same package again on the next launch. The user can't tell that nothing was actually updated. ## What the change does - `shouldUpdateNpmSource` now returns the installed version and the registry version along with its decision. Both are carried on `NpmUpdateTarget`. - After `npm install`, `updateNpmBatch` re-reads each package's installed version. If the registry lookup succeeded and the version did not change, it emits a `progress` event with the message: `<source> is still X (registry reports Y); npm registry metadata may be stale, try again in a few minutes`. - The package CLI now prints `progress` events in yellow. Until now nothing emitted them. Install behavior is unchanged: pi still installs `@latest`. ## Testing - New test in `test/package-manager.test.ts`: two packages are flagged for update and only one is actually upgraded. The warning is emitted only for the unchanged one. The test fails without the change. - `test/package-manager.test.ts` passes (129 tests), and `npm run check` passes. - Ran the built CLI with an `npmCommand` stub whose `view` reports `1.0.1` and whose `install` changes nothing: ``` Updating npm:demo-pkg... npm:demo-pkg is still 1.0.0 (registry reports 1.0.1); npm registry metadata may be stale, try again in a few minutes Updated packages ``` Fixes #11536 Requested by @davidbrai Co-authored-by: triagent <triagent@localhost> |
||
|---|---|---|
| .. | ||
| bun | ||
| cli | ||
| core | ||
| experimental | ||
| extensions | ||
| modes | ||
| utils | ||
| cli.ts | ||
| config.ts | ||
| index.ts | ||
| main.ts | ||
| migrations.ts | ||
| package-manager-cli.ts | ||
| rpc-entry.ts | ||