接之前console插件,封装成npm包插件。这次说一下发布npm包的流程。
前置准备
npm账号配置
官网地址 注册地址: www.npmjs.com/signup
公司内私服地址: http://xxxxxxxxxx
登录账号
在命令行输入: npm login
之后会提示对应账号 密码 邮箱
username: xxx password: 你的登录密码 Email: 你的邮箱
公司私服账号:
user: xxx pase: xxx emi : xxx
登录失败情况
登录失败需要切换为对应镜像地址,公司内私服则切换私服地址,npm地址则切换npm地址,不要使用淘宝镜像进行登录
查询当前镜像 npm get registry
设置为公司镜像 npm config set registry xxxxxxxx
设置npm的源 npm config set registry https://registry.npmjs.org/
后续发布会用到的命令行
npm version patch package.json 里的版本号变更,如1.0.0变成1.0.1 也可以手动变更
npm publish 发布推送
发布失败请检查版本号是否有正确的变动
npm version <update_type> 更新版本号命令行