meixifrontserve 0.7.97 → 2.0.2
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 +74 -74
- package/bin/index.js +16 -19
- package/config/packageV2.json +99 -0
- package/config/projectConfig.js +13 -0
- package/package.json +1 -1
- package/scripts/envByBetaController.js +19 -19
- package/scripts/envByBuildController.js +93 -93
- package/scripts/envByDevServerController.js +13 -13
- package/scripts/envByPreController.js +21 -21
- package/scripts/envByProdController.js +20 -20
- package/scripts/envByServerController.js +196 -183
- package/scripts/envByTest2Controller.js +21 -21
- package/scripts/envByTestController.js +21 -21
- package/scripts/envByTestServerController.js +15 -15
- package/scripts/rollupBuildController.js +178 -178
- package/scripts/serveController.js +110 -108
package/README.md
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
# meixifrontserve 0.1.2
|
|
2
|
-
新saas开发环境请安装该插件后,运行指定命令后来跑服务,开发环境已支持自动更新依赖。
|
|
3
|
-
|
|
4
|
-
<!-- TOC -->
|
|
5
|
-
* [meixifrontserve](#meixifrontserve)
|
|
6
|
-
* [Project setup](#project-setup)
|
|
7
|
-
* [在项目根目录下执行命令](#)
|
|
8
|
-
* [目前支持的项目](#)
|
|
9
|
-
* [后续需要添加联系我](#)
|
|
10
|
-
<!-- TOC -->
|
|
11
|
-
|
|
12
|
-
## Project setup
|
|
13
|
-
|
|
14
|
-
```shell
|
|
15
|
-
#全局下载依赖文件
|
|
16
|
-
npm install meixifrontserve@latest -g
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## 在项目根目录下执行命令
|
|
20
|
-
```shell
|
|
21
|
-
|
|
22
|
-
[//]: # (例子)
|
|
23
|
-
|
|
24
|
-
# 运行项目
|
|
25
|
-
# 这个例子是启动项目
|
|
26
|
-
# -serveByDev 是指运行的项目模式为开发
|
|
27
|
-
# -serveByTest 是指运行的项目模式为测试环境
|
|
28
|
-
# --name 是指运行的是产品中心,具体其它的模块见下面的介绍
|
|
29
|
-
meixifrontserve -serveByDev / --name production
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
# beta 是指打包项目的环境是开发打包的环境
|
|
33
|
-
meixifrontserve -beta / --name production
|
|
34
|
-
|
|
35
|
-
# 如果需要打包为其它环境只需要将上面的 -beta替换成下面的模式字段
|
|
36
|
-
# -beta 开发打包环境
|
|
37
|
-
# -test 测试打包环境
|
|
38
|
-
# -pre 预上线环境
|
|
39
|
-
# -prod 生产环境
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## 目前支持的项目
|
|
44
|
-
| 字段 | 对应的项目 |
|
|
45
|
-
|-------------|------------|
|
|
46
|
-
| customer | 魅熙客户平台 |
|
|
47
|
-
| hr | 魅熙人事应用 |
|
|
48
|
-
| production | 魅熙产品中心 |
|
|
49
|
-
| store | 魅熙仓储系统 |
|
|
50
|
-
| sale | 魅熙售卖平台 |
|
|
51
|
-
| order | 魅熙订单平台 |
|
|
52
|
-
| finance | 魅熙资金平台 |
|
|
53
|
-
| activity | 魅熙活动平台 |
|
|
54
|
-
| admin | 魅熙超级运维 |
|
|
55
|
-
| achievement | 魅熙业绩平台 |
|
|
56
|
-
| shopping | 魅熙熙粉运维平台 |
|
|
57
|
-
| applet | 魅熙柏溪运维平台 |
|
|
58
|
-
| launch | 魅熙SAAS启动平台 |
|
|
59
|
-
|
|
60
|
-
##### 后续需要添加联系我
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
1
|
+
# meixifrontserve 0.1.2
|
|
2
|
+
新saas开发环境请安装该插件后,运行指定命令后来跑服务,开发环境已支持自动更新依赖。
|
|
3
|
+
|
|
4
|
+
<!-- TOC -->
|
|
5
|
+
* [meixifrontserve](#meixifrontserve)
|
|
6
|
+
* [Project setup](#project-setup)
|
|
7
|
+
* [在项目根目录下执行命令](#)
|
|
8
|
+
* [目前支持的项目](#)
|
|
9
|
+
* [后续需要添加联系我](#)
|
|
10
|
+
<!-- TOC -->
|
|
11
|
+
|
|
12
|
+
## Project setup
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
#全局下载依赖文件
|
|
16
|
+
npm install meixifrontserve@latest -g
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## 在项目根目录下执行命令
|
|
20
|
+
```shell
|
|
21
|
+
|
|
22
|
+
[//]: # (例子)
|
|
23
|
+
|
|
24
|
+
# 运行项目
|
|
25
|
+
# 这个例子是启动项目
|
|
26
|
+
# -serveByDev 是指运行的项目模式为开发
|
|
27
|
+
# -serveByTest 是指运行的项目模式为测试环境
|
|
28
|
+
# --name 是指运行的是产品中心,具体其它的模块见下面的介绍
|
|
29
|
+
meixifrontserve -serveByDev / --name production
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# beta 是指打包项目的环境是开发打包的环境
|
|
33
|
+
meixifrontserve -beta / --name production
|
|
34
|
+
|
|
35
|
+
# 如果需要打包为其它环境只需要将上面的 -beta替换成下面的模式字段
|
|
36
|
+
# -beta 开发打包环境
|
|
37
|
+
# -test 测试打包环境
|
|
38
|
+
# -pre 预上线环境
|
|
39
|
+
# -prod 生产环境
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 目前支持的项目
|
|
44
|
+
| 字段 | 对应的项目 |
|
|
45
|
+
|-------------|------------|
|
|
46
|
+
| customer | 魅熙客户平台 |
|
|
47
|
+
| hr | 魅熙人事应用 |
|
|
48
|
+
| production | 魅熙产品中心 |
|
|
49
|
+
| store | 魅熙仓储系统 |
|
|
50
|
+
| sale | 魅熙售卖平台 |
|
|
51
|
+
| order | 魅熙订单平台 |
|
|
52
|
+
| finance | 魅熙资金平台 |
|
|
53
|
+
| activity | 魅熙活动平台 |
|
|
54
|
+
| admin | 魅熙超级运维 |
|
|
55
|
+
| achievement | 魅熙业绩平台 |
|
|
56
|
+
| shopping | 魅熙熙粉运维平台 |
|
|
57
|
+
| applet | 魅熙柏溪运维平台 |
|
|
58
|
+
| launch | 魅熙SAAS启动平台 |
|
|
59
|
+
|
|
60
|
+
##### 后续需要添加联系我
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
package/bin/index.js
CHANGED
|
@@ -34,6 +34,8 @@ program.option('--name <char>').option('-pre2')
|
|
|
34
34
|
// 生产打包
|
|
35
35
|
program.option('--name <char>').option('-prod')
|
|
36
36
|
|
|
37
|
+
program.option('--flag <char>').option('-v2')
|
|
38
|
+
|
|
37
39
|
// rollup打包
|
|
38
40
|
program.option('--env <char>').option('-rollupBuild');
|
|
39
41
|
|
|
@@ -42,24 +44,24 @@ program.parse();
|
|
|
42
44
|
const run = async () => {
|
|
43
45
|
|
|
44
46
|
const programOps = program.opts();
|
|
45
|
-
const {name, env} = programOps
|
|
47
|
+
const {name, env, flag} = programOps
|
|
48
|
+
console.log(flag);
|
|
46
49
|
// 如果是开发
|
|
47
|
-
if (programOps.ServeByDev||programOps.ServeByDevNotCheck) {
|
|
50
|
+
if (programOps.ServeByDev || programOps.ServeByDevNotCheck) {
|
|
48
51
|
// 检查更新
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
if (flag) {
|
|
52
|
+
let isCheck = programOps.ServeByDev ? await checkUpdate() : true;
|
|
53
|
+
if (isCheck) {
|
|
52
54
|
try {
|
|
53
|
-
let envByServerController = new EnvByDevServerController(name);
|
|
55
|
+
let envByServerController = new EnvByDevServerController(name, flag === 'true');
|
|
54
56
|
await envByServerController.onStart();
|
|
55
57
|
} catch (error) {
|
|
56
58
|
console.log(error)
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
} else if (programOps.ServeByTest||programOps.ServeByTestNotCheck) {
|
|
62
|
+
} else if (programOps.ServeByTest || programOps.ServeByTestNotCheck) {
|
|
61
63
|
// 检查更新
|
|
62
|
-
let flag =programOps.ServeByTest? await checkUpdate():true;
|
|
64
|
+
let flag = programOps.ServeByTest ? await checkUpdate() : true;
|
|
63
65
|
if (flag) {
|
|
64
66
|
let envByServerController = new EnvByTestServerController(name);
|
|
65
67
|
await envByServerController.onStart();
|
|
@@ -69,28 +71,23 @@ const run = async () => {
|
|
|
69
71
|
let envByBetaController = new EnvByBetaController(name, 'beta');
|
|
70
72
|
await envByBetaController.onStart();
|
|
71
73
|
|
|
72
|
-
} else if (programOps.Testing){
|
|
74
|
+
} else if (programOps.Testing) {
|
|
73
75
|
let envByTestController = new EnvByTestController(name, 'testing');
|
|
74
76
|
await envByTestController.onStart();
|
|
75
|
-
}
|
|
76
|
-
else if (programOps.Test2ing){
|
|
77
|
+
} else if (programOps.Test2ing) {
|
|
77
78
|
let envByTestController = new EnvByTest2Controller(name, 'test2ing');
|
|
78
79
|
await envByTestController.onStart();
|
|
79
|
-
}
|
|
80
|
-
else if (programOps.Test3ing){
|
|
80
|
+
} else if (programOps.Test3ing) {
|
|
81
81
|
let envByTestController = new EnvByTest3Controller(name, 'test3ing');
|
|
82
82
|
await envByTestController.onStart();
|
|
83
|
-
}
|
|
84
|
-
else if (programOps.Pre) {
|
|
83
|
+
} else if (programOps.Pre) {
|
|
85
84
|
let envByPreController = new EnvByPreController(name, 'pre');
|
|
86
85
|
await envByPreController.onStart();
|
|
87
86
|
|
|
88
|
-
}else if(programOps.Pre2){
|
|
87
|
+
} else if (programOps.Pre2) {
|
|
89
88
|
let envByPre2Controller = new EnvByPre2Controller(name, 'pre2');
|
|
90
89
|
await envByPre2Controller.onStart();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
else if (programOps.Prod) {
|
|
90
|
+
} else if (programOps.Prod) {
|
|
94
91
|
let envByProdController = new EnvByProdController(name, 'prod');
|
|
95
92
|
await envByProdController.onStart();
|
|
96
93
|
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "newoaadmin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "vue-cli-service serve",
|
|
7
|
+
"build:beta": "vue-cli-service build --mode beta",
|
|
8
|
+
"build:testing": "vue-cli-service build --mode testing",
|
|
9
|
+
"build:pre": "vue-cli-service build --mode pre",
|
|
10
|
+
"build:prod": "vue-cli-service build --mode prod",
|
|
11
|
+
"rollupBuild": "sudo meixirollupbuild -b / --pathTarget src/pages/ordermanage/oaorder/index.js-lib/oaOrderIndex.umd.js",
|
|
12
|
+
"lint": "eslint --ext .js,.vue,.ts,.tsx src",
|
|
13
|
+
"fix:lint": "eslint --fix --ext .js,.vue,.ts,.tsx src",
|
|
14
|
+
"prepare": "husky install",
|
|
15
|
+
"lint:lint-staged": "lint-staged",
|
|
16
|
+
"git": "npm run fix:lint && git add . && cz",
|
|
17
|
+
"commit": "cz"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
|
|
21
|
+
"@wangeditor/editor": "^5.1.14",
|
|
22
|
+
"@wangeditor/editor-for-vue": "^1.0.2",
|
|
23
|
+
"@wangeditor/plugin-md": "^1.0.0",
|
|
24
|
+
"async_hooks": "^1.0.0",
|
|
25
|
+
"axios": "^0.26.0",
|
|
26
|
+
"babel-helper-vue-jsx-merge-props": "^2.0.3",
|
|
27
|
+
"babel-plugin-transform-vue-jsx": "^3.7.0",
|
|
28
|
+
"babel-preset-env": "^1.7.0",
|
|
29
|
+
"core-js": "^3.6.5",
|
|
30
|
+
"crypto-js": "^3.1.9-1",
|
|
31
|
+
"dayjs": "^1.11.2",
|
|
32
|
+
"element-ui": "^2.15.6",
|
|
33
|
+
"js-md5": "^0.7.3",
|
|
34
|
+
"meixiappmain": "2.0.1",
|
|
35
|
+
"meixicheckgoodstable": "0.1.2",
|
|
36
|
+
"meixicheckstaff": "0.2.3",
|
|
37
|
+
"meixidialogtablecheck": "0.3.4",
|
|
38
|
+
"meixiexpresscheck": "0.0.6",
|
|
39
|
+
"meixihandlerecorde": "0.0.8",
|
|
40
|
+
"meixirequestts": "0.2.2",
|
|
41
|
+
"meixistepbar": "0.0.6",
|
|
42
|
+
"meixiverifyflowinfo": "0.1.0",
|
|
43
|
+
"meixisuperdrawer": "0.3.1",
|
|
44
|
+
"meixigoodstablecontrol": "2.0.1",
|
|
45
|
+
"meixihelpmenu": "2.0.1",
|
|
46
|
+
"meixilayout": "2.0.3",
|
|
47
|
+
"meixisetting": "2.0.1",
|
|
48
|
+
"meixistoretag": "2.0.3",
|
|
49
|
+
"meixiordertypebutton": "2.0.1",
|
|
50
|
+
"meixioacomponent": "2.0.3",
|
|
51
|
+
"meixitodo": "2.0.1",
|
|
52
|
+
"path": "^0.12.7",
|
|
53
|
+
"register-service-worker": "^1.7.2",
|
|
54
|
+
"v-click-outside": "^3.2.0",
|
|
55
|
+
"vue": "^2.7.10",
|
|
56
|
+
"vue-cropper": "^0.5.8",
|
|
57
|
+
"vue-router": "3.0.2",
|
|
58
|
+
"vuex": "^3.4.0",
|
|
59
|
+
"@vue/cli-plugin-babel": "~4.5.19",
|
|
60
|
+
"@vue/cli-plugin-eslint": "~4.5.19",
|
|
61
|
+
"@vue/cli-plugin-router": "~4.5.13",
|
|
62
|
+
"@vue/cli-plugin-vuex": "~4.5.13",
|
|
63
|
+
"@vue/cli-service": "~4.5.19",
|
|
64
|
+
"@vue/eslint-config-standard": "^5.1.2",
|
|
65
|
+
"@vuepress/plugin-pwa": "^1.9.7",
|
|
66
|
+
"babel-eslint": "^10.1.0",
|
|
67
|
+
"babel-plugin-component": "^1.1.1",
|
|
68
|
+
"eslint-plugin-node": "^11.1.0",
|
|
69
|
+
"eslint-plugin-standard": "^4.0.0",
|
|
70
|
+
"vue-template-compiler": "^2.7.10",
|
|
71
|
+
"husky": "^8.0.2",
|
|
72
|
+
"prettier": "^2.8.1",
|
|
73
|
+
"@vue/eslint-config-prettier": "^7.0.0",
|
|
74
|
+
"commitizen": "^4.2.6",
|
|
75
|
+
"eslint": "^8.30.0",
|
|
76
|
+
"eslint-config-standard-with-typescript": "^24.0.0",
|
|
77
|
+
"eslint-plugin-import": "^2.26.0",
|
|
78
|
+
"eslint-plugin-n": "^15.6.0",
|
|
79
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
80
|
+
"eslint-plugin-vue": "^9.8.0",
|
|
81
|
+
"@commitlint/cli": "^17.3.0",
|
|
82
|
+
"@commitlint/config-conventional": "^17.3.0",
|
|
83
|
+
"@commitlint/cz-commitlint": "^17.3.0",
|
|
84
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
85
|
+
"lint-staged": "^13.1.0",
|
|
86
|
+
"tdesign-vue": "^1.10.5-naruto"
|
|
87
|
+
},
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"less": "^3.13.1",
|
|
90
|
+
"less-loader": "^5.0.0",
|
|
91
|
+
"style-resources-loader": "^1.5.0",
|
|
92
|
+
"svg-sprite-loader": "4.1.3"
|
|
93
|
+
},
|
|
94
|
+
"browserslist": [
|
|
95
|
+
"> 1%",
|
|
96
|
+
"last 2 versions",
|
|
97
|
+
"not dead"
|
|
98
|
+
]
|
|
99
|
+
}
|
package/config/projectConfig.js
CHANGED
|
@@ -243,10 +243,23 @@ const projectConfig = {
|
|
|
243
243
|
prod: 'property'
|
|
244
244
|
},
|
|
245
245
|
systemName: '魅熙资产管理平台',
|
|
246
|
+
},
|
|
247
|
+
cost:{
|
|
248
|
+
systemId: '1859044840353415169',
|
|
249
|
+
// url的前缀 目前除了开发不会使用到该文件
|
|
250
|
+
urlPrefix: {
|
|
251
|
+
beta: 'cost',
|
|
252
|
+
testing:'cost',
|
|
253
|
+
test2ing:'cost',
|
|
254
|
+
pre: 'cost',
|
|
255
|
+
prod: 'cost'
|
|
256
|
+
},
|
|
257
|
+
systemName: '魅熙费用管理平台',
|
|
246
258
|
}
|
|
247
259
|
|
|
248
260
|
|
|
249
261
|
|
|
262
|
+
|
|
250
263
|
}
|
|
251
264
|
|
|
252
265
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const EnvByBuildController = require('./envByBuildController')
|
|
2
|
-
|
|
3
|
-
class EnvByBetaController extends EnvByBuildController {
|
|
4
|
-
constructor(projectName, envType) {
|
|
5
|
-
super(projectName, envType);
|
|
6
|
-
this.envName = 'beta'
|
|
7
|
-
this.envType = 'beta'
|
|
8
|
-
this.verName = 'beta'
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
getSystemUrl() {
|
|
13
|
-
this.urlConfig.urlPrefixes.splice(0, 0, this.projectParams.urlPrefix[`${this.envType}`]);
|
|
14
|
-
return this.urlConfig.urlPrefixes.toString().replace(/,/g, '.');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
module.exports = EnvByBetaController;
|
|
1
|
+
const EnvByBuildController = require('./envByBuildController')
|
|
2
|
+
|
|
3
|
+
class EnvByBetaController extends EnvByBuildController {
|
|
4
|
+
constructor(projectName, envType) {
|
|
5
|
+
super(projectName, envType);
|
|
6
|
+
this.envName = 'beta'
|
|
7
|
+
this.envType = 'beta'
|
|
8
|
+
this.verName = 'beta'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
getSystemUrl() {
|
|
13
|
+
this.urlConfig.urlPrefixes.splice(0, 0, this.projectParams.urlPrefix[`${this.envType}`]);
|
|
14
|
+
return this.urlConfig.urlPrefixes.toString().replace(/,/g, '.');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
module.exports = EnvByBetaController;
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
const ServerController = require('./serveController')
|
|
3
|
-
const urlConfig = require('../config/urlConfig');
|
|
4
|
-
|
|
5
|
-
const getEnvFileTemplate = require('../config/envFileTemplate')
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const fs = require('fs');
|
|
8
|
-
const packageJson = require("../config/
|
|
9
|
-
const childProcess = require("child_process");
|
|
10
|
-
const {exec} = childProcess;
|
|
11
|
-
const shell = require('shelljs');
|
|
12
|
-
|
|
13
|
-
// 打包环境
|
|
14
|
-
class EnvByBuildController extends ServerController {
|
|
15
|
-
|
|
16
|
-
constructor(projectName, envType) {
|
|
17
|
-
super(projectName);
|
|
18
|
-
this.port = 8888;
|
|
19
|
-
this.envName = '';
|
|
20
|
-
this.envType = envType;
|
|
21
|
-
|
|
22
|
-
this.urlConfig = null;
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async onStart() {
|
|
27
|
-
await super.onStart();
|
|
28
|
-
this.onRunServe();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
async createEnvFiles() {
|
|
33
|
-
this.urlConfig = urlConfig[`${this.verName}`];
|
|
34
|
-
|
|
35
|
-
console.log(this.urlConfig);
|
|
36
|
-
|
|
37
|
-
let envFileParams = {
|
|
38
|
-
envName: this.envName,
|
|
39
|
-
proxy: '/proxy',
|
|
40
|
-
systemId: this.projectParams.systemId,
|
|
41
|
-
systemName: this.projectParams.systemName,
|
|
42
|
-
apiUrl: '/api/',
|
|
43
|
-
systemUrl: this.getSystemUrl(),
|
|
44
|
-
authUrl: this.urlConfig.authUrl,
|
|
45
|
-
wsUrl: this.urlConfig.wsUrl,
|
|
46
|
-
verName: this.verName,
|
|
47
|
-
}
|
|
48
|
-
return getEnvFileTemplate(envFileParams);
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
async getServerPort() {
|
|
54
|
-
|
|
55
|
-
let flag = await this.isPortAvailable(this.port);
|
|
56
|
-
|
|
57
|
-
if (!flag) {
|
|
58
|
-
this.port += 1;
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
return true;
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
writeEnvFile(fileContent) {
|
|
67
|
-
const press = process.cwd();
|
|
68
|
-
const fileUrl = path.join(press, `./.env.${this.envType}`);
|
|
69
|
-
fs.writeFileSync(fileUrl, fileContent);
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onRunServe() {
|
|
75
|
-
console.log('正在下载依赖');
|
|
76
|
-
exec('npm install --legacy-peer-deps', async (error, stdout, stderr) => {
|
|
77
|
-
console.log(error);
|
|
78
|
-
if (!error) {
|
|
79
|
-
shell.exec(`npm run build:${this.envType}`, (error, stdout, stderr) => {
|
|
80
|
-
console.log(error);
|
|
81
|
-
})
|
|
82
|
-
} else {
|
|
83
|
-
console.error('依赖下载失败!')
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
module.exports = EnvByBuildController;
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
const ServerController = require('./serveController')
|
|
3
|
+
const urlConfig = require('../config/urlConfig');
|
|
4
|
+
|
|
5
|
+
const getEnvFileTemplate = require('../config/envFileTemplate')
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const packageJson = require("../config/packageV2.json");
|
|
9
|
+
const childProcess = require("child_process");
|
|
10
|
+
const {exec} = childProcess;
|
|
11
|
+
const shell = require('shelljs');
|
|
12
|
+
|
|
13
|
+
// 打包环境
|
|
14
|
+
class EnvByBuildController extends ServerController {
|
|
15
|
+
|
|
16
|
+
constructor(projectName, envType) {
|
|
17
|
+
super(projectName);
|
|
18
|
+
this.port = 8888;
|
|
19
|
+
this.envName = '';
|
|
20
|
+
this.envType = envType;
|
|
21
|
+
|
|
22
|
+
this.urlConfig = null;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async onStart() {
|
|
27
|
+
await super.onStart();
|
|
28
|
+
this.onRunServe();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
async createEnvFiles() {
|
|
33
|
+
this.urlConfig = urlConfig[`${this.verName}`];
|
|
34
|
+
|
|
35
|
+
console.log(this.urlConfig);
|
|
36
|
+
|
|
37
|
+
let envFileParams = {
|
|
38
|
+
envName: this.envName,
|
|
39
|
+
proxy: '/proxy',
|
|
40
|
+
systemId: this.projectParams.systemId,
|
|
41
|
+
systemName: this.projectParams.systemName,
|
|
42
|
+
apiUrl: '/api/',
|
|
43
|
+
systemUrl: this.getSystemUrl(),
|
|
44
|
+
authUrl: this.urlConfig.authUrl,
|
|
45
|
+
wsUrl: this.urlConfig.wsUrl,
|
|
46
|
+
verName: this.verName,
|
|
47
|
+
}
|
|
48
|
+
return getEnvFileTemplate(envFileParams);
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async getServerPort() {
|
|
54
|
+
|
|
55
|
+
let flag = await this.isPortAvailable(this.port);
|
|
56
|
+
|
|
57
|
+
if (!flag) {
|
|
58
|
+
this.port += 1;
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
writeEnvFile(fileContent) {
|
|
67
|
+
const press = process.cwd();
|
|
68
|
+
const fileUrl = path.join(press, `./.env.${this.envType}`);
|
|
69
|
+
fs.writeFileSync(fileUrl, fileContent);
|
|
70
|
+
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
onRunServe() {
|
|
75
|
+
console.log('正在下载依赖');
|
|
76
|
+
exec('npm install --legacy-peer-deps', async (error, stdout, stderr) => {
|
|
77
|
+
console.log(error);
|
|
78
|
+
if (!error) {
|
|
79
|
+
shell.exec(`npm run build:${this.envType}`, (error, stdout, stderr) => {
|
|
80
|
+
console.log(error);
|
|
81
|
+
})
|
|
82
|
+
} else {
|
|
83
|
+
console.error('依赖下载失败!')
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
module.exports = EnvByBuildController;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
const envByServerController = require('./envByServerController')
|
|
3
|
-
|
|
4
|
-
class EnvByDevServerController extends envByServerController {
|
|
5
|
-
constructor(projectName) {
|
|
6
|
-
super(projectName);
|
|
7
|
-
this.proxy = "http://meixi.wubangtu.xyz/api";
|
|
8
|
-
this.configProps='serveByDev'
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
module.exports = EnvByDevServerController;
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
const envByServerController = require('./envByServerController')
|
|
3
|
+
|
|
4
|
+
class EnvByDevServerController extends envByServerController {
|
|
5
|
+
constructor(projectName,isV2=false) {
|
|
6
|
+
super(projectName,isV2);
|
|
7
|
+
this.proxy = "http://meixi.wubangtu.xyz/api";
|
|
8
|
+
this.configProps='serveByDev'
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
module.exports = EnvByDevServerController;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const EnvByBuildController = require('./envByBuildController');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class EnvByPreController extends EnvByBuildController {
|
|
5
|
-
constructor(projectName, envType) {
|
|
6
|
-
super(projectName, envType);
|
|
7
|
-
this.envName = 'preview'
|
|
8
|
-
this.envType = 'pre'
|
|
9
|
-
this.verName = 'pre'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getSystemUrl() {
|
|
14
|
-
this.urlConfig.urlPrefixes.splice(1, 0, this.projectParams.urlPrefix[`${this.envType}`]);
|
|
15
|
-
return this.urlConfig.urlPrefixes.toString().replace(/,/g, '.');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
module.exports = EnvByPreController;
|
|
1
|
+
const EnvByBuildController = require('./envByBuildController');
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class EnvByPreController extends EnvByBuildController {
|
|
5
|
+
constructor(projectName, envType) {
|
|
6
|
+
super(projectName, envType);
|
|
7
|
+
this.envName = 'preview'
|
|
8
|
+
this.envType = 'pre'
|
|
9
|
+
this.verName = 'pre'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
getSystemUrl() {
|
|
14
|
+
this.urlConfig.urlPrefixes.splice(1, 0, this.projectParams.urlPrefix[`${this.envType}`]);
|
|
15
|
+
return this.urlConfig.urlPrefixes.toString().replace(/,/g, '.');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
module.exports = EnvByPreController;
|