diff --git a/docs/content/configuring-npm/package-json.md b/docs/content/configuring-npm/package-json.md index 0c2047ad9abe0..8b188cfb0b938 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 a4fdb75e9be60..8fb9dc1a677b4 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.