rigjs
Version:
A multi-repos dev tool based on yarn and git.Rigjs is intended to be the simplest way to develop,share and deliver codes between different developers or different projects.
148 lines (102 loc) • 3.14 kB
Markdown
- [dependencies配置](./doc/dependencies_cn.md)
1. 安装yarn.
2. node版本高于16.
3. 依赖库必须使用git+ssh链接,不支持http/https链接.
4. 以下rig库统一指代在可以用rig管理的仓库.
```shell
yarn global add rigjs
```
rig采用yarn workspaces实现依赖晋升。[关于yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces)
使用 [n](https://github.com/tj/n) 更新NodeJS
```shell
yarn global add n
sudo n lts
sudo n 16.19.1
```
```shell script
rig init
```
package.rig.json5 会被添加到工程根目录。
通过yarn add新的依赖时需要增加-W参数,如:
```shell
yarn add axios -W
```
修改package.rig.json5:
version是git的tag
如下:
```json5
{
dependencies: {
'rig-demo-1': {
source: 'git@github.com:FlashHand/rig-demo-1.git',
version: '0.0.1',
}
}
}
```
然后执行
```shell
yarn install
```
尽量使用最新的vite,在vite.config.ts中增加代码
```typescript
import {viteCommonjs} from '@originjs/vite-plugin-commonjs';
import commonjs from '@rollup/plugin-commonjs';
import rigHelper from "rig-helper";
export default defineConfig((env: ConfigEnv) => {
//.....
return {
plugins: [//...
viteCommonjs({include: rig_helper.getPkgs()}),//commonjs to esm,serve时有效,
commonjs({include: rig_helper.getPkgs()}),//commonjs to esm,build时有效
//...
],
optimizeDeps: {
exclude: rig_helper.getPkgs(),//vite小于4时,
},
server: {
watch: {
ignored: rig_helper.getRigGlobs(),//vite小于4时,监听rig_dev下的目录文件发生变化,触发hmr
followSymlinks: true,//followSymlinks不能为false
},
}
}
})
```
rig库指在rig管理下的仓库
参考demo目录
1. RigJS功能基于yarn和git开发,无需私有npm.
2. 及时的将代码库分享给任何JS项目使用.
3. 支持快捷的rig库开发模式,支持自动npm link,可以在业务开发过程中调试rig库.
4. 易扩展,专注于代码库集成组装和协作,不负责transpile,和JS项目框架无关.
| 功能 | 状态 |
|:-------------------|:------|
| 环境变量集成(减少环境变量文件数量) | 待编写文档 |
| 静态资源分享 | 待编写文档 |
| 基于OSS+CDN的ci/cd | 待编写文档 |
| Electron多进程协作开发 | 开发中 |
| 微前端协作开发 | 开发中 |
初始化rig管理工具,在项目根目录执行.
从env.rig.json5中指定一组环境变量,并覆盖到.env.rig文件中
在git仓库nothing to commit后执行,可以将package.json中的版本打为tag