https://github.com/privatenumber/prerelease-checks
Run essential pre-release checks before releasing an npm package
https://github.com/privatenumber/prerelease-checks
checks cli github npm pre-release prerelease publish standard-version validate verify
Last synced: 8 months ago
JSON representation
Run essential pre-release checks before releasing an npm package
- Host: GitHub
- URL: https://github.com/privatenumber/prerelease-checks
- Owner: privatenumber
- License: mit
- Created: 2021-03-31T04:16:36.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2021-04-26T01:13:39.000Z (over 4 years ago)
- Last Synced: 2025-03-18T12:15:48.652Z (8 months ago)
- Topics: checks, cli, github, npm, pre-release, prerelease, publish, standard-version, validate, verify
- Language: TypeScript
- Homepage:
- Size: 1.22 MB
- Stars: 12
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Run essential pre-release checks before releasing an npm package.
💞 Works well with [standard-version](https://github.com/conventional-changelog/standard-version)!
If you like this project, please star it & [follow me](https://github.com/privatenumber) to see what other cool projects I'm working on! ❤️
## 🙋♂️ Why?
Because there are many points of failure when making a release.
This CLI runs a thorough check to guarantee a successful package release:
#### ✅ npm
- [x] Assert npm version
- [x] Validate `package.json`
- [x] Check valid npm name
- [x] Check valid semver version
- [x] Verify public package
- [x] Verify npm registry is reachable (in case custom)
- [x] Verify npm publish registry is reachable
- [x] Verify user is authenticated to publish registry and has permissions
#### ✅ Git
- [x] Assert Git version
- [x] Verify working directory is clean
- [x] Verify current branch is release branch
- [x] Verify remote head exists
- [x] Verify current branch is identical to upstream
## 🚀 Install
```sh
npm i -D prerelease-checks
```
### npx
You can also install-and-run as you need it via npx:
```sh
npx prerelease-checks
```
## 🚦 Quick Setup
### As a prepublish hook
Add `prerelease-checks` as a [`prepublishOnly` hook](https://docs.npmjs.com/cli/v7/using-npm/scripts#life-cycle-scripts) in your `package.json`:
```diff
{
"scripts": {
+ "prepublishOnly": "prerelease-checks"
}
}
```
### With standard-version
If you're using [standard-version](https://github.com/conventional-changelog/standard-version), add it to their `prerelease` hook.
```diff
{
"scripts": {
+ "prerelease": "prerelease-checks",
"release": "standard-version"
}
}
```
### Other
You can prepend your release script with `prerelease-checks`.
```diff
{
"scripts": {
+ "release": "prerelease-checks && my-custom-release-command",
}
}
```
## 🙏 Credits
Many inspirations taken from the prerequisite checks from [np](https://github.com/sindresorhus/np/).