npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

libnpmteam

v8.0.0

Published

npm Team management APIs

Downloads

2,760,643

Readme

libnpmteam

npm version license CI - libnpmteam

libnpmteam is a Node.js library that provides programmatic access to the guts of the npm CLI's npm team command and its various subcommands.

Example

const team = require('libnpmteam')

// List all teams for the @npm org.
console.log(await team.lsTeams('npm'))

Publishing

  1. Manually create CHANGELOG.md file
  2. Commit changes to CHANGELOG.md
    $ git commit -m "chore: updated CHANGELOG.md"
  3. Run npm version {newVersion}
    # Example
    $ npm version patch
    # 1. Runs `coverage` and `lint` scripts
    # 2. Bumps package version; and **create commit/tag**
    # 3. Runs `npm publish`; publishing directory with **unpushed commit**
    # 4. Runs `git push origin --follow-tags`

Table of Contents

Install

$ npm install libnpmteam

API

opts for libnpmteam commands

libnpmteam 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.

A couple of options of note for those in a hurry:

  • opts.token - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs.
  • opts.otp - certain operations will require an OTP token to be passed in. If a libnpmteam command fails with err.code === EOTP, please retry the request with {otp: <2fa token>}

> team.create(team, [opts]) -> Promise

Creates a team named team. Team names use the format @<scope>:<name>, with the @ being optional.

Additionally, opts.description may be passed in to include a description.

Example
await team.create('@npm:cli', {token: 'myregistrytoken'})
// The @npm:cli team now exists.

> team.destroy(team, [opts]) -> Promise

Destroys a team named team. Team names use the format @<scope>:<name>, with the @ being optional.

Example
await team.destroy('@npm:cli', {token: 'myregistrytoken'})
// The @npm:cli team has been destroyed.

> team.add(user, team, [opts]) -> Promise

Adds user to team.

Example
await team.add('zkat', '@npm:cli', {token: 'myregistrytoken'})
// @zkat now belongs to the @npm:cli team.

> team.rm(user, team, [opts]) -> Promise

Removes user from team.

Example
await team.rm('zkat', '@npm:cli', {token: 'myregistrytoken'})
// @zkat is no longer part of the @npm:cli team.

> team.lsTeams(scope, [opts]) -> Promise

Resolves to an array of team names belonging to scope.

Example
await team.lsTeams('@npm', {token: 'myregistrytoken'})
=>
[
  'npm:cli',
  'npm:web',
  'npm:registry',
  'npm:developers'
]

> team.lsTeams.stream(scope, [opts]) -> Stream

Returns a stream of teams belonging to scope.

For a Promise-based version of these results, see team.lsTeams().

Example
for await (let team of team.lsTeams.stream('@npm', {token: 'myregistrytoken'})) {
  console.log(team)
}

// outputs
// npm:cli
// npm:web
// npm:registry
// npm:developers

> team.lsUsers(team, [opts]) -> Promise

Resolves to an array of usernames belonging to team.

For a streamed version of these results, see team.lsUsers.stream().

Example
await team.lsUsers('@npm:cli', {token: 'myregistrytoken'})
=>
[
  'iarna',
  'zkat'
]

> team.lsUsers.stream(team, [opts]) -> Stream

Returns a stream of usernames belonging to team.

For a Promise-based version of these results, see team.lsUsers().

Example
for await (let user of team.lsUsers.stream('@npm:cli', {token: 'myregistrytoken'})) {
  console.log(user)
}

// outputs
// iarna
// zkat