ee-core 1.2.3 → 1.2.4

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.
@@ -224,5 +224,12 @@ module.exports = appInfo => {
224
224
  port: 7072, // 默认端口(如果端口被使用,则随机获取一个)
225
225
  };
226
226
 
227
+ /**
228
+ * 应用程序顶部菜单
229
+ * boolean | string
230
+ * true, false, 'dev-show'(dev环境显示,prod环境隐藏)
231
+ */
232
+ config.openAppMenu = true;
233
+
227
234
  return config;
228
235
  };
@@ -29,10 +29,14 @@ class Appliaction extends EeApp {
29
29
  }
30
30
 
31
31
  // argv
32
+ let hotReload = false;
32
33
  for (let i = 0; i < process.argv.length; i++) {
33
34
  const tmpArgv = process.argv[i]
34
35
  if (tmpArgv.indexOf('--env=') !== -1) {
35
- options.env = tmpArgv.substring(6)
36
+ options.env = tmpArgv.substring(6);
37
+ }
38
+ if (tmpArgv.indexOf('--hot-reload=') !== -1) {
39
+ hotReload = tmpArgv.substring(13) == 1 ? true : false;
36
40
  }
37
41
  }
38
42
 
@@ -52,7 +56,7 @@ class Appliaction extends EeApp {
52
56
  env.EE_MAIN_PORT = null;
53
57
  env.EE_SOCKET_PORT = null;
54
58
  env.EE_HTTP_PORT = null;
55
- env.EGG_SERVER_ENV = options.env;
59
+ env.HOT_RELOAD = hotReload;
56
60
  debug('options:%j', options)
57
61
 
58
62
  super(options);
@@ -70,7 +74,7 @@ class Appliaction extends EeApp {
70
74
 
71
75
  await this.createElectronApp();
72
76
 
73
- this.catchLog();
77
+ await this.catchLog();
74
78
  }
75
79
  }
76
80
 
package/lib/eeApp.js CHANGED
@@ -84,7 +84,6 @@ class EeApp extends BaseApp {
84
84
  app.on('before-quit', () => {
85
85
  self.electron.extra.closeWindow = true;
86
86
  })
87
-
88
87
  await this.electronAppReady();
89
88
  }
90
89
 
@@ -95,9 +94,14 @@ class EeApp extends BaseApp {
95
94
  const winOptions = this.config.windowsOption;
96
95
  this.electron.mainWindow = new BrowserWindow(winOptions);
97
96
 
98
- // 隐藏菜单
99
- if (!this.config.openAppMenu) {
97
+ // 菜单显示/隐藏
98
+ if (this.config.openAppMenu === 'dev-show'
99
+ && this.config.env == 'prod') {
100
+ Menu.setApplicationMenu(null);
101
+ } else if (this.config.openAppMenu === false) {
100
102
  Menu.setApplicationMenu(null);
103
+ } else {
104
+ // nothing
101
105
  }
102
106
 
103
107
  this.loadingView(winOptions);
@@ -292,17 +296,12 @@ class EeApp extends BaseApp {
292
296
  /**
293
297
  * 捕获异常
294
298
  */
295
- catchLog () {
299
+ async catchLog () {
296
300
  const self = this;
301
+
297
302
  process.on('uncaughtException', function(err) {
298
303
  self.logger.error(err);
299
304
  });
300
-
301
- // process.on('SIGINT', function () {
302
- // console.log('Exit now!');
303
- // self.appQuit();
304
- // process.exit();
305
- // });
306
305
  }
307
306
 
308
307
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {