Skip to content

Commit

Permalink
CLI documentation update from CI
Browse files Browse the repository at this point in the history
  • Loading branch information
npm-cli-bot committed Apr 25, 2024
1 parent a9b1439 commit 834f1d7
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 61 deletions.
2 changes: 1 addition & 1 deletion content/cli/v10/commands/npm-access.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ redirect_from:
### Synopsis

```bash
npm access list packages [<user>|<scope>|<scope:team> [<package>]
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>]
Expand Down
14 changes: 7 additions & 7 deletions content/cli/v10/commands/npm-doctor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ redirect_from:
### Synopsis

```bash
npm doctor [ping] [registry] [versions] [environment] [permissions] [cache]
npm doctor [connection] [registry] [versions] [environment] [permissions] [cache]
```

Note: This command is unaware of workspaces.
Expand All @@ -58,25 +58,25 @@ Also, in addition to this, there are also very many issue reports due to using o

`npm doctor` verifies the following items in your environment, and if there are any recommended changes, it will display them. By default npm runs all of these checks. You can limit what checks are ran by specifying them as extra arguments.

#### `npm ping`
#### `Connecting to the registry`

By default, npm installs from the primary npm registry, `registry.npmjs.org`. `npm doctor` hits a special ping endpoint within the registry. This can also be checked with `npm ping`. If this check fails, you may be using a proxy that needs to be configured, or may need to talk to your IT staff to get access over HTTPS to `registry.npmjs.org`.
By default, npm installs from the primary npm registry, `registry.npmjs.org`. `npm doctor` hits a special connection testing endpoint within the registry. This can also be checked with `npm ping`. If this check fails, you may be using a proxy that needs to be configured, or may need to talk to your IT staff to get access over HTTPS to `registry.npmjs.org`.

This check is done against whichever registry you've configured (you can see what that is by running `npm config get registry`), and if you're using a private registry that doesn't support the `/whoami` endpoint supported by the primary registry, this check may fail.

#### `npm -v`
#### `Checking npm version`

While Node.js may come bundled with a particular version of npm, it's the policy of the CLI team that we recommend all users run `npm@latest` if they can. As the CLI is maintained by a small team of contributors, there are only resources for a single line of development, so npm's own long-term support releases typically only receive critical security and regression fixes. The team believes that the latest tested version of npm is almost always likely to be the most functional and defect-free version of npm.

#### `node -v`
#### `Checking node version`

For most users, in most circumstances, the best version of Node will be the latest long-term support (LTS) release. Those of you who want access to new ECMAscript features or bleeding-edge changes to Node's standard library may be running a newer version, and some may be required to run an older version of Node because of enterprise change control policies. That's OK! But in general, the npm team recommends that most users run Node.js LTS.

#### `npm config get registry`
#### `Checking configured npm registry`

You may be installing from private package registries for your project or company. That's great! Others may be following tutorials or StackOverflow questions in an effort to troubleshoot problems you may be having. Sometimes, this may entail changing the registry you're pointing at. This part of `npm doctor` just lets you, and maybe whoever's helping you with support, know that you're not using the default registry.

#### `which git`
#### `Checking for git executable in PATH`

While it's documented in the README, it may not be obvious that npm needs Git installed to do many of the things that it does. Also, in some cases – especially on Windows – you may have Git set up in such a way that it's not accessible via your `PATH` so that npm can find it. This check ensures that Git is available.

Expand Down
2 changes: 1 addition & 1 deletion content/cli/v10/commands/npm-ls.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Note: to get a "bottoms up" view of why a given package is included in the tree
Positional arguments are `name@version-range` identifiers, which will limit the results to only the paths to the packages named. Note that nested packages will _also_ show the paths to the specified packages. For example, running `npm ls promzard` in npm's source tree will show:

```bash
npm@10.5.2 /path/to/npm
npm@10.6.0 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
```
Expand Down
33 changes: 11 additions & 22 deletions content/cli/v10/commands/npm-profile.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,17 @@ Change your profile information on the registry. Note that this command depends

- `npm profile get [<property>]`: Display all of the properties of your profile, or one or more specific properties. It looks like:

```bash
+-----------------+---------------------------+
| name | example |
+-----------------+---------------------------+
| email | me@example.com (verified) |
+-----------------+---------------------------+
| two factor auth | auth-and-writes |
+-----------------+---------------------------+
| fullname | Example User |
+-----------------+---------------------------+
| homepage | |
+-----------------+---------------------------+
| freenode | |
+-----------------+---------------------------+
| twitter | |
+-----------------+---------------------------+
| github | |
+-----------------+---------------------------+
| created | 2015-02-26T01:38:35.892Z |
+-----------------+---------------------------+
| updated | 2017-10-02T21:29:45.922Z |
+-----------------+---------------------------+
```
name: example
email: e@example.com (verified)
two-factor auth: auth-and-writes
fullname: Example User
homepage:
freenode:
twitter:
github:
created: 2015-02-26T01:38:35.892Z
updated: 2017-10-02T21:29:45.922Z
```

- `npm profile set <property> <value>`: Set the value of a profile property. You can set the following properties this way: email, fullname, homepage, freenode, twitter, github
Expand Down
38 changes: 10 additions & 28 deletions content/cli/v10/commands/npm-token.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -51,40 +51,22 @@ This lets you list, create and revoke authentication tokens.

- `npm token list`: Shows a table of all active authentication tokens. You can request this as JSON with `--json` or tab-separated values with `--parseable`.

```bash
+--------+---------+------------+----------+----------------+
| id | token | created | read-only | CIDR whitelist |
+--------+---------+------------+----------+----------------+
| 7f3134 | 1fa9ba… | 2017-10-02 | yes | |
+--------+---------+------------+----------+----------------+
| c03241 | af7aef… | 2017-10-02 | no | 192.168.0.1/24 |
+--------+---------+------------+----------+----------------+
| e0cf92 | 3a436a… | 2017-10-02 | no | |
+--------+---------+------------+----------+----------------+
| 63eb9d | 74ef35… | 2017-09-28 | no | |
+--------+---------+------------+----------+----------------+
| 2daaa8 | cbad5f… | 2017-09-26 | no | |
+--------+---------+------------+----------+----------------+
| 68c2fe | 127e51… | 2017-09-23 | no | |
+--------+---------+------------+----------+----------------+
| 6334e1 | 1dadd1… | 2017-09-23 | no | |
+--------+---------+------------+----------+----------------+
```
Read only token npm_1f… with id 7f3134 created 2017-10-21
Publish token npm_af… with id c03241 created 2017-10-02
with IP Whitelist: 192.168.0.1/24
Publish token npm_… with id e0cf92 created 2017-10-02
```

- `npm token create [--read-only] [--cidr=<cidr-ranges>]`: Create a new authentication token. It can be `--read-only`, or accept a list of [CIDR](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) ranges with which to limit use of this token. This will prompt you for your password, and, if you have two-factor authentication enabled, an otp.

Currently, the cli can not generate automation tokens. Please refer to the [docs website](https://docs.npmjs.com/creating-and-viewing-access-tokens) for more information on generating automation tokens.

```bash
+----------------+--------------------------------------+
| token | a73c9572-f1b9-8983-983d-ba3ac3cc913d |
+----------------+--------------------------------------+
| cidr_whitelist | |
+----------------+--------------------------------------+
| readonly | false |
+----------------+--------------------------------------+
| created | 2017-10-02T07:52:24.838Z |
+----------------+--------------------------------------+
```
Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d
```

- `npm token revoke <token|id>`: Immediately removes an authentication token from the registry. You will no longer be able to use it. This can accept both complete tokens (such as those you get back from `npm token create`, and those found in your `.npmrc`), and ids as seen in the parseable or json output of `npm token list`. This will NOT accept the truncated token found in the normal `npm token list` output.
Expand Down
2 changes: 1 addition & 1 deletion content/cli/v10/commands/npm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Note: This command is unaware of workspaces.

### Version

10.5.2
10.6.0

### Description

Expand Down
2 changes: 2 additions & 0 deletions content/cli/v10/configuring-npm/package-json.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,8 @@ If you need to make specific changes to dependencies of your dependencies, for e

Overrides provide a way to replace a package in your dependency tree with another version, or another package entirely. These changes can be scoped as specific or as vague as desired.

Overrides are only considered in the root `package.json` file for a project. Overrides in installed dependencies (including [workspaces](/cli/v10/using-npm/workspaces)) are not considered in dependency tree resolution. Published packages may dictate their resolutions by pinning dependencies or using an [`npm-shrinkwrap.json`](/cli/v10/configuring-npm/npm-shrinkwrap-json) file.

To make sure the package `foo` is always installed as version `1.0.0` no matter what version your dependencies rely on:

```json
Expand Down
2 changes: 2 additions & 0 deletions content/cli/v10/configuring-npm/package-lock-json.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ This file is intended to be committed into source repositories, and serves vario

- As of npm v7, lockfiles include enough information to gain a complete picture of the package tree, reducing the need to read `package.json` files, and allowing for significant performance improvements.

When `npm` creates or updates `package-lock.json`, it will infer line endings and indentation from `package.json` so that the formatting of both files matches.

### `package-lock.json` vs `npm-shrinkwrap.json`

Both of these files have the same format, and perform similar functions in the root of a project.
Expand Down
Loading

0 comments on commit 834f1d7

Please sign in to comment.