fix(pack): honor min-release-age-exclude#9760
Open
martinrrm wants to merge 1 commit into
Open
Conversation
Apply release-age exclusions to both manifest resolutions used by npm pack. Resolve aliases by their registry target so an excluded alias cannot bypass the cutoff. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: dec204b6-ad66-45a5-8228-831e306f6ba6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make
npm packhonormin-release-age-excludewhen resolving packages from a registry.Given:
npm pack @myscope/some-package@1.2.3incorrectly failed with ETARGET when the package was newer than seven days, despite matching the exclusion.Root cause
min-release-ageis flattened into thebeforeoption consumed bypacote. However,pacotedoes not interpretmin-release-age-exclude; callers must remove before for matching packages.npm packperforms two manifest resolutions:pacote.manifestlibnpmpackBoth resolutions received the unmodified
beforeoption, so the exclusion was never applied.Fix
Derive effective options for each package spec using the existing Arborist release-age helpers:
• Clear
beforewhen the package matchesmin-release-age-exclude• Preserve the cutoff for nonmatching packages
• Pass the same effective options to both manifest resolutions
Using the alias target prevents an excluded alias name from disabling the release-age policy for an unrelated package.
Test coverage
Added regression coverage confirming that:
• A recently published scoped package matching an exclusion glob can be packed
• An excluded alias name does not exempt its non-excluded registry target
The original scenario was also reproduced against a local registry: it failed with
ETARGETbefore this change and successfully produced the tarball afterward.References
Fixes #9759