rigjs 3.0.7 → 3.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -7
- package/README_CN.md +45 -124
- package/built/index.js +86 -86
- package/demo/package.json +3 -5
- package/demo/package.rig.json5 +4 -4
- package/demo/yarn.lock +241 -10
- package/lib/classes/RigConfig.ts +3 -2
- package/lib/init/index.ts +8 -0
- package/lib/postinstall/index.ts +15 -1
- package/lib/preinstall/index.ts +9 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
# rig
|
|
2
2
|
*[中文文档](./README_CN.md)*
|
|
3
|
-
- [dependencies config](./doc/dependencies_cn.md)
|
|
4
|
-
- [CICD config](./doc/cicd_cn.md)
|
|
5
|
-
- [share config](./doc/share_cn.md)
|
|
6
|
-
- [Goals](#Goals)
|
|
7
|
-
|
|
8
3
|
|
|
9
4
|
## Get started
|
|
10
5
|
### 0.Prerequisites
|
|
@@ -172,5 +167,4 @@ Modify package.rig.json5
|
|
|
172
167
|
|
|
173
168
|
I'm still developing new features in most flexible and unobtrusive way.So my team won't cost extra time to upgrade their applications' architecture.
|
|
174
169
|
|
|
175
|
-
Rigjs works great for my team in development of vue-apps,uni-apps,electron apps and nodejs apps.If you don't need many remote modules,it will work fine for you too.
|
|
176
|
-
|
|
170
|
+
Rigjs works great for my team in development of vue-apps,uni-apps,electron apps and nodejs apps.If you don't need many remote modules,it will work fine for you too.
|
package/README_CN.md
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
# rig
|
|
2
|
-
- [目标](#目标)
|
|
3
|
-
- [快速开始](#快速开始:基于rig的模块化开发)
|
|
4
2
|
- [dependencies配置](./doc/dependencies_cn.md)
|
|
5
|
-
- [CICD配置](./doc/cicd_cn.md)
|
|
6
|
-
- [share 文件共享](./doc/share_cn.md)
|
|
7
3
|
|
|
8
|
-
##
|
|
4
|
+
## 快速开始
|
|
9
5
|
### 0.前提准备
|
|
6
|
+
1. 安装yarn.
|
|
7
|
+
2. node版本高于14.
|
|
8
|
+
3. 依赖库必须使用git+ssh链接,不支持http/https链接.
|
|
9
|
+
4. 以下rig库统一指代在可以用rig管理的仓库.
|
|
10
|
+
|
|
10
11
|
#### 安装yarn,
|
|
11
12
|
```shell
|
|
12
13
|
yarn global add rigjs
|
|
@@ -30,56 +31,24 @@ rig init
|
|
|
30
31
|
```
|
|
31
32
|
package.rig.json5 会被添加到工程根目录。
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
#### 2.1 方法一:rig add
|
|
35
|
-
rig add [your git ssh url] [tag]
|
|
36
|
-
e.g.
|
|
34
|
+
通过yarn add新的依赖时需要增加-W参数,如:
|
|
37
35
|
```shell
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
引用该仓库
|
|
41
|
-
```ecmascript 6
|
|
42
|
-
const {hello} = require('rig-demo-1');
|
|
43
|
-
hello();
|
|
36
|
+
yarn add axios -W
|
|
44
37
|
```
|
|
38
|
+
### 2.使用rig安装现有的代码库
|
|
39
|
+
version是git的tag
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
如下:
|
|
47
42
|
```json5
|
|
48
43
|
{
|
|
49
44
|
dependencies: {
|
|
50
45
|
'rig-demo-1': {
|
|
51
46
|
source: 'git@github.com:FlashHand/rig-demo-1.git',
|
|
52
47
|
version: '0.0.1',
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
然后执行
|
|
58
|
-
```shell
|
|
59
|
-
yarn install
|
|
60
|
-
```
|
|
61
|
-
### 3.在rig管理下,开发一个现有的代码库
|
|
62
|
-
#### 3.1 方法一:rig dev
|
|
63
|
-
rig dev [包名称|git-ssh-url]
|
|
64
|
-
当package已经存在于package.rig.json5
|
|
65
|
-
```shell
|
|
66
|
-
rig dev rig-demo-1
|
|
67
|
-
```
|
|
68
|
-
当package还不存在于package.rig.json5.
|
|
69
|
-
```shell
|
|
70
|
-
#安装代码包并设为开发模式
|
|
71
|
-
rig dev rig-demo-1 git@github.com:FlashHand/rig-demo-1.git
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
rig-demo-1会被安装到rig_dev目录下。node_modules会存在rig-demo-1的symlink.
|
|
75
|
-
#### 3.1 方法二:在package.rig.json5中修改配置
|
|
76
|
-
```json5
|
|
77
|
-
{
|
|
78
|
-
dependencies: {
|
|
79
|
-
'rig-demo-1': {
|
|
80
|
-
source: 'git@github.com:FlashHand/rig-demo-1.git',
|
|
48
|
+
},
|
|
49
|
+
'rig-demo-2': {
|
|
50
|
+
source: 'git@github.com:FlashHand/rig-demo-2.git',
|
|
81
51
|
version: '0.0.1',
|
|
82
|
-
dev: true //默认是false,
|
|
83
52
|
}
|
|
84
53
|
}
|
|
85
54
|
}
|
|
@@ -89,83 +58,35 @@ rig-demo-1会被安装到rig_dev目录下。node_modules会存在rig-demo-1的sy
|
|
|
89
58
|
yarn install
|
|
90
59
|
```
|
|
91
60
|
|
|
92
|
-
###
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
{
|
|
124
|
-
dependencies: {
|
|
125
|
-
'rig-demo-1': {
|
|
126
|
-
source: 'git@github.com:FlashHand/rig-demo-1.git',
|
|
127
|
-
version: '0.0.1',
|
|
128
|
-
// dev:true//生产环境中不要使用dev模式,应该指定安装确定的version.
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
```
|
|
61
|
+
### 3.开发一个新的rig库或改造现有仓库为rig库
|
|
62
|
+
rig库指在rig管理下的仓库
|
|
63
|
+
|
|
64
|
+
参考demo目录
|
|
65
|
+
|
|
66
|
+
## 关于RigJS模块化开发功能的特点:
|
|
67
|
+
1. RigJS功能基于yarn和git开发,无需私有npm.
|
|
68
|
+
2. 及时的将代码库分享给任何JS项目使用.
|
|
69
|
+
3. 支持快捷的rig库开发模式,支持自动npm link,可以在业务开发过程中调试rig库.
|
|
70
|
+
4. 易扩展,专注于代码库集成组装和协作,不负责transpile,和JS项目框架无关.
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## 其他功能
|
|
74
|
+
| 功能 | 状态 |
|
|
75
|
+
|:-------------------|:------|
|
|
76
|
+
| 环境变量集成(减少环境变量文件数量) | 待编写文档 |
|
|
77
|
+
| 静态资源分享 | 待编写文档 |
|
|
78
|
+
| 基于OSS+CDN的ci/cd | 待编写文档 |
|
|
79
|
+
| Electron多进程协作开发 | 开发中 |
|
|
80
|
+
| 微前端协作开发 | 开发中 |
|
|
81
|
+
|
|
82
|
+
## 命令清单
|
|
83
|
+
|
|
84
|
+
### rig init
|
|
85
|
+
初始化rig管理工具,在项目根目录执行.
|
|
86
|
+
|
|
87
|
+
### rig env [mode]
|
|
88
|
+
从env.rig.json5中指定一组环境变量,并覆盖到.env.rig文件中
|
|
89
|
+
|
|
90
|
+
### rig tag
|
|
91
|
+
在git仓库nothing to commit后执行,可以将package.json中的版本打为tag
|
|
133
92
|
|
|
134
|
-
## Advantages
|
|
135
|
-
- 💡Rigjs only needs git.No need to publish packages to private registry.
|
|
136
|
-
- ⚡️Instant code sharing between multiple projects and multiple developers.Packages can be easily installed by git-ssh-url and tag.
|
|
137
|
-
- ⚙️Auto npm link in dev mode.Import or require packages just like normal node_modules with friendly code suggestion.
|
|
138
|
-
- 🔍Easily develop packages within your projects.Packages in *dev* mode are all in *rig_dev* folder.
|
|
139
|
-
- 💨Easily transform existing code into a sharable package for multiple projects.
|
|
140
|
-
- 📏Large content scale.You can share from a simple js file to multiple files that contains many pages.
|
|
141
|
-
- 🧹Flat dependencies.No need to worry complex packages' relationship.
|
|
142
|
-
|
|
143
|
-
## Goals
|
|
144
|
-
### Sharing codes or files.
|
|
145
|
-
1. Reuse codes between different developers or different projects in most flexible and unobtrusive way.
|
|
146
|
-
2. Easily turn modules into developing mode,no need to use npm link or change package.json.
|
|
147
|
-
3. Also support sharing files between projects like '.eslintrc.js' or 'tsconfig.json'...
|
|
148
|
-
4. Developing one website in multiple modules.
|
|
149
|
-
|
|
150
|
-
### Serverless CI/CD
|
|
151
|
-
1. Build multiple versions for different environments at same time.
|
|
152
|
-
2. Support deploying and publishing(Only support ali-cloud's oss and cdn by now).
|
|
153
|
-
|
|
154
|
-
### Remote modules' helper(in development)
|
|
155
|
-
- Working with webpack5's module federation.
|
|
156
|
-
- Easily active modules' developing mode.
|
|
157
|
-
- Friendly Code suggestion.
|
|
158
|
-
- Simple router that can brings you everywhere.
|
|
159
|
-
- Sandbox,state sharing....
|
|
160
|
-
|
|
161
|
-
### Current Limits
|
|
162
|
-
- Rigjs packages can share source code directly in node_modules.So transpiling or compiling might be needed.
|
|
163
|
-
- Rigjs can not remove redundant codes for remote modules.
|
|
164
|
-
- Although rigjs supports developing one website in multiple repos,
|
|
165
|
-
But they all need to be built together into one application package.
|
|
166
|
-
So it wastes time to build those unchanged modules ,which seems wrong when your website has hundreds or thousands of pages.
|
|
167
|
-
- CI/CD only supports ali-cloud's oss and cdn.I don't have plans to make it better for now.
|
|
168
|
-
|
|
169
|
-
I'm still developing new features in most flexible and unobtrusive way.So my team won't cost extra time to upgrade their applications' architecture.
|
|
170
|
-
|
|
171
|
-
Rigjs works great for my team in development of vue-apps,uni-apps,electron apps and nodejs apps.If you don't need many remote modules,it will work fine for you too.
|