Skip to content

fix: skip hidden lockfile save on dry run - #9417

Merged
owlstronaut merged 1 commit into
release/v11from
backport/v11/9395
May 27, 2026
Merged

owlstronaut merged 1 commit into
release/v11from
backport/v11/9395

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #9395 to release/v11.

## Summary

- stop Arborist from saving `node_modules/.package-lock.json` during
dry-run reification
- add a regression that keeps both `package-lock.json` and the hidden
lockfile unchanged after `update: true, dryRun: true`

This addresses the dry-run lockfile mutation part of #9187. The JSON
output behavior is separate and already has #8567 open.

## Testing

- `../../node_modules/.bin/tap --no-coverage --no-check-coverage
test/arborist/reify.js -g 'dry-run update does not save lockfiles'`
- `../../node_modules/.bin/tap --no-coverage --no-check-coverage
test/arborist/reify.js -g 'dry run, do not get anything wet|save
complete lockfile on update-all'`
- `../../node_modules/.bin/eslint lib/arborist/reify.js
test/arborist/reify.js`
- `git diff --check`

Co-authored-by: Puneet Dixit <236133619+puneetdixit200@users.noreply.github.com>
(cherry picked from commit b77850e)
@owlstronaut owlstronaut reopened this May 27, 2026
@owlstronaut
owlstronaut merged commit 4d141a0 into release/v11 May 27, 2026
35 checks passed
@owlstronaut
owlstronaut deleted the backport/v11/9395 branch May 27, 2026 16:40
@github-actions github-actions Bot mentioned this pull request May 27, 2026
fengmk2 added a commit to voidzero-dev/vite-plus that referenced this pull request Nov 21, 2026
…e --lockfile-only (#3518)

The current `vp install --frozen-lockfile --lockfile-only` on npm drops
`--lockfile-only` and runs a plain `npm ci`, which removes
`node_modules`, reinstalls dependencies, and runs lifecycle scripts.

With npm 11.16.0 or later, the combination runs `npm ci --dry-run
--ignore-scripts`. It checks that the lockfile agrees with
`package.json` and preserves the installed dependencies.

npm 10.5.1 stopped clearing `node_modules` during dry runs. npm 11.16.0
also stopped writing `node_modules/.package-lock.json`, which could make
a later install skip a needed update. Vite+ rejects this flag
combination when npm is older or its version is unknown.
[npm/cli#9417](npm/cli#9417)

🤖 Generated with [Claude Code](https://claude.com/claude-code) and
[Codex](https://openai.com/codex/)

---------

Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants