-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (30 loc) · 1004 Bytes
/
index.js
File metadata and controls
38 lines (30 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import chalk from 'chalk';
import Version from './lib/system/version.js';
import fc from './components/json.js';
import Path from './constants/path.js';
import { crystelfInit } from './lib/system/init.js';
import updater from './lib/system/updater.js';
logger.info(
chalk.rgb(134, 142, 204)(`crystelf-admin ${Version.ver} 初始化~ by ${Version.author}`)
);
updater.checkAndUpdate().catch((err) => {
logger.err(err);
});
//不要加await!!!
crystelfInit.CSH().then(logger.mark('[crystelf-admin] crystelf-admin 完成初始化'));
const appPath = Path.apps;
const jsFiles = await fc.readDirRecursive(appPath, 'js');
let ret = jsFiles.map((file) => {
return import(`./apps/${file}`);
});
ret = await Promise.allSettled(ret);
let apps = {};
for (let i in jsFiles) {
let name = jsFiles[i].replace('.js', '');
if (ret[i].status !== 'fulfilled') {
logger.error(name, ret[i].reason);
continue;
}
apps[name] = ret[i].value[Object.keys(ret[i].value)[0]];
}
export { apps };