Skip to content

Commit

Permalink
docs: postinstall runs for any change
Browse files Browse the repository at this point in the history
  • Loading branch information
mrienstra authored Sep 12, 2021
1 parent 6360d15 commit 3f84eb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gatsby/content/advanced/lifecycle-scripts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Packages can define in the `scripts` field of their manifest various actions tha

- **prepublish** is called before `yarn npm publish` and similar commands (even before the package has been packed). This is the place where you'll want to check that the project is in an ok state. Because it's only called on prepublish, **the prepublish hook shouldn't have side effects.** In particular don't transpile the package sources in prepublish, as people consuming directly your repository (such as through the [`git:` protocol](/features/protocols#git)) wouldn't be able to use your project.

- **postinstall** is called after a package got successfully installed on the disk. It is guaranteed to be called in topological order (in other words, your dependencies' postinstalls will always run before yours). For backwards compatibility, **preinstall** and **install** are called as part of **postinstall**.
- **postinstall** is called whenever the dependency tree of your workspace changes -- e.g. when any package is added, removed or changed. It is guaranteed to be called in topological order (in other words, your dependencies' postinstalls will always run before yours). For backwards compatibility, **preinstall** and **install** are called as part of **postinstall**.

Note that we don't support every single lifecycle script originally present in npm. This is a deliberate decision based on the observation that too many lifecycle scripts make it difficult to know which one to use in which circumstances, leading to confusion and mistakes. We are open to add the missing ones on a case-by-case basis if compelling use cases are provided.

Expand Down

0 comments on commit 3f84eb3

Please sign in to comment.