15、使用标签
最后更新于:2022-04-02 01:02:53
Tags are a supplement to semver (e.g., v0.12) for organizing and labeling different versions of packages. In addition to being more human-readable, tags allow publishers to distribute their packages more effectively.
添加标签(tag)
To add a tag to a specific version of your package, use npm dist-tag add
使用标签(tag)发布
By default, npm publish will tag your package with the latest tag. If you use the --tag flag, you can specify another tag to use. For example, the following will publish your package with the beta tag:
npm publish --tag beta
使用标签(tag)安装
Like npm publish, npm install
npm install somepkg@beta
Caveats
Because dist-tags share the same namespace with semver, avoid using any tag names that may cause a conflict. The best practice is to avoid using tags beginning with a number or the letter "v".