ee-core 2.8.2 → 2.9.0
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/cross/index.js +4 -0
- package/cross/spawnProcess.js +8 -0
- package/ee/eeApp.js +9 -6
- package/html/index.js +14 -0
- package/package.json +1 -1
- package/utils/helper.js +7 -0
package/cross/index.js
CHANGED
|
@@ -85,6 +85,10 @@ const CrossLanguageService = {
|
|
|
85
85
|
// format params
|
|
86
86
|
let tmpArgs = targetConf.args;
|
|
87
87
|
let confPort = parseInt(Helper.getValueFromArgv(tmpArgs, 'port'));
|
|
88
|
+
// 某些程序给它传入不存在的参数时会报错
|
|
89
|
+
if (isNaN(confPort) && targetConf.port > 0) {
|
|
90
|
+
confPort = targetConf.port;
|
|
91
|
+
}
|
|
88
92
|
if (confPort > 0) {
|
|
89
93
|
// 动态生成port,传入的端口必须为int
|
|
90
94
|
confPort = await GetPort({ port: confPort });
|
package/cross/spawnProcess.js
CHANGED
|
@@ -28,6 +28,7 @@ class SpawnProcess {
|
|
|
28
28
|
const { targetConf, port } = options;
|
|
29
29
|
this.config = targetConf;
|
|
30
30
|
this.port = port;
|
|
31
|
+
|
|
31
32
|
// 该名称如果在childrenMap重复,会被重写
|
|
32
33
|
this.name = targetConf.name;
|
|
33
34
|
|
|
@@ -39,6 +40,9 @@ class SpawnProcess {
|
|
|
39
40
|
if (Ps.isPackaged()) {
|
|
40
41
|
standardOutput = ['ignore', 'ignore', 'ignore', 'ipc'];
|
|
41
42
|
}
|
|
43
|
+
if (targetConf.stdio) {
|
|
44
|
+
standardOutput = targetConf.stdio;
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
const { cmd, directory } = targetConf;
|
|
44
48
|
// use cmd first
|
|
@@ -150,6 +154,10 @@ class SpawnProcess {
|
|
|
150
154
|
return obj;
|
|
151
155
|
}
|
|
152
156
|
|
|
157
|
+
setPort(port) {
|
|
158
|
+
this.port = parseInt(port);
|
|
159
|
+
}
|
|
160
|
+
|
|
153
161
|
_generateId() {
|
|
154
162
|
const rid = Helper.getRandomString();
|
|
155
163
|
return `node:${this.pid}:${rid}`;
|
package/ee/eeApp.js
CHANGED
|
@@ -17,6 +17,7 @@ const GetPort = require('../utils/get-port');
|
|
|
17
17
|
const UtilsHelper = require('../utils/helper');
|
|
18
18
|
const HttpClient = require('../httpclient');
|
|
19
19
|
const Cross = require('../cross');
|
|
20
|
+
const Html = require('../html');
|
|
20
21
|
|
|
21
22
|
class EeApp extends BaseApp {
|
|
22
23
|
constructor(options = {}) {
|
|
@@ -146,7 +147,7 @@ class EeApp extends BaseApp {
|
|
|
146
147
|
// 检查 UI serve是否启动,先加载一个boot page
|
|
147
148
|
if (load == 'url') {
|
|
148
149
|
// loading page
|
|
149
|
-
let lp =
|
|
150
|
+
let lp = Html.getFilepath('boot.html');
|
|
150
151
|
if (electronCfg.hasOwnProperty('loadingPage') && electronCfg.loadingPage != '') {
|
|
151
152
|
lp = path.join(this.config.homeDir, electronCfg.loadingPage);
|
|
152
153
|
}
|
|
@@ -170,8 +171,8 @@ class EeApp extends BaseApp {
|
|
|
170
171
|
count++;
|
|
171
172
|
}
|
|
172
173
|
|
|
173
|
-
if (frontendReady == false) {
|
|
174
|
-
const bootFailurePage =
|
|
174
|
+
if (frontendReady == false && modeInfo.force !== true) {
|
|
175
|
+
const bootFailurePage = Html.getFilepath('failure.html');
|
|
175
176
|
this.mainWindow.loadFile(bootFailurePage);
|
|
176
177
|
Log.coreLogger.error(`[ee-core] Please check the ${url} !`);
|
|
177
178
|
return;
|
|
@@ -190,6 +191,9 @@ class EeApp extends BaseApp {
|
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
// 主进程
|
|
194
|
+
if (mainServer.protocol == "") {
|
|
195
|
+
return
|
|
196
|
+
}
|
|
193
197
|
if (Conf.isFileProtocol(mainServer)) {
|
|
194
198
|
url = path.join(this.config.homeDir, mainServer.indexPath);
|
|
195
199
|
this.loadMainUrl('spa', url, 'file');
|
|
@@ -245,7 +249,7 @@ class EeApp extends BaseApp {
|
|
|
245
249
|
}
|
|
246
250
|
//console.log('count:', count)
|
|
247
251
|
if (serviceReady == false) {
|
|
248
|
-
const bootFailurePage =
|
|
252
|
+
const bootFailurePage = Html.getFilepath('cross-failure.html');
|
|
249
253
|
this.mainWindow.loadFile(bootFailurePage);
|
|
250
254
|
throw new Error(`[ee-core] Please check cross service [${service}] ${url} !`)
|
|
251
255
|
}
|
|
@@ -325,10 +329,9 @@ class EeApp extends BaseApp {
|
|
|
325
329
|
* loading page
|
|
326
330
|
*/
|
|
327
331
|
_loadingPage(name) {
|
|
328
|
-
if (!
|
|
332
|
+
if (!UtilsHelper.fileIsExist(name)) {
|
|
329
333
|
return
|
|
330
334
|
}
|
|
331
|
-
|
|
332
335
|
this.mainWindow.loadFile(name);
|
|
333
336
|
}
|
|
334
337
|
|
package/html/index.js
ADDED
package/package.json
CHANGED
package/utils/helper.js
CHANGED
|
@@ -211,4 +211,11 @@ exports.getValueFromArgv = function(argv, key) {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
return value;
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
exports.fileIsExist = function(filepath) {
|
|
217
|
+
if (fs.existsSync(filepath) && fs.statSync(filepath).isFile()) {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
return false;
|
|
214
221
|
};
|