ee-core 1.1.8 → 1.1.9
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/lib/eeApp.js +3 -3
- package/lib/socket/io.js +3 -1
- package/package.json +1 -1
- package/utils/index.js +29 -0
package/lib/eeApp.js
CHANGED
|
@@ -26,8 +26,8 @@ class EeApp extends BaseApp {
|
|
|
26
26
|
|
|
27
27
|
process.env.EE_SOCKET_PORT = socketPort;
|
|
28
28
|
process.env.EE_WEB_PORT = webPort;
|
|
29
|
-
this.coreLogger.info('[ee-core:EeApp] [createPorts] socket port:', socketPort);
|
|
30
|
-
this.coreLogger.info('[ee-core:EeApp] [createPorts] web port:', webPort);
|
|
29
|
+
//this.coreLogger.info('[ee-core:EeApp] [createPorts] socket port:', socketPort);
|
|
30
|
+
//this.coreLogger.info('[ee-core:EeApp] [createPorts] web port:', webPort);
|
|
31
31
|
|
|
32
32
|
// 更新db配置
|
|
33
33
|
this.config.socketServer.port = socketPort;
|
|
@@ -206,7 +206,7 @@ class EeApp extends BaseApp {
|
|
|
206
206
|
* 主页面
|
|
207
207
|
*/
|
|
208
208
|
loadMainUrl (type, url) {
|
|
209
|
-
this.logger.info('main page is env: %s, type: %s,
|
|
209
|
+
this.logger.info('main page is env: %s, type: %s, App running at: %s', this.config.env, type, url);
|
|
210
210
|
this.electron.mainWindow.loadURL(url);
|
|
211
211
|
}
|
|
212
212
|
|
package/lib/socket/io.js
CHANGED
|
@@ -4,6 +4,7 @@ const IoServer = require('socket.io');
|
|
|
4
4
|
const IoClient = require('socket.io-client');
|
|
5
5
|
//const socketServer = require('./socketServer');
|
|
6
6
|
const socketClient = require('./socketClient');
|
|
7
|
+
const Koa = require('koa');
|
|
7
8
|
|
|
8
9
|
const EeSocket = {
|
|
9
10
|
getServer: () => {
|
|
@@ -18,5 +19,6 @@ const EeSocket = {
|
|
|
18
19
|
module.exports = {
|
|
19
20
|
IoServer,
|
|
20
21
|
IoClient,
|
|
21
|
-
EeSocket
|
|
22
|
+
EeSocket,
|
|
23
|
+
Koa
|
|
22
24
|
};
|
package/package.json
CHANGED
package/utils/index.js
CHANGED
|
@@ -8,6 +8,9 @@ const is = require('is-type-of');
|
|
|
8
8
|
const co = require('co');
|
|
9
9
|
const utility = require('utility');
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* 创建文件夹
|
|
13
|
+
*/
|
|
11
14
|
exports.mkdir = function(dirpath, dirname) {
|
|
12
15
|
// 判断是否是第一次调用
|
|
13
16
|
if (typeof dirname === 'undefined') {
|
|
@@ -30,6 +33,9 @@ exports.mkdir = function(dirpath, dirname) {
|
|
|
30
33
|
}
|
|
31
34
|
};
|
|
32
35
|
|
|
36
|
+
/**
|
|
37
|
+
* 修改文件权限
|
|
38
|
+
*/
|
|
33
39
|
exports.chmodPath = function(path, mode) {
|
|
34
40
|
let files = [];
|
|
35
41
|
if (fs.existsSync(path)) {
|
|
@@ -131,6 +137,29 @@ exports.getSocketChannel = function() {
|
|
|
131
137
|
return constant.socketIo.channel;
|
|
132
138
|
}
|
|
133
139
|
|
|
140
|
+
/**
|
|
141
|
+
* 获取 额外资源目录
|
|
142
|
+
*/
|
|
143
|
+
exports.getExtraResourcesDir = function() {
|
|
144
|
+
const cdb = this.getCoreDB();
|
|
145
|
+
const config = cdb.getItem('config');
|
|
146
|
+
const execDir = config.execDir;
|
|
147
|
+
|
|
148
|
+
// 资源路径不同
|
|
149
|
+
let dir = '';
|
|
150
|
+
if (config.isPackaged) {
|
|
151
|
+
// 打包后 execDir为 应用程序 exe\dmg\dep软件所在目录;打包前该值是项目根目录
|
|
152
|
+
dir = path.join(execDir, "resources", "extraResources");
|
|
153
|
+
} else {
|
|
154
|
+
// 打包前
|
|
155
|
+
dir = path.join(execDir, "build", "extraResources");
|
|
156
|
+
}
|
|
157
|
+
return dir;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* 执行一个函数
|
|
162
|
+
*/
|
|
134
163
|
exports.callFn = async function (fn, args, ctx) {
|
|
135
164
|
args = args || [];
|
|
136
165
|
if (!is.function(fn)) return;
|