Skip to content

Commit fc2ee98

Browse files
committed
CLI documentation update from CI
1 parent 66f0e7f commit fc2ee98

File tree

14 files changed

+359
-14
lines changed

14 files changed

+359
-14
lines changed

cli-cache.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"v8": "aa8fff11cdab94fff1a2160ee5241f5f4632e96b",
33
"v9": "64763a341e7aa5b456e696f956759bf9b3440dc1",
44
"v10": "6755ca2d5301b079f9e2581fc72ba2a612171364",
5-
"v11": "3439a89d58a25deac08650da53157595e8b8edfb"
5+
"v11": "52714855e62a196fb853872f5106803605ab0ec4"
66
}

content/cli/v11/commands/npm-ls.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Note: to get a "bottoms up" view of why a given package is included in the tree
5252
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:
5353

5454
```bash
55-
npm@11.6.2 /path/to/npm
55+
npm@11.6.4 /path/to/npm
5656
└─┬ init-package-json@0.0.4
5757
└── promzard@0.1.5
5858
```

content/cli/v11/commands/npm-publish.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,32 @@ npm publish <package-spec>
4545

4646
Publishes a package to the registry so that it can be installed by name.
4747

48+
### Examples
49+
50+
Publish the package in the current directory:
51+
52+
```bash
53+
npm publish
54+
```
55+
56+
Publish a specific workspace:
57+
58+
```bash
59+
npm publish --workspace=<workspace-name>
60+
```
61+
62+
Publish multiple workspaces:
63+
64+
```bash
65+
npm publish --workspace=workspace-a --workspace=workspace-b
66+
```
67+
68+
Publish all workspaces:
69+
70+
```bash
71+
npm publish --workspaces
72+
```
73+
4874
By default npm will publish to the public registry. This can be overridden by specifying a different default registry or using a [`scope`](/cli/v11/using-npm/scope) in the name, combined with a scope-configured registry (see [`package.json`](/cli/v11/configuring-npm/package-json)).
4975

5076
A `package` is interpreted the same way as other commands (like `npm install`) and can be:

content/cli/v11/commands/npm-token.mdx

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ redirect_from:
4040
```bash
4141
npm token list
4242
npm token revoke <id|token>
43-
npm token create [--read-only] [--cidr=list]
43+
npm token create --name=<name> [--token-description=<desc>] [--packages=<pkg1,pkg2>] [--packages-all] [--scopes=<scope1,scope2>] [--orgs=<org1,org2>] [--packages-and-scopes-permission=<read-only|read-write|no-access>] [--orgs-permission=<read-only|read-write|no-access>] [--expires=<days>] [--cidr=<ip-range>] [--bypass-2fa] [--password=<pass>]
4444
```
4545

4646
Note: This command is unaware of workspaces.
@@ -73,12 +73,68 @@ Created publish token a73c9572-f1b9-8983-983d-ba3ac3cc913d
7373

7474
### Configuration
7575

76-
#### `read-only`
76+
#### `name`
77+
78+
- Default: null
79+
- Type: null or String
80+
81+
When creating a Granular Access Token with `npm token create`, this sets the name/description for the token.
82+
83+
#### `token-description`
84+
85+
- Default: null
86+
- Type: null or String
87+
88+
Description text for the token when using `npm token create`.
89+
90+
#### `expires`
91+
92+
- Default: null
93+
- Type: null or Number
94+
95+
When creating a Granular Access Token with `npm token create`, this sets the expiration in days. If not specified, the server will determine the default expiration.
96+
97+
#### `packages`
98+
99+
- Default:
100+
- Type: null or String (can be set multiple times)
101+
102+
When creating a Granular Access Token with `npm token create`, this limits the token access to specific packages. Provide a comma-separated list of package names.
103+
104+
#### `packages-all`
77105

78106
- Default: false
79107
- Type: Boolean
80108

81-
This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command.
109+
When creating a Granular Access Token with `npm token create`, grants the token access to all packages instead of limiting to specific packages.
110+
111+
#### `scopes`
112+
113+
- Default: null
114+
- Type: null or String (can be set multiple times)
115+
116+
When creating a Granular Access Token with `npm token create`, this limits the token access to specific scopes. Provide a comma-separated list of scope names (with or without @ prefix).
117+
118+
#### `orgs`
119+
120+
- Default: null
121+
- Type: null or String (can be set multiple times)
122+
123+
When creating a Granular Access Token with `npm token create`, this limits the token access to specific organizations. Provide a comma-separated list of organization names.
124+
125+
#### `packages-and-scopes-permission`
126+
127+
- Default: null
128+
- Type: null, "read-only", "read-write", or "no-access"
129+
130+
When creating a Granular Access Token with `npm token create`, sets the permission level for packages and scopes. Options are "read-only", "read-write", or "no-access".
131+
132+
#### `orgs-permission`
133+
134+
- Default: null
135+
- Type: null, "read-only", "read-write", or "no-access"
136+
137+
When creating a Granular Access Token with `npm token create`, sets the permission level for organizations. Options are "read-only", "read-write", or "no-access".
82138

83139
#### `cidr`
84140

@@ -87,6 +143,20 @@ This is used to mark a token as unable to publish when configuring limited acces
87143

88144
This is a list of CIDR address to be used when configuring limited access tokens with the `npm token create` command.
89145

146+
#### `bypass-2fa`
147+
148+
- Default: false
149+
- Type: Boolean
150+
151+
When creating a Granular Access Token with `npm token create`, setting this to true will allow the token to bypass two-factor authentication. This is useful for automation and CI/CD workflows.
152+
153+
#### `password`
154+
155+
- Default: null
156+
- Type: null or String
157+
158+
Password for authentication. Can be provided via command line when creating tokens, though it's generally safer to be prompted for it.
159+
90160
#### `registry`
91161

