prerelease-checks

Run essential pre-release checks before releasing an npm package

Usage no npm install needed!

<script type="module">
  import prereleaseChecks from 'https://cdn.skypack.dev/prerelease-checks';
</script>

README

prerelease-checks

Run essential pre-release checks before releasing an npm package.

💞 Works well with standard-version!

If you like this project, please star it & follow me 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

  • ✅ Assert npm version
  • ✅ Validate package.json
    • ✅ Check valid npm name
    • ✅ Check valid semver version
    • ✅ Verify public package
  • ✅ Verify npm registry is reachable (in case custom)
  • ✅ Verify npm publish registry is reachable
  • ✅ Verify user is authenticated to publish registry and has permissions

Git

  • ✅ Assert Git version
  • ✅ Verify working directory is clean
  • ✅ Verify current branch is release branch
  • ✅ Verify remote head exists
  • ✅ Verify current branch is identical to upstream

🚀 Install

npm i -D prerelease-checks

npx

You can also install-and-run as you need it via npx:

npx prerelease-checks

🚦 Quick Setup

As a prepublish hook

Add prerelease-checks as a prepublishOnly hook in your package.json:

 {
   "scripts": {
+    "prepublishOnly": "prerelease-checks"
   }
 }

With standard-version

If you're using standard-version, add it to their prerelease hook.

 {
   "scripts": {
+    "prerelease": "prerelease-checks",
     "release": "standard-version"
   }
 }

Other

You can prepend your release script with prerelease-checks.

 {
   "scripts": {
+    "release": "prerelease-checks && my-custom-release-command",
   }
 }

🙏 Credits

Many inspirations taken from the prerequisite checks from np.