lerna 基于 git 和 npm 的多 packjson 的项目管理工具
- 初始化 npm 项目 npm init -y
- 安装 lerna yarn add lerna -D
- 初始化 lerna 项目 lerna init
-- 会初始化一个没有关联线上地址的 git 仓库
-- 增加一个 lerna.json
- 增加包项目 lerna create XXX
- 安装依赖 lerna add XXX
-- 指定目录安装依赖 lerna add XXX packages/core/
- 清理依赖包 lerna clean
- 重新安装依赖 lerna bootstrap
- lerna link
-- 可以给 package 下面相互依赖的包,进行软连接
- lerna exec 执行一些脚本
- lerna run 执行每个 packages 下面的 npm 脚本
-- lerna run --scope 包名(@guohao-dev-cli/utils) build
- lerna version 增加版本号
- lerna changed 查看上版本以来所有的变更
- lerna diff 针对 git commit 之间的比较
- lerna publish (可选择版本号,git 仓库会自动增加 tag)
"publishConfig": {
// "registry": "https://registry.npmmirror.com/"
},