Skip to content

Commit 2feff8a

Browse files
authored
Merge pull request #8 from MicrosApp/develop
Develop
2 parents 0dd6f98 + 3f668db commit 2feff8a

29 files changed

+628
-781
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ module.exports = {
9696
server: {
9797
entry: '', // 服务端入口
9898
port: 8088, // 服务端口号
99-
contentBase: 'public', // 静态文件地址
10099
options: {
101100
// 服务端回调参数
102101
},

bin/base.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,24 @@ const yParser = require('yargs-parser');
1010
const cmd = process.argv[2];
1111
const argv = yParser(process.argv.slice(3));
1212

13-
// 全局环境
14-
if ([ 'start', 'build' ].includes(cmd)) {
15-
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
16-
} else if ([ 'serve' ].includes(cmd)) {
17-
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
18-
}
13+
// 全局环境模式 production, development
14+
process.env.NODE_ENV = argv.mode || process.env.NODE_ENV || 'development';
15+
16+
const { Service, logger } = require('@micro-app/core');
1917

2018
// 全局指令
21-
if (!global.MicroAppConfig) {
22-
global.MicroAppConfig = {};
19+
if (argv.openSoftLink) {
20+
process.env.MICRO_APP_OPEN_SOFT_LINK = argv.openSoftLink || false; // 开启软链接
21+
if (process.env.MICRO_APP_OPEN_SOFT_LINK === 'true') {
22+
logger.info(`开启软链接; --open-soft-link = ${process.env.MICRO_APP_OPEN_SOFT_LINK}`);
23+
}
24+
}
25+
if (argv.openDisabledEntry) {
26+
process.env.MICRO_APP_OPEN_DISABLED_ENTRY = argv.openDisabledEntry || false; // 开启禁用指定模块入口, 优化开发速度
27+
if (process.env.MICRO_APP_OPEN_DISABLED_ENTRY === 'true') {
28+
logger.info(`开启禁用指定模块入口; --open-disabled-entry = ${process.env.MICRO_APP_OPEN_DISABLED_ENTRY}`);
29+
}
2330
}
24-
const MicroAppConfig = global.MicroAppConfig;
25-
MicroAppConfig.OPEN_SOFT_LINK = argv.openSoftLink || false; // 开启软链接
26-
MicroAppConfig.OPEN_DISABLED_ENTRY = argv.openDisabledEntry || false; // 开启禁用指定模块入口, 优化开发速度
27-
28-
const microApp = require('@micro-app/core');
29-
const Service = microApp.Service;
3031

3132
const service = new Service();
3233

bin/micro-app-build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
process.env.NODE_ENV = 'production';
4+
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
55

66
const yParser = require('yargs-parser');
77
const argv = yParser(process.argv.slice(2));

bin/micro-app-dev.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
process.env.NODE_ENV = 'development';
4+
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
55

66
const yParser = require('yargs-parser');
77
const argv = yParser(process.argv.slice(2));
8-
98
const { service } = require('./base');
109

1110
service.run('serve', argv);

bin/micro-app-start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
'use strict';
33

4-
process.env.NODE_ENV = 'production';
4+
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
55

66
const yParser = require('yargs-parser');
77
const argv = yParser(process.argv.slice(2));

libs/deploy.js

Lines changed: 0 additions & 139 deletions
This file was deleted.

libs/update.js

Lines changed: 0 additions & 68 deletions
This file was deleted.

micro-app.config.js

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = {
4545

4646
strict: true,
4747

48-
micros: [ 'test' ], // 被注册的容器
48+
// micros: [ 'test' ], // 被注册的容器
4949
// micros$$test: { // 单独配置
5050
// disabled: true, // 禁用入口
5151
// link: '', // 本地路径, 进行本地开发使用的软链接.
@@ -55,29 +55,18 @@ module.exports = {
5555
server: {
5656
entry: '', // 服务端入口
5757
port: 8088, // 服务端口号
58-
contentBase: 'public', // 静态文件地址
5958
options: {
6059
// 服务端回调参数
6160
},
6261
},
6362

64-
plugins: [
65-
[{
66-
id: 'test',
67-
description: '这是test',
68-
link: __dirname + '/test/testPlugin',
69-
}, {
70-
a: 1,
71-
}],
72-
],
73-
74-
// deploy: {
75-
// git: 'git+ssh://[email protected]',
76-
// branch: 'test',
77-
// // branch: {
78-
// // name: 'develop',
79-
// // extends: true,
80-
// // },
81-
// message: '', // 提交 message 中增加内容
82-
// },
63+
// plugins: [
64+
// [{
65+
// id: 'test',
66+
// description: '这是test',
67+
// link: __dirname + '/test/testPlugin',
68+
// }, {
69+
// a: 1,
70+
// }],
71+
// ],
8372
};

package.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@micro-app/cli",
3-
"version": "0.1.3",
3+
"version": "0.1.6",
44
"description": "[CLI] Pluggable micro application framework.",
55
"bin": {
66
"micro-app": "./bin/micro-app.js",
@@ -36,27 +36,25 @@
3636
},
3737
"license": "MIT",
3838
"devDependencies": {
39-
"@micro-app/core": "^0.1.3",
40-
"@micro-app/plugin-webpack-adapter": "^0.0.3",
39+
"@micro-app/core": "^0.1.7",
4140
"@micro-app/plugin-koa-static-server": "^0.0.1",
42-
"@micro-app/plugin-koa-webpack-middleware": "^0.0.1",
43-
"@micro-app/plugin-vue-cli": "^0.0.2",
44-
"@micro-app/plugin-vusion-cli": "^0.0.3",
41+
"@micro-app/plugin-koa-webpack-middleware": "^0.0.2",
42+
"@micro-app/plugin-webpack-adapter": "^0.0.5",
4543
"@types/jest": "^24.0.18",
46-
"babel-eslint": "^10.0.2",
44+
"babel-eslint": "^10.0.3",
4745
"coveralls": "^3.0.6",
4846
"eslint": "^5.16.0",
4947
"eslint-config-2o3t": "^1.1.17",
5048
"jest": "^24.9.0",
5149
"webpack": "^4.39.2"
5250
},
5351
"peerDependencies": {
54-
"@micro-app/core": "^0.1.3",
55-
"@micro-app/plugin-webpack-adapter": "^0.0.3"
52+
"@micro-app/core": ">=0.1.7",
53+
"@micro-app/plugin-webpack-adapter": "^0.0.5"
5654
},
5755
"dependencies": {
56+
"cli-highlight": "^2.1.1",
5857
"koa": "^2.8.1",
59-
"opn": "^5.5.0",
6058
"shelljs": "^0.8.3",
6159
"update-notifier": "^3.0.1",
6260
"yargs-parser": "^13.1.1"

0 commit comments

Comments
 (0)