libnpmaccess
programmatic library for `npm access` commands
Last updated 6 years ago by zkat .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ npm install libnpmaccess 
SYNC missed versions from official npm registry.

libnpmaccess

npm version license CI - libnpmaccess

libnpmaccess is a Node.js library that provides programmatic access to the guts of the npm CLI's npm access command. This includes managing account mfa settings, listing packages and permissions, looking at package collaborators, and defining package permissions for users, orgs, and teams.

Example

const access = require('libnpmaccess')
const opts = { '//registry.npmjs.org/:_authToken: 'npm_token }

// List all packages @zkat has access to on the npm registry.
console.log(Object.keys(await access.getPackages('zkat', opts)))

API

opts for all libnpmaccess commands

libnpmaccess uses npm-registry-fetch.

All options are passed through directly to that library, so please refer to its own opts documentation for options that can be passed in.

spec parameter for all libnpmaccess commands

spec must be an npm-package-arg-compatible registry spec.

access.getCollaborators(spec, opts) -> Promise<Object>

Gets collaborators for a given package

access.getPackages(user|scope|team, opts) -> Promise<Object>

Gets all packages for a given user, scope, or team.

Teams should be in the format scope:team or @scope:team

Users and scopes can be in the format @scope or scope

access.getVisibility(spec, opts) -> Promise<Object>

Gets the visibility of a given package

access.removePermissions(team, spec, opts) -> Promise<Boolean>

Removes the access for a given team to a package.

Teams should be in the format scope:team or @scope:team

access.setAccess(package, access, opts) -> Promise<Boolean>

Sets access level for package described by spec.

The npm registry accepts the following access levels:

public: package is public private: package is private

The npm registry also only allows scoped packages to have their access level set.

access.setMfa(spec, level, opts) -> Promise<Boolean>`

Sets the publishing mfa requirements for a given package. Level must be one of the following

none: mfa is not required to publish this package. publish: mfa is required to publish this package, automation tokens cannot be used to publish. automation: mfa is required to publish this package, automation tokens may also be used for publishing from continuous integration workflows.

access.setPermissions(team, spec, permssions, opts) -> Promise<Boolean>`

Sets permissions levels for a given team to a package.

Teams should be in the format scope:team or @scope:team

The npm registry accepts the following permissions:

read-only: Read only permissions read-write: Read and write (aka publish) permissions

Current Tags

  • 7.0.3                                ...           backport (9 months ago)
  • 9.0.0                                ...           latest (a month ago)
  • 8.0.0-pre.0                                ...           prerelease (a year ago)

37 Versions

  • 9.0.0                                ...           a month ago
  • 8.0.6                                ...           6 months ago
  • 8.0.5                                ...           6 months ago
  • 8.0.4                                ...           7 months ago
  • 8.0.3                                ...           7 months ago
  • 7.0.3                                ...           9 months ago
  • 8.0.2                                ...           a year ago
  • 8.0.1                                ...           a year ago
  • 8.0.0                                ...           a year ago
  • 8.0.0-pre.0                                ...           a year ago
  • 7.0.2                                ...           2 years ago
  • 7.0.1                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 7.0.0-pre.2                                ...           2 years ago
  • 7.0.0-pre.1                                ...           2 years ago
  • 7.0.0-pre.0                                ...           2 years ago
  • 6.0.4                                ...           2 years ago
  • 6.0.3                                ...           3 years ago
  • 6.0.2                                ...           3 years ago
  • 6.0.1                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.0.1                                ...           3 years ago
  • 5.0.0                                ...           3 years ago
  • 4.0.3                                ...           3 years ago
  • 4.0.2                                ...           4 years ago
  • 4.0.1                                ...           4 years ago
  • 4.0.0                                ...           5 years ago
  • 3.0.2                                ...           5 years ago
  • 3.0.1                                ...           6 years ago
  • 3.0.0                                ...           6 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.2.2                                ...           6 years ago
  • 1.2.1                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (5)

© 2010 - cnpmjs.org x YWFE | Home | YWFE