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

¥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 存储库。

¥Note: If you have linked a git repository to a package, updating the package version number will also add a tag with the updated release number to the linked git repository.

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

    ¥To change the version number in package.json, on the command line, in the package root directory, run the following command, replacing <update_type> with one of the semantic versioning release types (patch, major, or minor):

    npm version <update_type>
  2. 运行 npm publish

    ¥Run npm publish.

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

    ¥Go to your package page (https://npmjs.com/package/<package>) to check that the package version has been updated.

有关 npm version 的更多信息,请参阅 CLI 文档

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

npm 中文网 - 粤ICP备13048890号