Skip to content

feat: publish --access=private alias for restricted - #9153

Merged
reggi merged 2 commits into
latestfrom
reggi/publish-access-private
May 27, 2026
Merged

feat: publish --access=private alias for restricted#9153
reggi merged 2 commits into
latestfrom
reggi/publish-access-private

Conversation

@reggi

Copy link
Copy Markdown
Contributor

Summary

Adds private as a valid value for --access in npm publish, as an alias for restricted.

Motivation

The --access flag on npm publish currently accepts restricted and public. However, in everyday usage, the npm community colloquially refers to non-public packages as "private packages" — not "restricted packages." The npm website, the npm registry, and npm access all use the term "private" to describe these packages.

npm publish --access vs npm access

These are two different commands that deal with package visibility in different ways:

  • npm publish --access=<public|restricted> sets the visibility of a package at publish time. This is only relevant for scoped packages, where the default for new packages is public.
  • npm access set status=<public|private> changes the visibility of an already published package. Notably, npm access already uses private (not restricted) as its term for non-public packages.

This inconsistency means that a user who runs npm access set status=private might naturally try npm publish --access=private and get an error. Since everyone already calls them "private packages," the CLI should accept that term too. This PR resolves that by accepting private as a synonym for restricted during publish.

Changes

  • Added private to the valid values for the access config definition
  • The flatten function maps privaterestricted so the registry always receives restricted
  • Updated documentation to note that private is an alias for restricted
  • Added tests for the --access=private flow

@reggi
reggi requested a review from a team as a code ownerMarch 26, 2026 19:14
@reggi
reggiforce-pushed the reggi/publish-access-private branch from 7f83332 to 1155072CompareMarch 26, 2026 19:22
owlstronaut
owlstronaut previously approved these changes Mar 31, 2026
@wraithgar

Copy link
Copy Markdown
Contributor

Looks like this just needs snapshots updated?

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reggi
reggiforce-pushed the reggi/publish-access-private branch from 1155072 to 032b144CompareMay 21, 2026 19:36
@reggi
reggi requested a review from a team as a code ownerMay 21, 2026 19:36
@reggi
reggi merged commit c9be2d1 into latestMay 27, 2026
35 checks passed
@reggi
reggi deleted the reggi/publish-access-private branch May 27, 2026 16:06
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Backport to release/v11 created: #9416

@github-actionsgithub-actionsBot mentioned this pull request May 27, 2026
reggi added a commit that referenced this pull request May 27, 2026
Backport of #9153 to `release/v11`.
Co-authored-by: Tea Reggi <reggi@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@reggi@wraithgar@owlstronaut