rushjs来自微软的单体仓库管理工具
rushjs 是来自微软的单体仓库管理工具 ,与lerna 类似但是使用上稍显复杂
安装
npm install -g @microsoft/rush
简单使用
- 一个传统的基于npm 的处理
~$ cd my-toolchain
~/my-toolchain$ npm run build
~/my-toolchain$ npm link
~/my-toolchain$ cd ../my-controls
~/my-controls$ npm link my-toolchain
~/my-controls$ npm run build
~/my-controls$ npm link
~/my-app$ cd ../my-app
~/my-app$ npm link my-toolchain
~/my-app$ npm link my-controls
~/my-app$ npm run build
说明:
my-app: web app
my-controls: web app 需要使用的control包
my-toolchain: nodejs 构建工具,用来编译其他项目
- 使用rushjs的方式
初始化项目:
rush init
效果:
Rush Multi-Project Build Tool 5.15.0 (unmanaged) - https://rushjs.io
Node.js version is 8.14.0 (LTS)
Starting "rush init"
Generating: /Users/dalong/mylearning/rushjs-learning/first/rush.json
Generating: /Users/dalong/mylearning/rushjs-learning/first/.gitattributes
Generating: /Users/dalong/mylearning/rushjs-learning/first/.gitignore
Generating: /Users/dalong/mylearning/rushjs-learning/first/.travis.yml
Generating: /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/.npmrc
Generating: /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/command-line.json
Generating: /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/common-versions.json
Generating: /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/experiments.json
Generating: /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/pnpmfile.js
Generating: /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/version-policies.json
说明:
具体文件的参数说明参考 https://rushjs.io/pages/maintainer/setup_new_repo/
添加git 源代码管理
git init
git add --all
git commit -m "init project"
创建一个包
mkdir -p tools/user
cd tools/user
yarn init -y
touch index.js
/**
* user commonjs module
*/
module.exports = {
name: "dalong",
age:33
}
package.json 内容
添加项目到rush 管理
编辑 rush.json 文件,追加
{
"packageName": "tools-user",
"projectFolder": "tools/user",
"reviewCategory": "tools"
}
更新rush 项目
rush update
效果
Rush Multi-Project Build Tool 5.15.0 - https://rushjs.io
Node.js version is 10.14.0 (LTS)
Starting "rush update"
Trying to acquire lock for pnpm-2.15.1
Acquired lock for pnpm-2.15.1
Installing pnpm version 2.15.1
Deleting old files from /Users/dalong/.rush/node-v10.14.0/pnpm-2.15.1
Copying /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/.npmrc --> /Users/dalong/.rush/node-v10.14.0/pnpm-2.15.1/.npmrc
Running "npm install" in /Users/dalong/.rush/node-v10.14.0/pnpm-2.15.1
npm WARN deprecated pnpm@2.15.1: Please use the latest version of pnpm
npm notice created a lockfile as package-lock.json. You should commit this file.
added 1 package from 1 contributor and audited 1 package in 13.314s
found 0 vulnerabilities
Successfully installed pnpm version 2.15.1
Symlinking "/Users/dalong/mylearning/rushjs-learning/first/common/temp/pnpm-local"
--> "/Users/dalong/.rush/node-v10.14.0/pnpm-2.15.1"
Using the default variant for installation.
Updating temp projects in /Users/dalong/mylearning/rushjs-learning/first/common/temp/projects
Copying /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/.npmrc --> /Users/dalong/mylearning/rushjs-learning/first/common/temp/.npmrc
Updating /Users/dalong/mylearning/rushjs-learning/first/common/temp/pnpmfile.js
Updating /Users/dalong/mylearning/rushjs-learning/first/common/temp/projects/tools-user.tgz
Finished creating temporary modules (0.02 seconds)
Checking node_modules in /Users/dalong/mylearning/rushjs-learning/first/common/temp
Running "pnpm install" in /Users/dalong/mylearning/rushjs-learning/first/common/temp
Using hooks from: /Users/dalong/mylearning/rushjs-learning/first/common/temp/pnpmfile.js
readPackage hook is declared. Manifests of dependencies might get overridden
Packages: +1
+
Resolving: total 1, reused 0, downloaded 1, done
dependencies:
+ @rush-temp/tools-user 0.0.0
╭──────────────────────────────────────────────────────────────────╮
│ │
│ Update available! 2.25.4 → 2.25.6 │
│ Changelog: https://github.com/pnpm/pnpm/releases/tag/v2.25.6 │
│ Run pnpm i -g pnpm to update! │
│ │
│ Follow @pnpmjs for updates: https://twitter.com/pnpmjs │
│ │
╰──────────────────────────────────────────────────────────────────╯
Updating /Users/dalong/mylearning/rushjs-learning/first/common/config/rush/shrinkwrap.yaml
Linking projects together
LINKING: tools-user
Purging /Users/dalong/mylearning/rushjs-learning/first/tools/user/node_modules
Writing "/Users/dalong/mylearning/rushjs-learning/first/common/temp/rush-link.json"
Linking finished successfully. (0.02 seconds)
Next you should probably run "rush build" or "rush rebuild"
Rush update finished successfully. (18.73 seconds)
后续添加项目类似
说明
总的来说稍有复杂, 对于一般的项目使用这个工具有点吃力,使用yarn 或者 lerna 这样的工具还是很不错的,后期再研究下
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2018-10-09 12 Factor CLI Apps
2018-10-09 oclif cli app开发简单试用
2017-10-09 openfaas k8s 集成
2014-10-09 转 HTTP.SYS 详解
2014-10-09 转 HTTP/2: The Long-Awaited Sequel
2014-10-09 网站分析
2014-10-09 C#拦截系统消息