Skip to content

Commit 2aa2821

Browse files
committed
CLI documentation update from CI
1 parent cd62d4a commit 2aa2821

File tree

7 files changed

+38
-7
lines changed

7 files changed

+38
-7
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": "e510f14bf6a20d67e7b37c3f25ff271d9f7a0da5",
5-
"v11": "8f6eb6b29904b5a807c5c4c01c1246afc70a77f1"
5+
"v11": "5d7a7a8695135812d55f42ab03513c705d7fd785"
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.4.0 /path/to/npm
55+
npm@11.4.1 /path/to/npm
5656
└─┬ init-package-json@0.0.4
5757
└── promzard@0.1.5
5858
```

content/cli/v11/commands/npm.mdx

Lines changed: 1 addition & 1 deletion
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.4.0
34+
11.4.1
3535

3636
### Description
3737

content/cli/v11/using-npm/changelog.mdx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,25 @@ redirect_from:
1515
- /using-npm/changelog
1616
---
1717

18+
## [11.4.1](https://github.com/npm/cli/compare/v11.4.0...v11.4.1) (2025-05-21)
19+
20+
### Documentation
21+
22+
- [`3ed764a`](https://github.com/npm/cli/commit/3ed764aa08f2087fa1d1bd7391a646ba47565294) [#8308](https://github.com/npm/cli/pull/8308) Clarify script working directory behavior (fixes #8305) (#8308) (@tarekwfa0110, @owlstronaut)
23+
24+
### Chores
25+
26+
- [`2f30251`](https://github.com/npm/cli/commit/2f302516401928239593dd2eebc171729df60537) [#8314](https://github.com/npm/cli/pull/8314) remove references to skimdb.npmjs.com (#8314) (@shmam)
27+
- [`9cb9d50`](https://github.com/npm/cli/commit/9cb9d5030b1fdb83e3ffa45b7c8d2de80a657768) [#8298](https://github.com/npm/cli/pull/8298) add contributor to changelog entry (#8298) (@wraithgar)
28+
29+
### Dependencies
30+
31+
- [workspace](https://github.com/npm/cli/releases/tag/arborist-v9.1.1): `@npmcli/arborist@9.1.1`
32+
- [workspace](https://github.com/npm/cli/releases/tag/libnpmdiff-v8.0.4): `libnpmdiff@8.0.4`
33+
- [workspace](https://github.com/npm/cli/releases/tag/libnpmexec-v10.1.3): `libnpmexec@10.1.3`
34+
- [workspace](https://github.com/npm/cli/releases/tag/libnpmfund-v7.0.4): `libnpmfund@7.0.4`
35+
- [workspace](https://github.com/npm/cli/releases/tag/libnpmpack-v9.0.4): `libnpmpack@9.0.4`
36+
1837
## [11.4.0](https://github.com/npm/cli/compare/v11.3.0...v11.4.0) (2025-05-15)
1938

2039
### Features

content/cli/v11/using-npm/registry.mdx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ You can configure npm to use any compatible registry you like, and even run your
2727

2828
npm's package registry implementation supports several write APIs as well, to allow for publishing packages and managing user account information.
2929

30-
The npm public registry is powered by a CouchDB database, of which there is a public mirror at [https://skimdb.npmjs.com/registry](https://skimdb.npmjs.com/registry).
31-
3230
The registry URL used is determined by the scope of the package (see [`scope`](/cli/v11/using-npm/scope). If no scope is specified, the default registry is used, which is supplied by the [`registry` config](/cli/v11/using-npm/config#registry) parameter. See [`npm config`](/cli/v11/commands/npm-config), [`npmrc`](/cli/v11/configuring-npm/npmrc), and [`config`](/cli/v11/using-npm/config) for more on managing npm's configuration. Authentication configuration such as auth tokens and certificates are configured specifically scoped to an individual registry. See [Auth Related Configuration](/cli/v11/configuring-npm/npmrc#auth-related-configuration)
3331

3432
When the default registry is used in a package-lock or shrinkwrap it has the special meaning of "the currently configured registry". If you create a lock file while using the default registry you can switch to another registry and npm will install packages from the new registry, but if you create a lock file while using a custom registry packages will be installed from that registry even after you change to another registry.

content/cli/v11/using-npm/scripts.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,21 @@ Reasons for a package removal include:
218218

219219
Due to the lack of necessary context, `uninstall` lifecycle scripts are not implemented and will not function.
220220

221+
### Working Directory for Scripts
222+
223+
Scripts are always run from the root of the package folder, regardless of what the current working directory is when `npm` is invoked. This means your scripts can reliably assume they are running in the package root.
224+
225+
If you want your script to behave differently based on the directory you were in when you ran `npm`, you can use the `INIT_CWD` environment variable, which holds the full path you were in when you ran `npm run`.
226+
227+
#### Historical Behavior in Older npm Versions
228+
229+
For npm v6 and earlier, scripts were generally run from the root of the package, but there were rare cases and bugs in older versions where this was not guaranteed. If your package must support very old npm versions, you may wish to add a safeguard in your scripts (for example, by checking process.cwd()).
230+
231+
For more details, see:
232+
233+
- [npm v7 release notes](https://github.com/npm/cli/releases/tag/v7.0.0)
234+
- [Discussion about script working directory reliability in npm v6 and earlier](https://github.com/npm/npm/issues/12356)
235+
221236
### User
222237

223238
When npm is run as root, scripts are always run with the effective uid and gid of the working directory owner.
@@ -302,7 +317,6 @@ Note that these script files don't have to be Node.js or even JavaScript program
302317
- Inspect the env to determine where to put things. For instance, if the `npm_config_binroot` environment variable is set to `/home/user/bin`, then don't try to install executables into `/usr/local/bin`. The user probably set it up that way for a reason.
303318
- Don't prefix your script commands with "sudo". If root permissions are required for some reason, then it'll fail with that error, and the user will sudo the npm command in question.
304319
- Don't use `install`. Use a `.gyp` file for compilation, and `prepare` for anything else. You should almost never have to explicitly set a preinstall or install script. If you are doing this, please consider if there is another option. The only valid use of `install` or `preinstall` scripts is for compilation which must be done on the target architecture.
305-
- Scripts are run from the root of the package folder, regardless of what the current working directory is when `npm` is invoked. If you want your script to use different behavior based on what subdirectory you're in, you can use the `INIT_CWD` environment variable, which holds the full path you were in when you ran `npm run`.
306320

307321
### See Also
308322

content/nav.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,7 @@
15941594
- title: Changelog
15951595
url: /cli/v10/using-npm/changelog
15961596
description: Changelog notes for each version
1597-
- title: Version 11.4.0
1597+
- title: Version 11.4.1
15981598
shortName: v11
15991599
url: /cli/v11
16001600
default: true

0 commit comments

Comments
 (0)