Skip to content

Commit

Permalink
docs: fix typo in rulebook (#2932)
Browse files Browse the repository at this point in the history
Fix typo.
  • Loading branch information
ianwhitedeveloper authored May 26, 2021
1 parent a347ca4 commit 50a7a1e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/gatsby/content/advanced/rulebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ If you absolutely need to write into your package's source folder (but really, w

## Packages should use the `prepack` script to generate dist files before publishing

**Why?** The original npm supported [many different scripts](https://docs.npmjs.com/misc/scripts). So much, in fact, that it became very difficult to know which script one would want to use in which context. In particular, the very subtle differences between the `prepack`, `prepare`, `prepublish`, and `prepublish-only` scripts led many to use the wrong script in the wrong context. For this reason, Yarn 2 deprecated most of the scripts and consolidated then around a restricted set of portable scripts.
**Why?** The original npm supported [many different scripts](https://docs.npmjs.com/misc/scripts). So much, in fact, that it became very difficult to know which script one would want to use in which context. In particular, the very subtle differences between the `prepack`, `prepare`, `prepublish`, and `prepublish-only` scripts led many to use the wrong script in the wrong context. For this reason, Yarn 2 deprecated most of the scripts and consolidated them around a restricted set of portable scripts.

**Solution:** Always use the `prepack` script if you wish to generate dist artifacts before publishing your package. It will get called before calling `yarn pack` (which itself is called before calling `yarn npm publish`), when cloning your git repository as a git dependency, and any time you will run `yarn prepack`. As for `prepublish`, never use it with side effects - its only use should be to run tests before the publish step.

0 comments on commit 50a7a1e

Please sign in to comment.