Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new npm access and libnpmaccess interfaces #5445

Merged
merged 2 commits into from
Sep 14, 2022
Merged

new npm access and libnpmaccess interfaces #5445

merged 2 commits into from
Sep 14, 2022

Conversation

wraithgar
Copy link
Member

@wraithgar wraithgar commented Aug 31, 2022

Output is no longer json by default, but human readable.

We should decide if this output is ok, and what to output for the commands that currently have no output (TODOs in the code).

$ node . access -h
Set access level on published packages

Usage:
npm access list packages [<user>|<scope>|<scope:team> [<package>]
npm access list collaborators [<package> [<user>]]
npm access get status [<package>]
npm access set status=public|private [<package>]
npm access set mfa=false|publish|automation [<package>]
npm access grant <read-only|read-write> <scope:team> [<package>]
npm access revoke <scope:team> [<package>]

Options:
[--json] [--otp <otp>] [--registry <registry>]

Run "npm help access" for more info

Closes: npm/statusboard#477
Closes: npm/statusboard#486

@wraithgar wraithgar added semver:major backwards-incompatible breaking changes ws:libnpmaccess Related to the libnpmaccess workspace. cmd:access related to `npm access` labels Aug 31, 2022
@wraithgar wraithgar requested a review from a team as a code owner August 31, 2022 16:38
@wraithgar wraithgar marked this pull request as draft August 31, 2022 16:44
@npm-cli-bot
Copy link
Collaborator

npm-cli-bot commented Aug 31, 2022

no statistically significant performance changes detected

timing results
app-large clean lock-only cache-only cache-only
peer-deps
modules-only no-lock no-cache no-modules no-clean no-clean
audit
npm@8 43.249 ±1.23 24.742 ±0.29 22.544 ±0.33 26.367 ±1.58 3.828 ±0.08 3.878 ±0.03 3.188 ±0.05 15.614 ±0.22 3.224 ±0.03 4.340 ±0.06
#5445 44.686 ±1.21 25.782 ±0.45 25.857 ±4.21 26.664 ±1.11 3.857 ±0.02 3.904 ±0.09 3.213 ±0.01 15.942 ±0.06 3.133 ±0.00 4.624 ±0.25
app-medium clean lock-only cache-only cache-only
peer-deps
modules-only no-lock no-cache no-modules no-clean no-clean
audit
npm@8 32.648 ±0.05 18.622 ±0.08 16.742 ±0.19 18.344 ±0.00 3.596 ±0.13 3.571 ±0.03 3.174 ±0.11 12.112 ±0.50 3.123 ±0.03 4.115 ±0.04
#5445 32.797 ±1.85 19.252 ±0.22 16.987 ±0.07 18.045 ±0.12 3.536 ±0.08 3.572 ±0.00 3.060 ±0.04 11.692 ±0.09 3.042 ±0.02 4.018 ±0.09

@wraithgar wraithgar force-pushed the gar/access-v9 branch 3 times, most recently from 83e9fe2 to 4ead473 Compare August 31, 2022 18:17
lib/commands/access.js Outdated Show resolved Hide resolved
Comment on lines +18 to +19
testComp(['npm', 'access', 'list'], ['packages', 'collaborators'])
testComp(['npm', 'access', 'ls'], ['packages', 'collaborators'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

npm owner add suggests s/collaborators/owners?

Copy link
Member Author

@wraithgar wraithgar Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are interacting with totally different api endpoints. One adds/removes folks from maintainers in the packument, the other interacts with a /-/package/[name]/collaborators endpoint. There's obviously overlap there but we are providing access to the two api methods we have.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m just speaking to the terminology - user-facing terms should be consistent even if api endpoints weren’t built to be.

BREAKING CHANGE: the api for libnpmaccess is different now

It is aligned more with how npm uses it, consolidating the mfa functions into a
single command, and renames the functions to be easier to eventually
consolidate into a registry client library.

See the README for the new api.
docs/content/commands/npm-access.md Show resolved Hide resolved
lib/commands/access.js Outdated Show resolved Hide resolved
lib/commands/access.js Outdated Show resolved Hide resolved
lib/commands/access.js Outdated Show resolved Hide resolved
workspaces/libnpmaccess/README.md Show resolved Hide resolved
workspaces/libnpmaccess/lib/index.js Show resolved Hide resolved
BREAKING CHANGE: renames most of the `npm access` subcommands

 - `edit`, having never been implemented, is removed
 - `public` is now `set status=public`
 - `restricted` is now `set status=private`
 - `ls-packages` is now `list packages`
 - `ls-collaborators` is now `list collaborators`
 - `2fa-required` is now `set mfa=publish`
 - `2fa-not-required` is now `set mfa=none`
 - `set mfa=automation` is added
 - output is no longer in json by default

Usage:
npm access list packages [<user>|<scope>|<scope:team> [<package>]
npm access list collaborators [<package> [<user>]]
npm access get status [<package>]
npm access set status=public|private [<package>]
npm access set mfa=false|publish|automation [<package>]
npm access grant <read-only|read-write> <scope:team> [<package>]
npm access revoke <scope:team> [<package>]

Options:
[--json] [--otp <otp>] [--registry <registry>]
@fritzy fritzy merged commit dc2f128 into latest Sep 14, 2022
@fritzy fritzy deleted the gar/access-v9 branch September 14, 2022 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmd:access related to `npm access` semver:major backwards-incompatible breaking changes ws:libnpmaccess Related to the libnpmaccess workspace.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BREAKING CHANGE(access): remove old commands feat(access): add new get, set & list
7 participants