How to properly release pre-release version so that it does not get installed unless explicitly mentioned

(Ajay Narain Mathur) #1

How to release a pre-release version of the package in a manner that it does not get installed when devs just to npm install <packageName>.

What I have tried on the package tooltip-101

Created a pre-release version

$> npm version prerelease


$> npm publish

Install in a npm project

$> npm install <packageName>

It installs the prelrease version:
"tooltip-101": "^13.0.4-2"

Behaviour expected:

The prerelease version of the package should not be installed unless explicitly mentioned as npm install tooltip-101@^13.0.4-2

(John Gee) #2

By default when you publish, it is tagged as latest. By default when you install, you get latest. So to keep a prerelease from being installed by default you just need to specify a different tag when you publish. e.g.

npm publish --tag next .

I wrote a comment recently with relevant quotes and links: should display latest GA version if current version is a prerelease