[转] 合理使用npm version与npm dist-tag详解
第一步:发布第一个稳定版本
npm publish//1.0.0
第二步:修改文件继续发布第二个版本
git add -A && git commit -m "c"
npm version patch
npm publish//1.0.1
第三步:继续修改文件发布一个prerelease版本
git add -A && git commit -m "c"
npm version prerelease
npm publish --tag -beta//版本n-n-n-n@1.0.2-0
第四步:继续修改发布第二个prerelease版本
git add -A && git commit -m "c"
npm version prerelease
npm publish --tag beta//版本n-n-n-n@1.0.2-1
第五步:npm info查看我们的版本信息
{ name: 'n-n-n-n',
'dist-tags': { latest: '1.0.1', '-beta': '1.0.2-1' },
versions: [ '1.0.0', '1.0.1', '1.0.2-0', '1.0.2-1' ],
maintainers: [ 'liangklfang <liangklfang@163.com>' ],
time:
{ modified: '2017-04-01T12:17:56.755Z',
created: '2017-04-01T12:15:23.605Z',
'1.0.0': '2017-04-01T12:15:23.605Z',
'1.0.1': '2017-04-01T12:16:24.916Z',
'1.0.2-0': '2017-04-01T12:17:23.354Z',
'1.0.2-1': '2017-04-01T12:17:56.755Z' },
homepage: 'https://github.com/liangklfang/n#readme',
repository: { type: 'git', url: 'git+https://github.com/liangklfang/n.git' },
bugs: { url: 'https://github.com/liangklfang/n/issues' },
license: 'ISC',
readmeFilename: 'README.md',
version: '1.0.1',
description: '',
main: 'index.js',
scripts: { test: 'echo "Error: no test specified" && exit 1' },
author: '',
gitHead: '8123b8addf6fed83c4c5edead1dc2614241a4479',
dist:
{ shasum: 'a60d8b02222e4cae74e91b69b316a5b173d2ac9d',
tarball: 'https://registry.npmjs.org/n-n-n-n/-/n-n-n-n-1.0.1.tgz' },
directories: {} }
我们只要注意下面者两个部分:
'dist-tags': { latest: '1.0.1', '-beta': '1.0.2-1' },
versions: [ '1.0.0', '1.0.1', '1.0.2-0', '1.0.2-1' ],
其中最新的稳定版本和最新的beta版本可以在dist-tags中看到,而versions数组中存储的是所有的版本。
第六步:npm dist-tag命令
npm dist-tag ls n-n-n-n
即npm dist-tag获取到所有的最新的版本,包括prerelease与稳定版本,得到下面结果:
-beta: 1.0.2-1
latest: 1.0.1
第七步:当我们的prerelease版本已经稳定了,重新设置为稳定版本
npm dist-tag add n-n-n-n@1.0.2-1 latest
此时你通过npm info查看可以知道:
{ name: 'n-n-n-n',
'dist-tags': { latest: '1.0.2-1', '-beta': '1.0.2-1' },
versions: [ '1.0.0', '1.0.1', '1.0.2-0', '1.0.2-1' ],
maintainers: [ 'liangklfang <liangklfang@163.com>' ],
time:
{ modified: '2017-04-01T12:24:55.800Z',
created: '2017-04-01T12:15:23.605Z',
'1.0.0': '2017-04-01T12:15:23.605Z',
'1.0.1': '2017-04-01T12:16:24.916Z',
'1.0.2-0': '2017-04-01T12:17:23.354Z',
'1.0.2-1': '2017-04-01T12:17:56.755Z' },
homepage: 'https://github.com/liangklfang/n#readme',
repository: { type: 'git', url: 'git+https://github.com/liangklfang/n.git' },
bugs: { url: 'https://github.com/liangklfang/n/issues' },
license: 'ISC',
readmeFilename: 'README.md',
version: '1.0.2-1',
description: '',
main: 'index.js',
scripts: { test: 'echo "Error: no test specified" && exit 1' },
author: '',
gitHead: '03189d2cc61604aa05f4b93e429d3caa3b637f8c',
dist:
{ shasum: '41ea170a6b155c8d61658cd4c309f0d5d1b12ced',
tarball: 'https://registry.npmjs.org/n-n-n-n/-/n-n-n-n-1.0.2-1.tgz' },
directories: {} }
主要关注如下:
'dist-tags': { latest: '1.0.2-1', '-beta': '1.0.2-1' },
versions: [ '1.0.0', '1.0.1', '1.0.2-0', '1.0.2-1' ]
此时latest版本已经是prerelease版本”1.0.2-1”了!此时用户如果直接运行npm install就会安装我们的prerelease版本了,因为版本已经更新了!
参考资料:
[转] 合理使用npm version与npm dist-tag详解的更多相关文章
- angular2 学习笔记 ( angular cli & npm version manage npm 版本管理 )
更新 : 2017-05-05 现在流行 Yarn ! 它是 facebook google 推出的东西. 算是补助 npm 做的不够好的地方. 源码依然是发布去 npm,只是下载接口换掉罢了哦. n ...
- docker tag 详解
docker tag 用于给镜像打标签,语法如下: docker tag SOURCE_IMAGE[:TAG] TARGET_IMAGE[:TAG] ① 比如我现在有一个 centos 镜像: [ro ...
- npm version ^ meaning
npm version ^ meaning ^ 更新版 https://docs.npmjs.com/cli/v6/commands/npm-version https://github.com/ge ...
- Node入门教程(7)第五章:node 模块化(下) npm与yarn详解
Node的包管理器 JavaScript缺少包结构的定义,而CommonJS定义了一系列的规范.而NPM的出现则是为了在CommonJS规范的基础上,实现解决包的安装卸载,依赖管理,版本管理等问题. ...
- npm package.json属性详解
概述 本文档是自己看官方文档的理解+翻译,内容是package.json配置里边的属性含义.package.json必须是一个严格的json文件,而不仅仅是js里边的一个对象.其中很多属性可以通过np ...
- 【原】npm 常用命令详解
今年上半年在学习gulp的使用,对npm的掌握是必不可少的,经常到npm官网查询文档让我感到不爽,还不如整理了一些常用的命令到自己博客上,于是根据自己的理解简单翻译过来,终于有点输出,想学习npm这块 ...
- NPM使用详解(下)
NPM使用详解(下) *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !impo ...
- NPM使用详解(上)
1.NPM是什么? NPM是JavaScript的包管理工具,在安装NodeJS(什么?你不知道node?来,我们合计合计:https://nodejs.org/)的时候,会自动安装上npm. 要查看 ...
- node.js的npm详解
一.什么是npm呢 npm(Node Package Manager,node包管理器)是node的包管理器,他允许开发人员在node.js应用程序中创建,共享并重用模块.模块就是可以在不同的项目中重 ...
随机推荐
- 看完此文还不懂NB-IoT,你就过来掐死我吧...
看完此文还不懂NB-IoT,你就过来掐死我吧....... 1 1G-2G-3G-4G-5G 不解释,看图,看看NB-IoT在哪里? 2 NB-IoT标准化历程 3GPP NB-IoT的标准化始于20 ...
- BIM开发引挈
BIM开发引挈: 0.three.js https://threejs.org/ 1. 陕西葛兰岱尔网络科技有限公司 www.glendale.com.cn 基于WebGL BIM轻 ...
- jquery知识巩固
1.jquery中的index方法和eq方法 index()方法:index()获取的索引值是相对同兄弟元素,即同一个父元素,,所以首先要确认一下这个元素的兄弟是谁,例如: 当遇到以上的情况很容易就觉 ...
- boost 实现http断点续传
// testc.cpp : Defines the entry point for the console application. // #include "stdafx.h" ...
- 解决64bit不能连接access的问题
原有的程序迁移至64位,结果调用数据库时出错,原因是jet驱动没有64位的,得换用64位的驱动程序: 1. 下载运行 AccessDatabaseEngine_x64.exe (http://ww ...
- python中常用模块
OS模块 python编程时,经常和文件.目录打交道,这是就离不了os模块.os模块包含普遍的操作系统功能,与具体的平台无关os.name()——判断现在正在实用的平台,Windows 返回 ‘nt' ...
- Linux系统基础优化及常用命令
Linux基础系统优化 引言没有,只有一张图. Linux的网络功能相当强悍,一时之间我们无法了解所有的网络命令,在配置服务器基础环境时,先了解下网络参数设定命令. ifconfig 查询.设置网卡和 ...
- python-序列化模块
本节内容 前言 json模块 pickle模块 shelve模块 总结 一.前言 1. 现实需求 每种编程语言都有各自的数据类型,其中面向对象的编程语言还允许开发者自定义数据类型(如:自定义类),Py ...
- 【转】光盘和U盘安装win7和ubuntu14.04全步骤
详细步骤见原链接:http://brianway.github.io/2016/01/18/linux-win7-ubuntu-setup-by-USBandCD/ 安装Linux步骤 1. 在win ...
- swift 学习- 11 -- 属性
// '属性'将值跟特定的类, 结构体或枚举关联, 存储属性常量或变量作为实例的一部分,而计算属性计算(不是存储) 一个值, 计算属性可以用于 类, 结构体, 枚举, 存储属性只能用于 类 和 结构体 ...