Skip to content

Commit

Permalink
nlf/docs updates (#4961)
Browse files Browse the repository at this point in the history
* docs: add `npm version` notes to scripts doc

* docs: clarify when git deps will be cloned and installed before packing
  • Loading branch information
nlf committed Jun 1, 2022
1 parent 7bd12d5 commit 825e595
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/content/configuring-npm/package-json.md
Expand Up @@ -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":
Expand Down
6 changes: 6 additions & 0 deletions docs/content/using-npm/scripts.md
Expand Up @@ -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.
Expand Down

0 comments on commit 825e595

Please sign in to comment.