当你对已发布的包进行重大更改时,我们建议你更新版本号,以便将更改的范围传达给依赖你的代码的其他人。

🌐 When you make significant changes to a published package, we recommend updating the version number to communicate the extent of the changes to others who rely on your code.

注意: 如果你已经将 git 仓库链接到一个软件包,更新软件包版本号也会在已链接的 git 仓库中添加一个包含更新发布号的标签。

  1. 要在 package.json 中更改版本号,请在命令行的包根目录下运行以下命令,将 <update_type> 替换为 语义化版本 版本类型之一(补丁、主版本或次版本):

    npm version <update_type>
  2. 运行 npm publish

  3. 前往你的软件包页面(https://npmjs.com/package/<package>)以检查软件包版本是否已更新。

有关 npm version 的更多信息,请参见 命令行接口文档

🌐 For more information on npm version, see the CLI documentation.