博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
npm 语义化发布_使用npm的语义版本控制
阅读量:2504 次
发布时间:2019-05-11

本文共 2810 字,大约阅读时间需要 9 分钟。

npm 语义化发布

If there’s one great thing in Node.js packages, is that all agreed on using Semantic Versioning for their version numbering.

如果Node.js软件包中有一件很棒的事情,那就是所有人都同意使用语义版本控制来为其版本编号。

The Semantic Versioning concept is simple: all versions have 3 digits: x.y.z.

语义版本控制的概念很简单:所有版本都有3位数字: xyz

  • the first digit is the major version

    第一位是主要版本
  • the second digit is the minor version

    第二个数字是次要版本
  • the third digit is the patch version

    第三位数是补丁版本

When you make a new release, you don’t just up a number as you please, but you have rules:

发布新版本时,您不仅可以随心所欲地增加数字,还可以遵循以下规则:

  • you up the major version when you make incompatible API changes

    当您进行不兼容的API更改时,您可以升级到主要版本
  • you up the minor version when you add functionality in a backward-compatible manner

    当您以向后兼容的方式添加功能时,您可以升级次要版本
  • you up the patch version when you make backward-compatible bug fixes

    进行向后兼容的错误修复时,您可以升级补丁程序版本

The convention is adopted all across programming languages, and it is very important that every npm package adheres to it, because the whole system depends on that.

该约定在所有编程语言中npm ,每个npm软件包都必须遵守该约定,因为整个系统都依赖npm ,这一点非常重要。

Why is that so important?

为什么这么重要?

Because npm set some rules we can use in the to choose which versions it can update our packages to, when we run npm update.

因为npm设置了一些规则,所以当我们运行npm update时,可以在使用它来选择将软件包更新到的npm update

The rules use those symbols:

规则使用这些符号:

  • ^

    ^

  • ~

    ~

  • >

    >

  • >=

    >=

  • <

    <

  • <=

    <=

  • =

    =

  • -

    -

  • ||

    ||

Let’s see those rules in detail:

让我们详细了解这些规则:

  • ^: if you write ^0.13.0 when running npm update it can update to patch and minor releases: 0.13.1, 0.14.0 and so on.

    ^ :如果你写^0.13.0运行时, npm update :它可以更新打补丁和次要版本0.13.10.14.0等等。

  • ~: if you write ~0.13.0, when running npm update it can update to patch releases: 0.13.1 is ok, but 0.14.0 is not.

    ~ :如果编写~0.13.0 ,则在运行npm update时可以更新到补丁程序版本: 0.13.1可以,但0.14.0不能。

  • >: you accept any version higher than the one you specify

    > :您接受比您指定的版本更高的任何版本

  • >=: you accept any version equal to or higher than the one you specify

    >= :您接受等于或高于您指定的版本的任何版本

  • <=: you accept any version equal or lower to the one you specify

    <= :您接受等于或低于您指定的版本的任何版本

  • <: you accept any version lower to the one you specify

    < :您接受低于指定版本的任何版本

  • =: you accept that exact version

    = :您接受该确切版本

  • -: you accept a range of versions. Example: 2.1.0 - 2.6.2

    - :您接受各种版本。 例如: 2.1.0 - 2.6.2

  • ||: you combine sets. Example: < 2.1 || > 2.6

    || :您组合套。 示例: < 2.1 || > 2.6 < 2.1 || > 2.6

You can combine some of those notations, for example use 1.0.0 || >=1.1.0 <1.2.0 to either use 1.0.0 or one release from 1.1.0 up, but lower than 1.2.0.

您可以合并其中的一些符号,例如,使用1.0.0 || >=1.1.0 <1.2.0 1.0.0 || >=1.1.0 <1.2.0 ,以使用1.0.0或从1.1.0起的一个发行版,但低于1.2.0。

There are other rules, too:

还有其他规则:

  • no symbol: you accept only that specific version you specify (1.2.1)

    无符号:您仅接受指定的特定版本( 1.2.1 )

  • latest: you want to use the latest version available

    latest :您想使用可用的最新版本

翻译自:

npm 语义化发布

转载地址:http://xmqgb.baihongyu.com/

你可能感兴趣的文章
Navicat远程连接云主机数据库
查看>>
Nginx配置文件nginx.conf中文详解(总结)
查看>>
Mysql出现Table 'performance_schema.session_status' doesn't exist
查看>>
MySQL innert join、left join、right join等理解
查看>>
sdc时序约束
查看>>
NoC片上网络
查看>>
开源SoC整理
查看>>
【2020-3-21】Mac安装Homebrew慢,解决办法
查看>>
influxdb 命令行输出时间为 yyyy-MM-dd HH:mm:ss(年月日时分秒)的方法
查看>>
已知子网掩码,确定ip地址范围
查看>>
判断时间或者数字是否连续
查看>>
docker-daemon.json各配置详解
查看>>
Docker(一)使用阿里云容器镜像服务
查看>>
Docker(三) 构建镜像
查看>>
FFmpeg 新旧版本编码 API 的区别
查看>>
RecyclerView 源码深入解析——绘制流程、缓存机制、动画等
查看>>
Android 面试题整理总结(一)Java 基础
查看>>
Android 面试题整理总结(二)Java 集合
查看>>
学习笔记_vnpy实战培训day02
查看>>
学习笔记_vnpy实战培训day03
查看>>