DEV Community

Visaka Devi
Visaka Devi

Posted on

publish a prerelease version of git your package

This guide outlines the steps to prepare, create, and publish a prerelease version of your package.

1. Preparing for Prerelease

Ensure all changes are committed before creating a prerelease version.

git add .
git commit -m "chore: prepare for new prerelease version"
Enter fullscreen mode Exit fullscreen mode

2. Creating the Prerelease Version

Use npm version to create a prerelease version with a specified identifier:

npm version prerelease --preid=your-feature-name
Enter fullscreen mode Exit fullscreen mode

This command will:

  • Increment the patch version.
  • Add the prerelease identifier (your-feature-name).
  • Create a new git commit with the updated version.
  • Create a new git tag for the version.
  • Update the package.json file with the new version.

3. Building the Project

Before publishing, ensure the project is built properly:

npm run build
Enter fullscreen mode Exit fullscreen mode

4. Publishing the Prerelease Version

Publish the prerelease version to npm with a specific tag:

npm publish --tag your-feature-name
Enter fullscreen mode Exit fullscreen mode

This ensures:

  • The package is published with the specified prerelease tag.
  • Users can install the prerelease version without affecting the latest stable release.

5. Installing a Prerelease Version

To install the prerelease version of the package, use:

npm install your-package-name@your-feature-name
Enter fullscreen mode Exit fullscreen mode

This allows testing of the prerelease version before merging it into the stable release.

Top comments (0)