ee-core 1.0.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2 -0
  3. package/bin/tools.js +22 -0
  4. package/config/config.default.js +179 -0
  5. package/core/index.js +13 -0
  6. package/core/lib/ee.js +220 -0
  7. package/core/lib/loader/context_loader.js +105 -0
  8. package/core/lib/loader/ee_loader.js +427 -0
  9. package/core/lib/loader/file_loader.js +262 -0
  10. package/core/lib/loader/mixin/config.js +138 -0
  11. package/core/lib/loader/mixin/controller.js +123 -0
  12. package/core/lib/loader/mixin/service.js +29 -0
  13. package/core/lib/utils/base_context_class.js +34 -0
  14. package/core/lib/utils/index.js +100 -0
  15. package/core/lib/utils/sequencify.js +59 -0
  16. package/core/lib/utils/timing.js +77 -0
  17. package/index.js +50 -0
  18. package/lib/appLoader.js +45 -0
  19. package/lib/application.js +69 -0
  20. package/lib/baseApp.js +155 -0
  21. package/lib/constant.js +30 -0
  22. package/lib/eeApp.js +306 -0
  23. package/lib/helper.js +52 -0
  24. package/lib/httpclient.js +136 -0
  25. package/lib/logger.js +47 -0
  26. package/lib/socket/io.js +22 -0
  27. package/lib/socket/ipcServer.js +112 -0
  28. package/lib/socket/socketClient.js +51 -0
  29. package/lib/socket/socketServer.js +70 -0
  30. package/lib/socket/start.js +18 -0
  31. package/lib/storage/appStorage.js +14 -0
  32. package/lib/storage/index.js +22 -0
  33. package/lib/storage/lowdbStorage.js +144 -0
  34. package/package.json +39 -0
  35. package/resource/images/loding.gif +0 -0
  36. package/resource/images/tray_logo.png +0 -0
  37. package/resource/loading.html +22 -0
  38. package/resource/view_example.html +22 -0
  39. package/tools/codeCompress.js +202 -0
  40. package/tools/replaceDist.js +71 -0
  41. package/utils/index.js +141 -0
  42. package/utils/wrap.js +38 -0