92162
- Default: "https://registry.npmjs.org/"
@@ -103,6 +173,13 @@ This is a one-time password from a two-factor authenticator. It's needed when pu
103173

104174
If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.
105175

176+
#### `read-only`
177+
178+
- Default: false
179+
- Type: Boolean
180+
181+
This is used to mark a token as unable to publish when configuring limited access tokens with the `npm token create` command.
182+
106183
### See Also
107184

108185
- [npm adduser](/cli/v11/commands/npm-adduser)

content/cli/v11/commands/npm-version.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,17 @@ If set to true, then the `npm version` command will tag the version using `-s` t
9393

9494
Note that git requires you to have set up GPG keys in your git configs for this to work properly.
9595

96+
#### `save`
97+
98+
- Default: `true` unless when using `npm update` where it defaults to `false`
99+
- Type: Boolean
100+
101+
Save installed packages to a `package.json` file as dependencies.
102+
103+
When used with the `npm rm` command, removes the dependency from `package.json`.
104+
105+
Will also prevent writing to `package-lock.json` if set to `false`.
106+
96107
#### `workspace`
97108

98109
- Default:
@@ -141,6 +152,15 @@ When false, specifying individual workspaces via the `workspace` config, or all
141152

142153
This value is not exported to the environment for child processes.
143154

155+
#### `ignore-scripts`
156+
157+
- Default: false
158+
- Type: Boolean
159+
160+
If true, npm does not run scripts specified in package.json files.
161+
162+
Note that commands explicitly intended to run a particular script, such as `npm start`, `npm stop`, `npm restart`, `npm test`, and `npm run` will still run their intended script if `ignore-scripts` is set, but they will _not_ run any pre- or post-scripts.
163+
144164
### Description
145165

146166
Run this in a package directory to bump the version and write the new data back to `package.json`, `package-lock.json`, and, if present, `npm-shrinkwrap.json`.

content/cli/v11/commands/npm.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Note: This command is unaware of workspaces.
3131

3232
### Version
3333

34-
11.6.2
34+
11.6.4
3535

3636
### Description
3737

@@ -70,7 +70,7 @@ See [`folders`](/cli/v11/configuring-npm/folders) to learn about where npm puts
7070
In particular, npm has two modes of operation:
7171

7272
- local mode: npm installs packages into the current project directory, which defaults to the current working directory. Packages install to `./node_modules`, and bins to `./node_modules/.bin`.
73-
- global mode: npm installs packages into the install prefix at `$npm_config_prefix/lib/node_modules` and bins to `$npm_config_prefix/bin`.
73+
- global mode: npm installs packages into the install prefix at `$NPM_CONFIG_PREFIX/lib/node_modules` and bins to `$NPM_CONFIG_PREFIX/bin`.
7474

7575
Local mode is the default. Use `-g` or `--global` on any command to run in global mode instead.
7676

@@ -89,7 +89,7 @@ If you're using npm to develop and publish your code, check out the following he
8989
npm is extremely configurable. It reads its configuration options from 5 places.
9090

9191
- Command line switches: Set a config with `--key val`. All keys take a value, even if they are booleans (the config parser doesn't know what the options are at the time of parsing). If you do not provide a value (`--key`) then the option is set to boolean `true`.
92-
- Environment Variables: Set any config by prefixing the name in an environment variable with `npm_config_`. For example, `export npm_config_key=val`.
92+
- Environment Variables: Set any config by prefixing the name in an environment variable with `NPM_CONFIG_`. For example, `export NPM_CONFIG_KEY=val`.
9393
- User Configs: The file at `$HOME/.npmrc` is an ini-formatted list of configs. If present, it is parsed. If the `userconfig` option is set in the cli or env, that file will be used instead.
9494
- Global Configs: The file found at `./etc/npmrc` (relative to the global prefix will be parsed if it is found. See [`npm prefix`](/cli/v11/commands/npm-prefix) for more info on the global prefix. If the `globalconfig` option is set in the cli, env, or user config, then that file is parsed instead.
9595
- Defaults: npm's default configuration options are defined in `lib/utils/config/definitions.js`. These must not be changed.

content/cli/v11/configuring-npm/package-json.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ Put a description in it. It's a string. This helps people discover your package,
6969

7070
Put keywords in it. It's an array of strings. This helps people discover your package as it's listed in `npm search`.
7171

72+
Example:
73+
74+
```json
75+
"keywords": [
76+
"node",
77+
"javascript",
78+
"npm"
79+
]
80+
```
81+
7282
### homepage
7383

7484
The URL to the project homepage.

content/cli/v11/configuring-npm/package-lock-json.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ Package descriptors have the following fields:
122122

123123
- bin, license, engines, dependencies, optionalDependencies: fields from `package.json`
124124

125+
- os: An array of operating systems this package is compatible with, as specified in `package.json`. This field is included when the package specifies OS restrictions.
126+
127+
- cpu: An array of CPU architectures this package is compatible with, as specified in `package.json`. This field is included when the package specifies CPU restrictions.
128+
129+
- funding: Funding information for the package, as specified in `package.json`. This field contains details about how to support the package maintainers.
130+
125131
#### dependencies
126132

127133
Legacy data for supporting versions of npm that use `lockfileVersion: 1`. This is a mapping of package names to dependency objects. Because the object structure is strictly hierarchical, symbolic link dependencies are somewhat challenging to represent in some cases.

0 commit comments

Comments
 (0)