diff options
author | nlf <quitlahok@gmail.com> | 2022-06-02 00:12:28 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-02 00:12:28 +0300 |
commit | 825e59534644821b6eadc2b59f809b3bff6cfe61 (patch) | |
tree | d0880d8ffcf14e6fc3c6205d8b3796ac468b11d2 /docs | |
parent | 7bd12d5ee7af986acd956ea04f2b5898353cc4c6 (diff) |
nlf/docs updates (#4961)
* docs: add `npm version` notes to scripts doc
* docs: clarify when git deps will be cloned and installed before packing
Diffstat (limited to 'docs')
-rw-r--r-- | docs/content/configuring-npm/package-json.md | 20 | ||||
-rw-r--r-- | docs/content/using-npm/scripts.md | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/docs/content/configuring-npm/package-json.md b/docs/content/configuring-npm/package-json.md index 0c2047ad9..8b188cfb0 100644 --- a/docs/content/configuring-npm/package-json.md +++ b/docs/content/configuring-npm/package-json.md @@ -643,6 +643,26 @@ git+https://isaacs@github.com/npm/cli.git git://github.com/npm/cli.git#v1.0.27 ``` +When installing from a `git` repository, the presence of certain fields in the +`package.json` will cause npm to believe it needs to perform a build. To do so +your repository will be cloned into a temporary directory, all of its deps +installed, relevant scripts run, and the resulting directory packed and +installed. + +This flow will occur if your git dependency uses `workspaces`, or if any of the +following scripts are present: + +* `build` +* `prepare` +* `prepack` +* `preinstall` +* `install` +* `postinstall` + +If your git repository includes pre-built artifacts, you will likely want to +make sure that none of the above scripts are defined, or your dependency +will be rebuilt for every installation. + #### GitHub URLs As of version 1.1.65, you can refer to GitHub urls as just "foo": diff --git a/docs/content/using-npm/scripts.md b/docs/content/using-npm/scripts.md index a4fdb75e9..8fb9dc1a6 100644 --- a/docs/content/using-npm/scripts.md +++ b/docs/content/using-npm/scripts.md @@ -203,6 +203,12 @@ will default the `start` command to `node server.js`. `prestart` and * `test` * `posttest` +#### [`npm version`](/commands/npm-version) + +* `preversion` +* `version` +* `postversion` + #### A Note on a lack of [`npm uninstall`](/commands/npm-uninstall) scripts 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. |