Skip to content

Commit 6e2f0e8

Browse files
committed
:fix: 修复全局指令的判断逻辑. 增加内置方法的描述
1 parent 547fd98 commit 6e2f0e8

File tree

8 files changed

+2930
-111
lines changed

8 files changed

+2930
-111
lines changed

bin/base.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ if ([ 'start', 'build' ].includes(cmd)) {
1717
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
1818
}
1919

20-
// 全局指令
21-
process.env.MICRO_APP_OPEN_SOFT_LINK = argv.openSoftLink || false; // 开启软链接
22-
process.env.MICRO_APP_OPEN_DISABLED_ENTRY = argv.openDisabledEntry || false; // 开启禁用指定模块入口, 优化开发速度
20+
const { Service, logger } = require('@micro-app/core');
2321

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

2736
const service = new Service();
2837

micro-app.config.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ module.exports = {
5555
server: {
5656
entry: '', // 服务端入口
5757
port: 8088, // 服务端口号
58-
contentBase: 'public', // 静态文件地址
5958
options: {
6059
// 服务端回调参数
6160
},
@@ -71,13 +70,4 @@ module.exports = {
7170
}],
7271
],
7372

74-
// deploy: {
75-
// git: 'git+ssh://[email protected]',
76-
// branch: 'test',
77-
// // branch: {
78-
// // name: 'develop',
79-
// // extends: true,
80-
// // },
81-
// message: '', // 提交 message 中增加内容
82-
// },
8373
};

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@micro-app/cli",
3-
"version": "0.1.4-beta.1",
3+
"version": "0.1.4-beta.3",
44
"description": "[CLI] Pluggable micro application framework.",
55
"bin": {
66
"micro-app": "./bin/micro-app.js",
@@ -36,12 +36,12 @@
3636
},
3737
"license": "MIT",
3838
"devDependencies": {
39-
"@micro-app/core": "^0.1.4-beta.1",
40-
"@micro-app/plugin-webpack-adapter": "^0.0.3",
39+
"@micro-app/core": "^0.1.4-beta.2",
40+
"@micro-app/plugin-webpack-adapter": "^0.0.4",
4141
"@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",
42+
"@micro-app/plugin-koa-webpack-middleware": "^0.0.2",
43+
"@micro-app/plugin-vue-cli": "^0.0.3-beta.3",
44+
"@micro-app/plugin-vusion-cli": "^0.0.4",
4545
"@types/jest": "^24.0.18",
4646
"babel-eslint": "^10.0.2",
4747
"coveralls": "^3.0.6",

plugins/commands/build/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Examples:
6464

6565
if (progress && webpack && webpack.ProgressPlugin) {
6666
try {
67-
require('../../../src/webpackPlugins/ProgressPlugin')(compiler);
67+
require('../../../src/webpackPlugins/ProgressPlugin')(api, compiler);
6868
} catch (error) {
6969
logger.warn(error);
7070
}

plugins/commands/serve/dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Examples:
7777

7878
if (progress && webpack && webpack.ProgressPlugin) {
7979
try {
80-
require('../../../src/webpackPlugins/ProgressPlugin')(compiler);
80+
require('../../../src/webpackPlugins/ProgressPlugin')(api, compiler);
8181
} catch (error) {
8282
logger.warn(error);
8383
}

plugins/register.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ const commands = [
99
},
1010
{
1111
name: 'serve',
12-
description: '服务启动命令行',
12+
description: '服务开发命令行',
1313
},
1414
{
1515
name: 'build',
1616
description: '构建命令行',
1717
},
18+
{
19+
name: 'start',
20+
description: '服务启动命令行',
21+
},
1822
{
1923
name: 'update',
2024
description: '强制更新 micros 依赖服务命令行',

src/webpackPlugins/ProgressPlugin.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
'use strict';
22

33
const tryRequire = require('try-require');
4+
const chalk = require('chalk');
45

5-
module.exports = function ProgressPlugin(compiler) {
6+
module.exports = function ProgressPlugin(api, compiler) {
67
const webpack = tryRequire('webpack');
78

89
if (webpack && webpack.ProgressPlugin) {

0 commit comments

Comments
 (0)