ee-core 2.2.2 → 2.2.3-beta.1

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.
@@ -198,6 +198,30 @@ module.exports = appInfo => {
198
198
  },
199
199
  };
200
200
 
201
+ /**
202
+ * 应用模式配置
203
+ */
204
+ config.developmentMode = {
205
+ default: 'vue',
206
+ mode: {
207
+ vue: {
208
+ protocol: 'http://',
209
+ hostname: 'localhost',
210
+ port: 8080
211
+ },
212
+ react: {
213
+ protocol: 'http://',
214
+ hostname: 'localhost',
215
+ port: 3000
216
+ },
217
+ html: {
218
+ protocol: 'http://',
219
+ hostname: 'localhost',
220
+ indexPage: 'index.html'
221
+ },
222
+ }
223
+ };
224
+
201
225
  /* 内置socket服务 */
202
226
  config.socketServer = {
203
227
  enable: false, // 是否启用
@@ -238,7 +262,8 @@ module.exports = appInfo => {
238
262
 
239
263
  /* 主进程加载的地址 */
240
264
  config.mainServer = {
241
- protocol: 'http://',
265
+ protocol: 'http://', // http:// | https:// | file://
266
+ indexPath: '/public/dist/index.html',
242
267
  host: 'localhost',
243
268
  port: 7072, // 默认端口(如果端口被使用,则随机获取一个)
244
269
  options: {},
package/config/index.js CHANGED
@@ -49,6 +49,26 @@ const Cfg = {
49
49
 
50
50
  return v;
51
51
  },
52
+
53
+ /**
54
+ * isFileProtocol
55
+ */
56
+ isFileProtocol(config) {
57
+ if (config.protocol == 'file://') {
58
+ return true;
59
+ }
60
+ return false;
61
+ },
62
+
63
+ /**
64
+ * isWebProtocol
65
+ */
66
+ isWebProtocol(config) {
67
+ if (['http://', 'https://'].includes(config.protocol)) {
68
+ return true;
69
+ }
70
+ return false;
71
+ },
52
72
  };
53
73
 
54
74
  module.exports = Cfg;
package/ee/eeApp.js CHANGED
@@ -28,7 +28,7 @@ class EeApp extends BaseApp {
28
28
  * 生成端口
29
29
  */
30
30
  async createPorts() {
31
- if (Ps.isFrameworkMode()) {
31
+ if (Ps.isFrameworkMode() && Conf.isWebProtocol(this.config.mainServer)) {
32
32
  const mainPort = await GetPort({port: this.config.mainServer.port});
33
33
  process.env.EE_MAIN_PORT = mainPort;
34
34
  this.config.mainServer.port = mainPort;
@@ -118,9 +118,16 @@ class EeApp extends BaseApp {
118
118
  }
119
119
 
120
120
  // 单页应用
121
- const protocol = modeInfo.protocol || 'http://';
122
- url = protocol + modeInfo.hostname + ':' + modeInfo.port;
121
+ // 开发环境
123
122
  if (Ps.isDev()) {
123
+ url = modeInfo.protocol + modeInfo.hostname + ':' + modeInfo.port;
124
+ this.loadMainUrl('spa', url);
125
+ return;
126
+ }
127
+ // 生产环境
128
+ const mainServer = this.config.mainServer;
129
+ if (Conf.isFileProtocol(mainServer)) {
130
+ url = path.join(this.config.homeDir, mainServer.indexPath);
124
131
  this.loadMainUrl('spa', url);
125
132
  } else {
126
133
  this.loadLocalWeb('spa');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "2.2.2",
3
+ "version": "2.2.3-beta.1",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {