mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 02:48:50 +00:00
## Summary Fixes a bug where `bun update --interactive` only updated `package.json` but didn't actually install the updated packages. Users had to manually run `bun install` afterwards. ## Root Cause The bug was in `savePackageJson()` in `src/cli/update_interactive_command.zig`: 1. The function wrote the updated `package.json` to disk 2. But it **didn't update the in-memory cache** (`WorkspacePackageJSONCache`) 3. When `installWithManager()` ran, it called `getWithPath()` which returned the **stale cached version** 4. So the installation proceeded with the old dependencies ## The Fix Update the cache entry after writing to disk (line 116): ```zig package_json.*.source.contents = new_package_json_source; ``` This matches the behavior in `updatePackageJSONAndInstall.zig` line 269. ## Test Plan Added comprehensive regression tests in `test/cli/update_interactive_install.test.ts`: - ✅ Verifies that `package.json` is updated - ✅ Verifies that `node_modules` is updated (this was failing before the fix) - ✅ Tests both normal update and `--latest` flag - ✅ Compares installed version to confirm packages were actually installed Run tests with: ```bash bun bd test test/cli/update_interactive_install.test.ts ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
6.0 KiB
6.0 KiB