test-diff-new
v1.3.19
Published
支持一键发布npm包,集成自动更新version、自动生成CHANGELOG.md、发布时自动指向京东npm私服、发布、发布后自动推送京ME机器人消息等功能
Downloads
2,580
Maintainers
Readme
@jd/icc-npm-publish-cli
简介
@jd/icc-npm-publish-cli
支持一键发布npm包,集成自动更新version
、自动生成CHANGELOG.md
、发布时自动指向京东npm私服、发布、发布后自动推送京ME机器人消息等功能
兼容:Node.js >= 12.0.0
安装
npm i @jd/icc-npm-publish-cli --save-dev --registry=http://registry.m.jd.com
使用
// package.json
"scripts": {
"verdaccio": "verdaccio",
"pub:local": "pub-service pub:local",
"alpha": "pub-service pub --npm-tag=alpha",
"beta": "pub-service pub --npm-tag=beta",
"pub": "pub-service pub",
"prepublishOnly": "pub-service prepublish"
}
pub.config.js
安装 @jd/icc-npm-publish-cli
后,执行 npx pub-service init
会在本地生成 pub.config.js
// pub.config.js
module.exports = function () {
return {
robotConfig: {
groupId: '', // 京ME群号,不填则不推送机器人消息
docUrl: '', // 组件文档,默认 https://npm.m.jd.com/package/{packageName@version}
repositoryUrl: '' // 代码仓库地址,默认 package.json 中 repository.url
}
}
}
接入京ME机器人消息
1、在京ME群中搜索 app.g5fqktat
,将 前端组件机器人
拉入京ME群
2、在pub.config.js
中传入群号给 robotConfig.groupId
3、组件发布时会自动推送机器人消息到所指定群
Command & Options
1. pub
使用: pub-service pub [options]
作用:发布 package
Options:
-a, --npm-tag=alpha 发布 alpha 版本
-b, --npm-tag=beta 发布 beta 版本
--skip-git-status 跳过git status 检测
--skip-fetch-tags 跳过拉取tags
--custom-version 自定义版本号
--skip-publish 跳过发布
--skip-robot 跳过机器人消息推送
-h, --help display help for command
pub 命令集成了以下几个工作流:
1、自动更新 version
2、自动生成 CHANGELOG.md
3、发布时自动指向京东npm私服
4、发布
5、推送京ME机器人消息
2. pub:local
使用: pub-service pub:local [--registry=http://localhost:4873/]
作用:发布组件包至本地私有npm注册表
Options:
-r, --registry <url> 设置本地私有npm注册表地址
-h, --help display help for command
2.1 启动本地私有npm注册表
npm run verdaccio
2.2 登录本地私有npm注册表
npm adduser --registry http://localhost:4873/
2.3 发布组件包至本地私有npm注册表
npm run pub:local
2.4 安装本地私有npm注册表组件包
npm i xxx -registry http://localhost:4873/
3. prepublish
使用: pub-service prepublish [options]
作用:阻止用户使用 npm publish 发布,强制使用 pub-service pub
Options:
-h, --help display help for command
4. init
使用: npx @jd/icc-npm-publish-cli init [options]
作用:初始化 pub-service 配置
Options:
-h, --help display help for command