Skip to content

prepack > prepublish* #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion secure-releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Please use a secure password manager to store, and generate, your secure passwor

### Preparing for Publish

It can be easy to forget to run steps before publishing. If you have any build steps (transpiling with Babel or TypeScript, emitting types with TypeScript, etc) and/or validation steps (running tests, etc), make sure they're set up in the `scripts` section of `package.json` such that `npm run prepublish` or `npm run prepublishOnly` would invoke them - that way, running `npm publish` in the future will automatically run these steps.
It can be easy to forget to run steps before publishing. If you have any build steps (transpiling with Babel or TypeScript, emitting types with TypeScript, etc) and/or validation steps (running tests, etc), make sure they're set up in the `scripts` section of `package.json` such that `npm run prepublish` or `npm run prepublishOnly` would invoke them - that way, running `npm publish` in the future will automatically run these steps. You may instead wish to run build steps in `prepack`, so that build output is included with `npm pack` as well (instead of only with `npm publish`).

Publishing to npm can be done in one step (`npm publish`), or two (`npm pack` to generate a tarball, and then later, `npm publish path/to/tarball` to publish). Even if you publish separately with one step, it's a good idea to run `npm pack` in CI to ensure that the steps succeed, and that the tarball is somewhat reproducible. (Example: [this workflow](https://github.com/ljharb/actions/blob/5a85b6e4de8738a6c7a87a45ebc9711f2d9a7226/.github/workflows/pretest.yml#L64-L67), which you can see the latest runs of [here](https://github.com/ljharb/qs/actions/workflows/node-pretest.yml?query=branch%3Amain))

Expand Down