Skip to content

Commit a4018e3

Browse files
committed
feat: 增加适配多服务入口配置逻辑
1 parent 2fe09de commit a4018e3

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@
5151
]
5252
},
5353
"peerDependencies": {
54-
"@micro-app/cli": "^0.4.0"
54+
"@micro-app/cli": "^0.4.1"
5555
},
5656
"devDependencies": {
57-
"@micro-app/cli": "^0.4.0",
57+
"@micro-app/cli": "^0.4.1",
5858
"@micro-app/plugin-deploy": "^0.0.8",
5959
"@types/jest": "^24.9.1",
6060
"eslint-config-2o3t": "^2.0.1",

src/plugins/factory/index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,18 @@ module.exports = async function(api, info = {}) {
2020
// 上下文参数
2121
const apiContext = api.context || {};
2222

23-
const { index, port, host } = info;
24-
const runApp = require(index); // app.js
25-
await runApp(app);
23+
const { index, port, host, entries = [] } = info;
24+
if (entries.length > 0) {
25+
await entries.reduce((chain, entry) => {
26+
const runApp = require(entry); // app.js
27+
return chain.then(() => {
28+
return Promise.resolve(runApp(app));
29+
});
30+
}, Promise.resolve());
31+
} else { // 兼容
32+
const runApp = require(index); // app.js
33+
await runApp(app);
34+
}
2635

2736
const portfinder = require('portfinder');
2837

0 commit comments

Comments
 (0)