Allow Publish Tag
Allow publish tag prevents your NPM package from being accidentally
latest tag for alpha, beta, etc versions. Use it with
prepublishOnly hook in your package file.
How it works?
- Script searches release flag in the version of the publishing package.
- If there is no release flag, script exits with code 0. If not, script continues execution.
- Script watches if there is the tag provided with
npm publishcommand, which is in allowed list. If tag is not in the list script exists with code 1 what interrupts publishing process.
npm i allow-publish-tag
- Specify allowed tag list as cli arguments:
allow-publish-tag [..TAGS]or into
npm publish --tag nextwhen you're ready to publish your package.
// package.json"version" : "1.0.0-alpha.1""scripts":"prepublishOnly": "allow-publish-tag""allowPublishTags":"next": "beta" "alpha" "rc"