alemonjs 2.1.93 → 2.1.94
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.
|
@@ -4,7 +4,11 @@ import { join, dirname } from 'path';
|
|
|
4
4
|
import { existsSync } from 'fs';
|
|
5
5
|
import { ResultCode } from '../../../common/variable.js';
|
|
6
6
|
import { registerRuntimeApp } from '../store.js';
|
|
7
|
+
import module$1 from 'module';
|
|
7
8
|
|
|
9
|
+
const initRequire = () => { };
|
|
10
|
+
initRequire.resolve = () => '';
|
|
11
|
+
const require$1 = module$1?.createRequire?.(import.meta.url) ?? initRequire;
|
|
8
12
|
const loadApps = () => {
|
|
9
13
|
const cfg = getConfig();
|
|
10
14
|
const apps = Array.isArray(cfg.value?.apps)
|
|
@@ -33,7 +37,7 @@ const run = async (input) => {
|
|
|
33
37
|
if (!existsSync(mainPath)) {
|
|
34
38
|
logger.warn({
|
|
35
39
|
code: ResultCode.Warn,
|
|
36
|
-
message: '
|
|
40
|
+
message: '未找到指定的主应用入口文件,但不影响继续运行',
|
|
37
41
|
data: null
|
|
38
42
|
});
|
|
39
43
|
return;
|
|
@@ -49,8 +53,16 @@ const run = async (input) => {
|
|
|
49
53
|
await loadChildren(mainPath, 'main');
|
|
50
54
|
};
|
|
51
55
|
async function loadModels() {
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
if (!process.env.input) {
|
|
57
|
+
const pkgPath = join(process.cwd(), 'package.json');
|
|
58
|
+
if (existsSync(pkgPath)) {
|
|
59
|
+
const pkg = require$1(pkgPath) ?? {};
|
|
60
|
+
if (pkg?.main) {
|
|
61
|
+
process.env.input = pkg.main;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
await run(process.env.input ?? '');
|
|
54
66
|
await loadApps();
|
|
55
67
|
}
|
|
56
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alemonjs",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.94",
|
|
4
4
|
"description": "bot script",
|
|
5
5
|
"author": "lemonade",
|
|
6
6
|
"license": "MIT",
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"type": "git",
|
|
88
88
|
"url": "https://github.com/lemonade-lab/alemonjs.git"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "edc7f9c5c75f4f5eaf527bb1dfdb31882bde6d6c"
|
|
91
91
|
}
|