Skip to content

fix: exempt explicit pack targets from allow-directory#9756

Open
ychampion wants to merge 1 commit into
npm:latestfrom
ychampion:fix/allow-directory-pack-root
Open

fix: exempt explicit pack targets from allow-directory#9756
ychampion wants to merge 1 commit into
npm:latestfrom
ychampion:fix/allow-directory-pack-root

Conversation

@ychampion

Copy link
Copy Markdown

Summary

  • allow explicit directory targets through npm pack and npm publish when allow-directory is none or root
  • keep dependency fetch policies unchanged and cover the shared library plus both CLI commands

Why

allow-directory restricts directory dependencies, but the local package selected for packing or publishing is the command target. The current flow applies the dependency policy to that target during manifest or tarball preparation.

Closes #9755.

Validation

  • node . run test - passed (123 test files, 100% coverage)
  • node . run test -w libnpmpack - passed (100% coverage)
  • dry-run pack and publish smokes with allow-directory=none|root - passed

Constraint: allow-directory governs directory dependencies, not the package explicitly selected for pack or publish.
Rejected: Override only in publish | leaves libnpmpack callers and npm pack inconsistent at the same policy boundary.
Confidence: high
Scope-risk: narrow
Directive: Keep registry, remote, file, git, and dependency resolution subject to their configured fetch policies.
Tested: node . run test; node . run test -w libnpmpack; publish and pack dry-run smoke for allow-directory=none|root; registry/file denial probes; git diff --check
Not-tested: Manual CLI smoke on non-Linux platforms
@ychampion ychampion requested review from a team as code owners July 12, 2026 15:34
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.

[BUG] allow-directory=none|root breaks npm publish

1 participant