Skip to content

Commit 381dbe1

Browse files
committed
🐛 fix envs
1 parent 5d485f9 commit 381dbe1

File tree

8 files changed

+41
-19
lines changed

8 files changed

+41
-19
lines changed

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ npm install -D @micro-app/cli
1414

1515
## Usage
1616

17-
1. 在项目 `根目录` 初始化创建一个 `micro-app.config.js` 文件
17+
### 在项目 `根目录` 初始化创建一个 `micro-app.config.js` 文件
1818

1919
```sh
2020
npx micro-app init
2121
```
2222

23-
2.`micro-app.config.js` 配置文件进行编辑
23+
### `micro-app.config.js` 配置文件进行编辑
2424

2525
```js
2626
module.exports = {
@@ -104,32 +104,50 @@ module.exports = {
104104
};
105105
```
106106

107-
3.`package.json` 中加载其他模块, 例如:
107+
### `package.json` 中加载其他模块, 例如:
108108

109109
```json
110110
"dependencies": {
111111
"@micro-app/test": "git+ssh://[email protected]/micro-app.git#test"
112112
},
113113
```
114114

115-
4. 开发模式
115+
### 开发模式
116116

117117
```sh
118118
npx micro-app serve
119119
```
120120

121-
5. Build
121+
or
122+
123+
```sh
124+
npx micro-app-dev
125+
```
126+
127+
### Build
122128

123129
```sh
124130
npx micro-app build
125131
```
126132

127-
6. 运行
133+
or
134+
135+
```sh
136+
npx micro-app-build
137+
```
138+
139+
### 运行
128140

129141
```sh
130142
npx micro-app start
131143
```
132144

145+
or
146+
147+
```sh
148+
npx micro-app-start
149+
```
150+
133151
## 项目中使用共享接口
134152

135153
```js

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 = process.env.NODE_ENV || 'production';
4+
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 & 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 = process.env.NODE_ENV || 'development';
4+
process.env.NODE_ENV = 'development';
55

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

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 = process.env.NODE_ENV || 'production';
4+
process.env.NODE_ENV = 'production';
55

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@micro-app/cli",
3-
"version": "0.1.0-RC2",
3+
"version": "0.1.0-RC7",
44
"description": "micro app cli",
55
"bin": {
66
"micro-app": "./bin/micro-app.js",
@@ -34,7 +34,7 @@
3434
"webpack": "^4.39.2"
3535
},
3636
"dependencies": {
37-
"@micro-app/core": "^0.1.0-RC",
37+
"@micro-app/core": "^0.1.0-RC4",
3838
"koa": "^2.8.1",
3939
"koa-static": "^5.0.0",
4040
"opn": "^5.5.0",

plugins/commands/build.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ function runServe(api, type) {
6565
webpackDevOptions = vusionAdapter.devOptions || {};
6666
} else {
6767
const webpackAdapter = require('../../src/adapter/webpack')(webpackConfig, false);
68-
webpackCompiler = webpackAdapter.compiler;
69-
webpackDevOptions = webpackAdapter.devOptions || {};
68+
if (webpackAdapter) {
69+
webpackCompiler = webpackAdapter.compiler;
70+
webpackDevOptions = webpackAdapter.devOptions || {};
71+
}
7072
}
7173

7274
// [ 'post', 'host', 'contentBase', 'entrys', 'hooks' ]; // serverConfig

plugins/commands/serve/runServe.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ module.exports = function runServe(api, isDev, { type, onlyNode, progress, port,
2727
webpackDevOptions = vusionAdapter.devOptions || {};
2828
} else {
2929
const webpackAdapter = require('../../../src/adapter/webpack')(webpackConfig, isDev);
30-
webpackCompiler = webpackAdapter.compiler;
31-
webpackDevOptions = webpackAdapter.devOptions || {};
30+
if (webpackAdapter) {
31+
webpackCompiler = webpackAdapter.compiler;
32+
webpackDevOptions = webpackAdapter.devOptions || {};
33+
}
3234
}
3335
}
3436

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,10 @@
182182
lodash "^4.17.13"
183183
to-fast-properties "^2.0.0"
184184

185-
"@micro-app/core@^0.1.0-RC":
186-
version "0.1.0-RC"
187-
resolved "https://registry.yarnpkg.com/@micro-app/core/-/core-0.1.0-RC.tgz#9479c5e0e72648b17335c26d243648f9a9408994"
188-
integrity sha512-p8/bklly6y5ajOrB3Cjp/M16gbD8xiS3Dc7VkBVTOWp2nOMZzu2m6+Ms6a5V1e75mQGPGXk+15zQXg2YD4f/hA==
185+
"@micro-app/core@^0.1.0-RC4":
186+
version "0.1.0-RC4"
187+
resolved "https://registry.yarnpkg.com/@micro-app/core/-/core-0.1.0-RC4.tgz#d391e0172ac597b2e07788e46e7a22c2374eed1b"
188+
integrity sha512-XGeWdS+fnypBpQODHO8Aj0cZoZkirYg1I+K1IXZWvNf3ClXZzQKupTITjLBqhL35vkVKEJJJIlooEvTF47r6hQ==
189189
dependencies:
190190
ajv "^6.10.2"
191191
ajv-keywords "^3.4.1"

0 commit comments

Comments
 (0)