From dc03f78136d52260ffb3368ea3861d5eba3368d1 Mon Sep 17 00:00:00 2001 From: Robert Lowe Date: Thu, 27 Aug 2020 10:54:59 -0400 Subject: [PATCH] Add mention of `prepare` Add mention of `prepare` --- packages/gatsby/content/advanced/lifecycle-scripts.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/gatsby/content/advanced/lifecycle-scripts.md b/packages/gatsby/content/advanced/lifecycle-scripts.md index 09b11a8da2c8..acd732129025 100644 --- a/packages/gatsby/content/advanced/lifecycle-scripts.md +++ b/packages/gatsby/content/advanced/lifecycle-scripts.md @@ -16,6 +16,8 @@ Packages can define in the `scripts` field of their manifest various actions tha - **postinstall** is called after a package got successfully installed on the disk. It is guaranteed. +- **prepare** is called both before a package is packed and published, on local `yarn install` without any arguments, and when installing git dependencies. This is run after prepublish. + 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. > In particular, we intentionally don't support arbitrary `pre` and `post` hooks for user-defined scripts (such as `prestart`). This behavior, inherited from npm, caused scripts to be implicit rather than explicit, obfuscating the execution flow. It also led to surprising executions with `yarn serve` also running `yarn preserve`.