# libnpmteam
[](https://npm.im/libnpmteam)
[](https://npm.im/libnpmteam)
[](https://github.com/npm/cli/actions/workflows/ci-libnpmteam.yml)
[`libnpmteam`](https://github.com/npm/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
```javascript
const team = require('libnpmteam')
// List all teams for the @npm org.
console.log(await team.lsTeams('npm'))
```
## Publishing
1. Manually create CHANGELOG.md file
1. Commit changes to CHANGELOG.md
```bash
$ git commit -m "chore: updated CHANGELOG.md"
```
1. Run `npm version {newVersion}`
```bash
# 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
* [Installing](#install)
* [Example](#example)
* [API](#api)
* [team opts](#opts)
* [`create()`](#create)
* [`destroy()`](#destroy)
* [`add()`](#add)
* [`rm()`](#rm)
* [`lsTeams()`](#ls-teams)
* [`lsTeams.stream()`](#ls-teams-stream)
* [`lsUsers()`](#ls-users)
* [`lsUsers.stream()`](#ls-users-stream)
### Install
`$ npm install libnpmteam`
### API
#### `opts` for `libnpmteam` commands
`libnpmteam` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch).
All options are passed through directly to that library, so please refer to [its
own `opts`
documentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options)
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 `@