np
A better `npm publish`
Ensures you are publishing from your release branch (main and master by default). Ensures the working directory is clean and that there are no unpulled changes. Reinstalls dependencies to ensure your project works with the latest dependency tree. Ensures your Node.js and npm versions are supported by the project and its dependencies. Bumps the version in package.json and npm-shrinkwrap.json (if present) and creates a git tag. Prevents accidental publishing of pre-release versions under the latest dist-tag. Publishes the new version to npm, optionally under a dist-tag. Rolls back the project to its previous state in case publishing fails. Pushes commits and tags (newly & previously created) to GitHub/GitLab. Enables two-factor authentication on new repositories. Opens a prefilled GitHub Releases draft after publish. See exactly what will be executed with preview mode, without pushing or publishing anything remotely.