Skip to content

Commit

Permalink
docs: postinstall runs for any change (#3428)
Browse files Browse the repository at this point in the history
* docs: postinstall runs for any change

As per yarnpkg/yarn#8498 (comment)

* Wording tweak

* Update lifecycle-scripts.md

Co-authored-by: Maël Nison <nison.mael@gmail.com>
  • Loading branch information
mrienstra and arcanis authored Sep 16, 2021
1 parent ff7c3e4 commit f2eb00d
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 after a package's dependency tree changes are written to the disk -- e.g. after a dependency or transitive dependency 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 f2eb00d

Please sign in to comment.