Skip to content

Commit ac56fc4

Browse files
authored
docs: document dependencies script (#5095)
1 parent e9b4214 commit ac56fc4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/content/using-npm/scripts.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ There are some special life cycle scripts that happen only in certain
3939
situations. These scripts happen in addition to the `pre<event>`, `post<event>`, and
4040
`<event>` scripts.
4141

42-
* `prepare`, `prepublish`, `prepublishOnly`, `prepack`, `postpack`
42+
* `prepare`, `prepublish`, `prepublishOnly`, `prepack`, `postpack`, `dependencies`
4343

4444
**prepare** (since `npm@4.0.0`)
4545
* Runs any time before the package is packed, i.e. during `npm publish`
@@ -71,6 +71,10 @@ situations. These scripts happen in addition to the `pre<event>`, `post<event>`,
7171
**postpack**
7272
* Runs AFTER the tarball has been generated but before it is moved to its final destination (if at all, publish does not save the tarball locally)
7373

74+
**dependencies**
75+
* Runs AFTER any operations that modify the `node_modules` directory IF changes occurred.
76+
* Does NOT run in global mode
77+
7478
#### Prepare and Prepublish
7579

7680
**Deprecation Note: prepublish**
@@ -96,6 +100,10 @@ The advantage of doing these things at `prepublish` time is that they can be don
96100
* You don't need to rely on your users having `curl` or `wget` or
97101
other system tools on the target machines.
98102

103+
#### Dependencies
104+
105+
The `dependencies` script is run any time an `npm` command causes changes to the `node_modules` directory. It is run AFTER the changes have been applied and the `package.json` and `package-lock.json` files have been updated.
106+
99107
### Life Cycle Operation Order
100108

101109
#### [`npm cache add`](/commands/npm-cache)

0 commit comments

Comments
 (0)