node-karin 0.10.1 → 0.10.3
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/cli/init.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { KarinCfgInit } from '../core/init/config.js'
|
|
3
3
|
/**
|
|
4
4
|
* 休眠函数
|
|
5
5
|
* @param ms 毫秒
|
|
@@ -11,7 +11,7 @@ async function main () {
|
|
|
11
11
|
/** 捕获错误 打印日志 */
|
|
12
12
|
process.on('uncaughtException', err => console.error(err))
|
|
13
13
|
process.on('unhandledRejection', err => console.error(err))
|
|
14
|
-
const init = new
|
|
14
|
+
const init = new KarinCfgInit()
|
|
15
15
|
init.init()
|
|
16
16
|
await sleep(1000)
|
|
17
17
|
const pkg = init.getRegistry()
|
package/lib/cli/karin.js
CHANGED
|
@@ -6,7 +6,7 @@ import axios from 'axios'
|
|
|
6
6
|
import { fileURLToPath } from 'url'
|
|
7
7
|
import { program } from 'commander'
|
|
8
8
|
import { exec as execCmd, spawn } from 'child_process'
|
|
9
|
-
import {
|
|
9
|
+
import { KarinCfgInit } from '../core/init/config.js'
|
|
10
10
|
class KarinCli {
|
|
11
11
|
child
|
|
12
12
|
filename
|
|
@@ -194,7 +194,7 @@ class KarinCli {
|
|
|
194
194
|
let cmd = ''
|
|
195
195
|
const list = Object.keys(this.pkg(false).dependencies).filter(key => !pkgdependencies.includes(key))
|
|
196
196
|
/** 获取包管理器 */
|
|
197
|
-
const pkg = new
|
|
197
|
+
const pkg = new KarinCfgInit().getRegistry()
|
|
198
198
|
switch (pkg) {
|
|
199
199
|
case 'pnpm': {
|
|
200
200
|
cmd = 'pnpm update'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { exec } from 'child_process';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/** 必须详细指向根文件 否则会导致模块乱导入 */
|
|
5
|
+
import { karinDir } from '../../core/init/dir.js';
|
|
6
|
+
export class KarinCfgInit {
|
|
6
7
|
/**
|
|
7
8
|
* 基础目录
|
|
8
9
|
*/
|
|
@@ -156,7 +156,7 @@ export class EventBaseHandler {
|
|
|
156
156
|
request.message_id = Res.message_id || '';
|
|
157
157
|
request.message_time = Res.message_time || Date.now();
|
|
158
158
|
request.raw_data = Res.raw_data || undefined;
|
|
159
|
-
logger.bot('debug', this.e.self_id, `回复消息结果:${JSON.stringify(
|
|
159
|
+
logger.bot('debug', this.e.self_id, `回复消息结果:${JSON.stringify(request)}`);
|
|
160
160
|
}
|
|
161
161
|
catch (error) {
|
|
162
162
|
logger.bot('error', this.e.self_id, `回复消息失败:${ReplyLog}`);
|
|
@@ -231,8 +231,8 @@ export const config = new (class Cfg {
|
|
|
231
231
|
if (res) {
|
|
232
232
|
const cfg = { ...res.defCfg.default, ...res.Config.default };
|
|
233
233
|
for (const k of keys) {
|
|
234
|
-
if (res[k])
|
|
235
|
-
return { ...cfg, ...res[k] };
|
|
234
|
+
if (res.config[k])
|
|
235
|
+
return { ...cfg, ...res.config[k] };
|
|
236
236
|
}
|
|
237
237
|
return cfg;
|
|
238
238
|
}
|