Setting up the pre-release version of the npm package

NPM Registry allows developers to publish pre-release versions of the package. It is very useful for testing the package before publishing the final version.

How to publish pre-release version of the package?

** 1. Using yarn**

Yarn allows developers to publish pre-release version of the package using yarn publish --tag <tag-name> command. For example, if you want to publish the pre-release version of the package, you can use the following command.

yarn publish --tag beta

** 2. Using npm**

Using npm version command you can publish pre-release version of the package. For example, if you want to publish the pre-release version of the package, you can use the following command.

Format of the pre-release version

The format of the pre-release version is <major>.<minor>.<patch>-<prerelease-version>. For example, if you want to publish the pre-release version of the package, you can use the following command.

Removing package from the npm registry

If you want to remove the package from the npm registry, you can use the following command.

npm unpublish <package-name> --force

Conclusion

In this post, I have shown you how to publish pre-release version of the package. I hope you have enjoyed this post. If you have any questions, please feel free to ask me in the comment section below.

References