ee-core 4.1.0 → 4.1.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.
- package/app/boot.js +9 -2
- package/package.json +1 -1
- package/ps/index.d.ts +3 -1
- package/ps/index.js +26 -7
package/app/boot.js
CHANGED
|
@@ -4,7 +4,7 @@ const debug = require('debug')('ee-core:app:boot');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { loadException } = require('../exception');
|
|
6
6
|
const { electronApp } = require('../electron/app');
|
|
7
|
-
const { getArgumentByName, getBundleDir } = require('../ps');
|
|
7
|
+
const { getArgumentByName, getBundleDir, getElectronCodeDir } = require('../ps');
|
|
8
8
|
const { loadConfig } = require('../config');
|
|
9
9
|
const { loadLog } = require('../log');
|
|
10
10
|
const { app } = require('./application');
|
|
@@ -15,11 +15,18 @@ class ElectronEgg {
|
|
|
15
15
|
const baseDir = electronApp.getAppPath();
|
|
16
16
|
const { env } = process;
|
|
17
17
|
const environmet = getArgumentByName('env') || 'prod';
|
|
18
|
+
const debugging = getArgumentByName('debuger') == 'true'? true : false;
|
|
19
|
+
|
|
20
|
+
// Debugging source code
|
|
21
|
+
let electronDir = getBundleDir(baseDir);
|
|
22
|
+
if (debugging) {
|
|
23
|
+
electronDir = getElectronCodeDir(baseDir);
|
|
24
|
+
}
|
|
18
25
|
|
|
19
26
|
const options = {
|
|
20
27
|
env: environmet,
|
|
21
28
|
baseDir,
|
|
22
|
-
electronDir
|
|
29
|
+
electronDir,
|
|
23
30
|
appName: electronApp.getName(),
|
|
24
31
|
userHome: electronApp.getPath('home'),
|
|
25
32
|
appData: electronApp.getPath('appData'),
|
package/package.json
CHANGED
package/ps/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export declare function appVersion(): string;
|
|
|
11
11
|
export declare function getDataDir(): string;
|
|
12
12
|
export declare function getLogDir(): string;
|
|
13
13
|
export declare function getBundleDir(basePath: string): string;
|
|
14
|
+
export declare function getElectronCodeDir(basePath: string): string;
|
|
15
|
+
export declare function getFrontendCodeDir(basePath: string): string;
|
|
14
16
|
export declare function getRootDir(): string;
|
|
15
17
|
export declare function getBaseDir(): string;
|
|
16
18
|
export declare function getElectronDir(): string;
|
|
@@ -34,4 +36,4 @@ export declare function makeMessage(msg?: {}): {
|
|
|
34
36
|
export declare function exitChildJob(code?: number): void;
|
|
35
37
|
export declare function isChildJob(): boolean;
|
|
36
38
|
export declare function isChildPoolJob(): boolean;
|
|
37
|
-
export declare function getArgumentByName(name: string): string;
|
|
39
|
+
export declare function getArgumentByName(name: string, args?: any): string;
|
package/ps/index.js
CHANGED
|
@@ -90,10 +90,18 @@ function getBundleDir(basePath) {
|
|
|
90
90
|
return dir;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
// 获取
|
|
94
|
-
function
|
|
95
|
-
const
|
|
96
|
-
|
|
93
|
+
// 获取electron 源码文件路径
|
|
94
|
+
function getElectronCodeDir(basePath) {
|
|
95
|
+
const base = basePath || process.cwd();
|
|
96
|
+
const dir = path.join(base, 'electron');
|
|
97
|
+
return dir;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// 获取frontend 源码文件路径
|
|
101
|
+
function getFrontendCodeDir(basePath) {
|
|
102
|
+
const base = basePath || process.cwd();
|
|
103
|
+
const dir = path.join(base, 'frontend');
|
|
104
|
+
return dir;
|
|
97
105
|
}
|
|
98
106
|
|
|
99
107
|
// 获取base目录
|
|
@@ -133,6 +141,12 @@ function getExtraResourcesDir() {
|
|
|
133
141
|
return dir;
|
|
134
142
|
}
|
|
135
143
|
|
|
144
|
+
// 获取root目录 (dev-项目根目录,pro-app user data目录)
|
|
145
|
+
function getRootDir() {
|
|
146
|
+
const appDir = isDev() ? getBaseDir() : getAppUserDataDir();
|
|
147
|
+
return appDir;
|
|
148
|
+
}
|
|
149
|
+
|
|
136
150
|
// 获取 appUserData目录
|
|
137
151
|
function getAppUserDataDir() {
|
|
138
152
|
return process.env.EE_APP_USER_DATA;
|
|
@@ -230,9 +244,12 @@ function isChildPoolJob() {
|
|
|
230
244
|
}
|
|
231
245
|
|
|
232
246
|
// Get cmd parameter by name
|
|
233
|
-
function getArgumentByName(name) {
|
|
234
|
-
|
|
235
|
-
|
|
247
|
+
function getArgumentByName(name, args) {
|
|
248
|
+
if (!args) {
|
|
249
|
+
args = process.argv;
|
|
250
|
+
}
|
|
251
|
+
for (let i = 0; i < args.length; i++) {
|
|
252
|
+
const item = args[i];
|
|
236
253
|
const prefixKey = `--${name}=`;
|
|
237
254
|
if (item.indexOf(prefixKey) !== -1) {
|
|
238
255
|
return item.substring(prefixKey.length);
|
|
@@ -254,6 +271,8 @@ module.exports = {
|
|
|
254
271
|
getDataDir,
|
|
255
272
|
getLogDir,
|
|
256
273
|
getBundleDir,
|
|
274
|
+
getElectronCodeDir,
|
|
275
|
+
getFrontendCodeDir,
|
|
257
276
|
getRootDir,
|
|
258
277
|
getBaseDir,
|
|
259
278
|
getElectronDir,
|