Skip to content

fix: disable lifecycle scripts during npm diff - #9956

Open
arthurianresolve wants to merge 1 commit into
npm:latestfrom
arthurianresolve:fix/9955-diff-disable-prepare-scripts
Open

fix: disable lifecycle scripts during npm diff#9956
arthurianresolve wants to merge 1 commit into
npm:latestfrom
arthurianresolve:fix/9955-diff-disable-prepare-scripts

Conversation

@arthurianresolve

Copy link
Copy Markdown

Fixes #9955

Summary

  • Force ignoreScripts: true when npm diff calls libnpmdiff.
  • Prevent local directory operands from running prepare while an inspection-only diff is being created.
  • Add command-level coverage that verifies the option cannot be overridden by normal flat options.

Testing

  • node_modules\.bin\tap.cmd --no-check-coverage test/lib/commands/diff.js — passed.
  • End-to-end temporary-package reproduction — npm diff exited successfully and did not create the prepare marker.

Compatibility note

Generated files that exist only after running prepare will no longer be materialized by npm diff. This is the intended behavior change for an inspection command; registry-to-registry and ordinary diff behavior remain unchanged.

@arthurianresolve
arthurianresolve marked this pull request as ready for review September 7, 2026 14:26
@arthurianresolve
arthurianresolve requested review from a team as code owners September 7, 2026 14:26
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.

npm diff runs prepare scripts while comparing local directories

1 participant