Skip to content

Commit 825e595

Browse files
authored
nlf/docs updates (#4961)
* docs: add `npm version` notes to scripts doc * docs: clarify when git deps will be cloned and installed before packing
1 parent 7bd12d5 commit 825e595

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

docs/content/configuring-npm/package-json.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,26 @@ git+https://[email protected]/npm/cli.git
643643
git://github.com/npm/cli.git#v1.0.27
644644
```
645645

646+
When installing from a `git` repository, the presence of certain fields in the
647+
`package.json` will cause npm to believe it needs to perform a build. To do so
648+
your repository will be cloned into a temporary directory, all of its deps
649+
installed, relevant scripts run, and the resulting directory packed and
650+
installed.
651+
652+
This flow will occur if your git dependency uses `workspaces`, or if any of the
653+
following scripts are present:
654+
655+
* `build`
656+
* `prepare`
657+
* `prepack`
658+
* `preinstall`
659+
* `install`
660+
* `postinstall`
661+
662+
If your git repository includes pre-built artifacts, you will likely want to
663+
make sure that none of the above scripts are defined, or your dependency
664+
will be rebuilt for every installation.
665+
646666
#### GitHub URLs
647667

648668
As of version 1.1.65, you can refer to GitHub urls as just "foo":

docs/content/using-npm/scripts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,12 @@ will default the `start` command to `node server.js`. `prestart` and
203203
* `test`
204204
* `posttest`
205205

206+
#### [`npm version`](/commands/npm-version)
207+
208+
* `preversion`
209+
* `version`
210+
* `postversion`
211+
206212
#### A Note on a lack of [`npm uninstall`](/commands/npm-uninstall) scripts
207213

208214
While npm v6 had `uninstall` lifecycle scripts, npm v7 does not. Removal of a package can happen for a wide variety of reasons, and there's no clear way to currently give the script enough context to be useful.

0 commit comments

Comments
 (0)