Files
filip131311 dd702fc720 fix: detect missing global install in argent update (#180)
## Summary

`npx @swmansion/argent update` falsely reported *"Already on the latest
version"* after the user had removed the package via `npx
@swmansion/argent uninstall`.

`getInstalledVersion()` reads `package.json` from `PACKAGE_ROOT`, which
under `npx` is the npx-cached copy of argent — always the registry's
latest. The version compare then matches and short-circuits, hiding the
fact that there is no global install at all.

- Share `isGloballyInstalled()` between `init` and `update` via
`utils.ts`; `update.ts` now routes through a fresh-install prompt
(`Install @swmansion/argent@<latest> globally?`) when no permanent
argent binary is on PATH.
- Fix a Windows-only bug in the temp-runner check while the helper was
being moved: `where argent` returns multiple lines, and the previous
logic flagged the entire output as transient if *any* line contained an
npx marker. Now each line from `where` / `which -a` is inspected
independently, so a real global install is not masked by a concurrent
npx invocation.
- Add `isTempRunnerPath()` plus 5 unit tests covering npx, pnpm dlx,
bunx, Windows dlx, and real global paths.

## Test plan

- [x] `npm run build` (argent-installer) — passes
- [x] `npm test` (argent-installer) — 231 passing (5 new)
- [x] `npx prettier --write` on touched files — no diffs
- [ ] Manual: `npm install -g @swmansion/argent` → `npx
@swmansion/argent uninstall` → `npx @swmansion/argent update` should now
offer to install the latest version instead of reporting "already on the
latest"
- [ ] Manual: `argent update` while globally installed and on latest
still reports "already on the latest version"
- [ ] Manual: `argent update` while globally installed and on an older
version still prompts to update
2026-05-04 16:23:02 +02:00
..