@@ -0,0 +1,136 @@
1
+ 'use strict';
2
+
3
+ const Agent = require('agentkeepalive');
4
+ const HttpsAgent = require('agentkeepalive').HttpsAgent;
5
+ const urllib = require('urllib');
6
+ const ms = require('humanize-ms');
7
+ const { FrameworkBaseError } = require('egg-errors');
8
+
9
+ class HttpClientError extends FrameworkBaseError {
10
+ get module() {
11
+ return 'httpclient';
12
+ }
13
+ }
14
+
15
+ class HttpClient extends urllib.HttpClient2 {
16
+ constructor(app) {
17
+ normalizeConfig(app);
18
+ const config = app.config.httpclient;
19
+ super({
20
+ app,
21
+ defaultArgs: config.request,
22
+ agent: new Agent(config.httpAgent),
23
+ httpsAgent: new HttpsAgent(config.httpsAgent),
24
+ });
25
+ this.app = app;
26
+ }
27
+
28
+ request(url, args, callback) {
29
+ if (typeof args === 'function') {
30
+ callback = args;
31
+ args = null;
32
+ }
33
+
34
+ args = args || {};
35
+
36
+ // the callback style
37
+ if (callback) {
38
+ //this.app.deprecate('[httpclient] We now support async for this function, so callback isn\'t recommended.');
39
+ super.request(url, args)
40
+ .then(result => process.nextTick(() => callback(null, result.data, result.res)))
41
+ .catch(err => process.nextTick(() => callback(err)));
42
+ return;
43
+ }
44
+
45
+ // the Promise style
46
+ return super.request(url, args)
47
+ .catch(err => {
48
+ if (err.code === 'ENETUNREACH') {
49
+ throw HttpClientError.create(err.message, err.code);
50
+ }
51
+ throw err;
52
+ });
53
+ }
54
+
55
+ curl(url, args, callback) {
56
+ return this.request(url, args, callback);
57
+ }
58
+
59
+ requestThunk(url, args) {
60
+ //this.app.deprecate('[httpclient] Please use `request()` instead of `requestThunk()`');
61
+ return callback => {
62
+ this.request(url, args, (err, data, res) => {
63
+ if (err) {
64
+ return callback(err);
65
+ }
66
+ callback(null, {
67
+ data,
68
+ status: res.status,
69
+ headers: res.headers,
70
+ res,
71
+ });
72
+ });
73
+ };
74
+ }
75
+ }
76
+
77
+ function normalizeConfig(app) {
78
+ const config = app.config.httpclient;
79
+
80
+ // compatibility
81
+ if (typeof config.keepAlive === 'boolean') {
82
+ config.httpAgent.keepAlive = config.keepAlive;
83
+ config.httpsAgent.keepAlive = config.keepAlive;
84
+ }
85
+ if (config.timeout) {
86
+ config.timeout = ms(config.timeout);
87
+ config.httpAgent.timeout = config.timeout;
88
+ config.httpsAgent.timeout = config.timeout;
89
+ }
90
+ // compatibility httpclient.freeSocketKeepAliveTimeout => httpclient.freeSocketTimeout
91
+ if (config.freeSocketKeepAliveTimeout && !config.freeSocketTimeout) {
92
+ config.freeSocketTimeout = config.freeSocketKeepAliveTimeout;
93
+ delete config.freeSocketKeepAliveTimeout;
94
+ }
95
+ if (config.freeSocketTimeout) {
96
+ config.freeSocketTimeout = ms(config.freeSocketTimeout);
97
+ config.httpAgent.freeSocketTimeout = config.freeSocketTimeout;
98
+ config.httpsAgent.freeSocketTimeout = config.freeSocketTimeout;
99
+ } else {
100
+ // compatibility agent.freeSocketKeepAliveTimeout
101
+ if (config.httpAgent.freeSocketKeepAliveTimeout && !config.httpAgent.freeSocketTimeout) {
102
+ config.httpAgent.freeSocketTimeout = config.httpAgent.freeSocketKeepAliveTimeout;
103
+ delete config.httpAgent.freeSocketKeepAliveTimeout;
104
+ }
105
+ if (config.httpsAgent.freeSocketKeepAliveTimeout && !config.httpsAgent.freeSocketTimeout) {
106
+ config.httpsAgent.freeSocketTimeout = config.httpsAgent.freeSocketKeepAliveTimeout;
107
+ delete config.httpsAgent.freeSocketKeepAliveTimeout;
108
+ }
109
+ }
110
+
111
+ if (typeof config.maxSockets === 'number') {
112
+ config.httpAgent.maxSockets = config.maxSockets;
113
+ config.httpsAgent.maxSockets = config.maxSockets;
114
+ }
115
+ if (typeof config.maxFreeSockets === 'number') {
116
+ config.httpAgent.maxFreeSockets = config.maxFreeSockets;
117
+ config.httpsAgent.maxFreeSockets = config.maxFreeSockets;
118
+ }
119
+
120
+ if (config.httpAgent.timeout < 30000) {
121
+ app.coreLogger.warn('[ee:httpclient] config.httpclient.httpAgent.timeout(%s) can\'t below 30000, auto reset to 30000',
122
+ config.httpAgent.timeout);
123
+ config.httpAgent.timeout = 30000;
124
+ }
125
+ if (config.httpsAgent.timeout < 30000) {
126
+ app.coreLogger.warn('[ee:httpclient] config.httpclient.httpsAgent.timeout(%s) can\'t below 30000, auto reset to 30000',
127
+ config.httpsAgent.timeout);
128
+ config.httpsAgent.timeout = 30000;
129
+ }
130
+
131
+ if (typeof config.request.timeout === 'string') {
132
+ config.request.timeout = ms(config.request.timeout);
133
+ }
134
+ }
135
+
136
+ module.exports = HttpClient;
package/lib/logger.js ADDED
@@ -0,0 +1,47 @@
1
+ 'use strict';
2
+
3
+ const debug = require('debug')('ee-core:logger');
4
+ const Loggers = require('egg-logger').EggLoggers;
5
+ const assert = require('assert');
6
+
7
+ class Logger {
8
+ constructor (config) {
9
+ debug('Loaded logger');
10
+ assert(Object.keys(config).length != 0, `logger config is null`);
11
+ this.eggLogger = this.init(config);
12
+ }
13
+
14
+ /**
15
+ * 单例
16
+ */
17
+ static getInstance (config = {}) {
18
+ if (typeof this.instance === 'object') {
19
+ return this.instance.eggLogger;
20
+ }
21
+
22
+ this.instance = new Logger(config);
23
+
24
+ // 返回egg-logger实例
25
+ return this.instance.eggLogger;
26
+ }
27
+
28
+ /**
29
+ * 初始化模块
30
+ */
31
+ init(config) {
32
+ const loggerConfig = config.logger;
33
+ loggerConfig.type = 'application'; // application、agent
34
+
35
+ if (config.env === 'prod' && loggerConfig.level === 'DEBUG' && !loggerConfig.allowDebugAtProd) {
36
+ loggerConfig.level = 'INFO';
37
+ }
38
+
39
+ const loggers = new Loggers(config);
40
+
41
+ loggers.coreLogger.info('[ee-core:logger] init all loggers with options: %j', loggerConfig);
42
+
43
+ return loggers;
44
+ };
45
+ }
46
+
47
+ module.exports = Logger;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const IoServer = require('socket.io');
4
+ const IoClient = require('socket.io-client');
5
+ //const socketServer = require('./socketServer');
6
+ const socketClient = require('./socketClient');
7
+
8
+ const EeSocket = {
9
+ getServer: () => {
10
+ //return socketServer.getInstance();
11
+ },
12
+ getClient: () => {
13
+ return socketClient.getInstance();
14
+ }
15
+ }
16
+
17
+
18
+ module.exports = {
19
+ IoServer,
20
+ IoClient,
21
+ EeSocket
22
+ };
@@ -0,0 +1,112 @@
1
+ 'use strict';
2
+
3
+ const debug = require('debug')('ee-core:ipcServer');
4
+ const EggConsoleLogger = require('egg-logger').EggConsoleLogger;
5
+ const is = require('is-type-of');
6
+ const { ipcMain } = require('electron');
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+ const globby = require('globby');
10
+ const utils = require('../../core/lib/utils');
11
+ const wrap = require('../../utils/wrap');
12
+ const utility = require('utility');
13
+
14
+ class IpcServer {
15
+ constructor (app) {
16
+
17
+ this.app = app;
18
+ this.consoleLogger = new EggConsoleLogger();
19
+ this.consoleLogger.info('[ee-core:socket:ipcMain] start ipcMain');
20
+ this.register();
21
+ }
22
+
23
+ register () {
24
+ this.consoleLogger.info('[ee-core:socket:ipcMain] register channels');
25
+
26
+ const self = this;
27
+ // 遍历方法
28
+ const files = (process.env.EE_TYPESCRIPT === 'true' && utils.extensions['.ts'])
29
+ ? [ '**/*.(js|ts)', '!**/*.d.ts' ]
30
+ : [ '**/*.js' ];
31
+ const directory = path.join(this.app.config.baseDir, 'controller');
32
+ const filepaths = globby.sync(files, { cwd: directory });
33
+ for (const filepath of filepaths) {
34
+ const fullpath = path.join(directory, filepath);
35
+ if (!fs.statSync(fullpath).isFile()) continue;
36
+
37
+ const properties = wrap.getProperties(filepath, {caseStyle: 'lower'});
38
+ const pathName = directory.split(/[/\\]/).slice(-1) + '.' + properties.join('.');
39
+
40
+ let fileObj = utils.loadFile(fullpath);
41
+ const fns = {};
42
+ if (is.function(fileObj) && !is.generatorFunction(fileObj) && !is.class(fileObj) && !is.asyncFunction(fileObj)) {
43
+ //obj = obj(this.app);
44
+ }
45
+ if (is.class(fileObj)) {
46
+ let proto = fileObj.prototype;
47
+ //while (proto !== Object.prototype) {
48
+ const keys = Object.getOwnPropertyNames(proto);
49
+ for (const key of keys) {
50
+ if (key === 'constructor') {
51
+ continue;
52
+ }
53
+ const d = Object.getOwnPropertyDescriptor(proto, key);
54
+ if (is.function(d.value) && !fns.hasOwnProperty(key)) {
55
+ fns[key] = 1;
56
+ }
57
+ }
58
+ //proto = Object.getPrototypeOf(proto);
59
+ //}
60
+ }
61
+ if (is.object(fileObj)) {
62
+ const keys = Object.keys(fileObj);
63
+ for (const key of keys) {
64
+ if (is.function(fileObj[key])) {
65
+ const names = utility.getParamNames(fileObj[key]);
66
+ if (names[0] === 'next') {
67
+ throw new Error(`controller \`${prefix || ''}${key}\` should not use next as argument from file ${path}`);
68
+ }
69
+ fns[key] = 1;
70
+ }
71
+ // else if (is.object(fileObj[key])) {
72
+ // ret[key] = wrapObject(obj[key], path, `${prefix || ''}${key}.`);
73
+ // }
74
+ }
75
+ }
76
+ // if (is.generatorFunction(obj) || is.asyncFunction(obj)) {
77
+ // }
78
+
79
+ debug('register class %s fns %j', pathName, fns);
80
+
81
+ for (const key in fns) {
82
+ let channel = pathName + '.' + key;
83
+ debug('register channel %s', channel);
84
+ ipcMain.on(channel, async (event, params) => {
85
+ try {
86
+ // 找函数
87
+ const cmd = channel;
88
+ const args = params;
89
+ let fn = null;
90
+ if (is.string(cmd)) {
91
+ const actions = cmd.split('.');
92
+ let obj = self.app;
93
+ actions.forEach(key => {
94
+ obj = obj[key];
95
+ if (!obj) throw new Error(`class or function '${key}' not exists`);
96
+ });
97
+ fn = obj;
98
+ }
99
+ if (!fn) throw new Error('function not exists');
100
+
101
+ const result = await fn.call(self.app, args, event);
102
+ event.reply(`${channel}`, result)
103
+ } catch (err) {
104
+ self.app.logger.error('[ee:socket:ipcMain] throw error:', err);
105
+ }
106
+ })
107
+ }
108
+ }
109
+ }
110
+ }
111
+
112
+ module.exports = IpcServer;
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert');
4
+ const IoClient = require('socket.io-client');
5
+ const constant = require('../constant');
6
+ const EggConsoleLogger = require('egg-logger').EggConsoleLogger;
7
+
8
+ class SocketClient {
9
+ constructor (port) {
10
+ this.consoleLogger = new EggConsoleLogger();
11
+ port = port ? port : this.getIpcPort();
12
+
13
+ assert(typeof port === 'number', 'port required, and must be a number');
14
+ this.consoleLogger.info('[ee-core:socket:client] start client');
15
+
16
+ const url = 'http://127.0.0.1:' + port;
17
+ this.consoleLogger.info('[ee-core:socket:client] url:', url);
18
+ this.client = IoClient(url);
19
+ }
20
+
21
+ static getInstance (port) {
22
+ if (typeof this.instance === 'object') {
23
+ return this.instance;
24
+ }
25
+ this.instance = new SocketClient(port);
26
+ return this.instance;
27
+ }
28
+
29
+ call (method = '', ...params) {
30
+ return new Promise((resolve, reject) => {
31
+ // 获取通信频道
32
+ const channel = constant.socketIo.channel.eggIoEe;
33
+ this.client.emit(channel, { cmd: method, params: params }, (response) => {
34
+ resolve(response);
35
+ });
36
+ });
37
+ }
38
+
39
+ getCoreDB () {
40
+ const coreDB = require('../storage/index').JsonDB.connection('system');
41
+ return coreDB;
42
+ }
43
+
44
+ getIpcPort () {
45
+ const cdb = this.getCoreDB();
46
+ const port = cdb.getItem('ipc_port');
47
+ return port;
48
+ }
49
+ }
50
+
51
+ module.exports = SocketClient;
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert');
4
+ const { Server } = require('socket.io');
5
+ const constant = require('../constant');
6
+ const EggConsoleLogger = require('egg-logger').EggConsoleLogger;
7
+ const is = require('is-type-of');
8
+
9
+ /**
10
+ * 类文件,顶部new egglogger 后,出现代码无法正常加载
11
+ */
12
+ class SocketServer {
13
+ constructor (app) {
14
+ let port = process.env.EE_IPC_PORT ? parseInt(process.env.EE_IPC_PORT) : parseInt(this.getIpcPort());
15
+
16
+ assert(typeof port === 'number', 'port required, and must be a number');
17
+
18
+ this.app = app;
19
+ this.consoleLogger = new EggConsoleLogger();
20
+ this.consoleLogger.info('[ee-core:socket:server] start server, socket port is:', port);
21
+ this.io = new Server(port);
22
+ this.connec();
23
+ }
24
+
25
+ connec () {
26
+ this.consoleLogger.info('[ee-core:socket:server] connection .....');
27
+ this.io.on('connection', (socket) => {
28
+ const channel = constant.socketIo.channel.eggIoEe;
29
+ socket.on(channel, async (message, callback) => {
30
+ this.consoleLogger.info('[ee-core:socket:server] socket id:' + socket.id + ' message cmd: ' + message.cmd);
31
+
32
+ try {
33
+ // 找函数
34
+ const cmd = message.cmd;
35
+ const args = message.params;
36
+ let fn = null;
37
+ if (is.string(cmd)) {
38
+ const actions = cmd.split('.');
39
+ let obj = this.app;
40
+ actions.forEach(key => {
41
+ obj = obj[key];
42
+ if (!obj) throw new Error(`class or function '${key}' not exists`);
43
+ });
44
+ fn = obj;
45
+ }
46
+ if (!fn) throw new Error('function not exists');
47
+
48
+ const result = await fn.call(this.app, args);
49
+ callback(result);
50
+ } catch (err) {
51
+ this.app.logger.error('[ee:socket] throw error:', err);
52
+ }
53
+
54
+ });
55
+ });
56
+ }
57
+
58
+ getCoreDB () {
59
+ const coreDB = require('../storage/index').JsonDB.connection('system');
60
+ return coreDB;
61
+ }
62
+
63
+ getIpcPort () {
64
+ const cdb = this.getCoreDB();
65
+ const port = cdb.getItem('ipc_port');
66
+ return port;
67
+ }
68
+ }
69
+
70
+ module.exports = SocketServer;
@@ -0,0 +1,18 @@
1
+ 'use strict';
2
+
3
+ const socketServer = require('./socketServer');
4
+ const ipcServer = require('./ipcServer');
5
+
6
+ /**
7
+ * server
8
+ */
9
+ module.exports = (app) => {
10
+
11
+ // 启动 socket server
12
+ new socketServer(app);
13
+
14
+ // 启动 ipc server
15
+ new ipcServer(app);
16
+
17
+ }
18
+
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ class AppStorage {
4
+ constructor() {
5
+ const Storage = require('./storage');
6
+ const sObj = Storage.getInstance('appData');
7
+
8
+ for (const attr of sObj) {
9
+ Object.assign(UserStorage.prototype, attr);
10
+ }
11
+ }
12
+ }
13
+
14
+ module.exports = AppStorage;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ const JsonDB = {};
4
+
5
+ JsonDB.connection = function (database) {
6
+
7
+ // console.log('this::::::', this);
8
+ // todo
9
+ // if (typeof this.instance === 'object') {
10
+ // return this.instance;
11
+ // }
12
+
13
+ const LowdbStorage = require('./lowdbStorage');
14
+ const storage = new LowdbStorage(database);
15
+
16
+ // this.instance = storage;
17
+ return storage;
18
+ }
19
+
20
+ module.exports = {
21
+ JsonDB
22
+ };
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ const assert = require('assert');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const lowdb = require('lowdb');
7
+ const FileSync = require('lowdb/adapters/FileSync');
8
+ const _ = require('lodash');
9
+ const constant = require('../constant');
10
+
11
+ class LowdbStorage {
12
+ constructor (name, opt = {}) {
13
+ assert(name, `db name ${name} Cannot be empty`);
14
+
15
+ this.name = name;
16
+
17
+ // 数据库key列表
18
+ this.storageKey = constant.storageKey;
19
+
20
+ const storageDir = this.getStorageDir();
21
+ if (!fs.existsSync(storageDir)) {
22
+ this.mkdir(storageDir);
23
+ this.chmodPath(storageDir, '777');
24
+ }
25
+
26
+ this.db = this.table(name);
27
+ }
28
+
29
+ /**
30
+ * 创建 table
31
+ */
32
+ table (name) {
33
+ assert(name, 'table name is required');
34
+
35
+ const dbFile = this.getFilePath(name);
36
+ const adapter = new FileSync(dbFile);
37
+ const db = lowdb(adapter);
38
+
39
+ assert(fs.existsSync(dbFile), `error: storage ${dbFile} not exists`);
40
+
41
+ return db;
42
+ }
43
+
44
+ /**
45
+ * 获取db文件名
46
+ */
47
+ getFileName (name) {
48
+ return name + ".json";
49
+ }
50
+
51
+ /**
52
+ * 获取db文件名
53
+ */
54
+ getFilePath (name) {
55
+ const storageDir = this.getStorageDir();
56
+ const dbFile = path.join(storageDir, this.getFileName(name));
57
+ return dbFile;
58
+ }
59
+
60
+ /**
61
+ * 获取数据存储路径
62
+ */
63
+ getStorageDir () {
64
+ let env = process.env.EE_SERVER_ENV;
65
+ const appDir = env === 'local' || env === 'unittest' ? process.env.EE_HOME : process.env.EE_APP_USER_DATA;
66
+ const storageDir = path.join(appDir, 'data');
67
+ return storageDir;
68
+ }
69
+
70
+ /**
71
+ * 为指定的 name 设置一个对应的值
72
+ */
73
+ setItem (key, value) {
74
+ assert(_.isString(key), `key must be a string`);
75
+ assert(key.length != 0, `key cannot be empty`);
76
+ assert(!this.storageKey.hasOwnProperty(key), `${key} is not allowed`);
77
+
78
+ let cacheKey = this.storageKey.cache;
79
+ if (!this.db.has(cacheKey).value()) {
80
+ this.db.set(cacheKey, {}).write();
81
+ }
82
+
83
+ let keyId = cacheKey + "." + key;
84
+ this.db
85
+ .set(keyId, value)
86
+ .write();
87
+
88
+ return true;
89
+ }
90
+
91
+ /**
92
+ * 根据指定的名字 name 获取对应的值
93
+ */
94
+ getItem (key) {
95
+ assert(_.isString(key), `key must be a string`);
96
+ assert(key.length != 0, `key cannot be empty`);
97
+
98
+ let cacheKey = this.storageKey.cache;
99
+ let keyId = cacheKey + "." + key;
100
+ const data = this.db
101
+ .get(keyId)
102
+ .value();
103
+
104
+ return data;
105
+ }
106
+
107
+ mkdir (dirpath, dirname) {
108
+ if (typeof dirname === 'undefined') {
109
+ if (fs.existsSync(dirpath)) {
110
+ return;
111
+ }
112
+ this.mkdir(dirpath, path.dirname(dirpath));
113
+ } else {
114
+ if (dirname !== path.dirname(dirpath)) {
115
+ this.mkdir(dirpath);
116
+ return;
117
+ }
118
+ if (fs.existsSync(dirname)) {
119
+ fs.mkdirSync(dirpath);
120
+ } else {
121
+ this.mkdir(dirname, path.dirname(dirname));
122
+ fs.mkdirSync(dirpath);
123
+ }
124
+ }
125
+ };
126
+
127
+ chmodPath (path, mode) {
128
+ let files = [];
129
+ if (fs.existsSync(path)) {
130
+ files = fs.readdirSync(path);
131
+ files.forEach((file, index) => {
132
+ const curPath = path + '/' + file;
133
+ if (fs.statSync(curPath).isDirectory()) {
134
+ this.chmodPath(curPath, mode);
135
+ } else {
136
+ fs.chmodSync(curPath, mode);
137
+ }
138
+ });
139
+ fs.chmodSync(path, mode);
140
+ }
141
+ };
142
+ }
143
+
144
+ module.exports = LowdbStorage;
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "ee-core",
3
+ "version": "1.0.0",
4
+ "description": "electron-egg core",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "bin": {
12
+ "ee-cli": "bin/tools.js"
13
+ },
14
+ "dependencies": {
15
+ "agentkeepalive": "^4.2.0",
16
+ "egg-errors": "^2.3.0",
17
+ "egg-logger": "^2.7.1",
18
+ "electron-is": "^3.0.0",
19
+ "electron-updater": "^4.6.1",
20
+ "get-port": "^5.1.1",
21
+ "globby": "^10.0.0",
22
+ "humanize-ms": "^1.2.1",
23
+ "is-type-of": "^1.2.1",
24
+ "koa": "^2.13.4",
25
+ "koa-convert": "^2.0.0",
26
+ "lodash": "^4.17.21",
27
+ "lowdb": "^1.0.0",
28
+ "socket.io": "^4.4.1",
29
+ "socket.io-client": "^4.4.1",
30
+ "unzip-crx-3": "^0.2.0",
31
+ "urllib": "^2.38.0",
32
+ "utility": "^1.17.0"
33
+ },
34
+ "devDependencies": {
35
+ "debug": "^4.3.3",
36
+ "fs-extra": "^10.0.0",
37
+ "uglify-js": "^3.14.5"
38
+ }
39
+ }
Binary file
Binary file