node-karin 1.0.3 → 1.0.8
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/CHANGELOG.md +56 -0
- package/dist/cli/index.cjs +5 -0
- package/dist/cli/index.js +5 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +12 -4
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## [1.0.8](https://github.com/KarinJS/Karin/compare/core-v1.0.7...core-v1.0.8) (2025-01-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### 🐛 Bug Fixes
|
|
7
|
+
|
|
8
|
+
* close [#217](https://github.com/KarinJS/Karin/issues/217) [#215](https://github.com/KarinJS/Karin/issues/215) ([75e9ea7](https://github.com/KarinJS/Karin/commit/75e9ea7268082fce53862bdca2f4156a3210039b))
|
|
9
|
+
* fix 215 ([036f40d](https://github.com/KarinJS/Karin/commit/036f40da34d599d5b5cc6e184c009bb09fa3d80b))
|
|
10
|
+
|
|
11
|
+
## [1.0.7](https://github.com/KarinJS/Karin/compare/core-v1.0.6...core-v1.0.7) (2025-01-15)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### 🐛 Bug Fixes
|
|
15
|
+
|
|
16
|
+
* build types error ([f732ca3](https://github.com/KarinJS/Karin/commit/f732ca38155f08adefed7a9f8d42d373a9fc9cc7))
|
|
17
|
+
* ci ([1d25234](https://github.com/KarinJS/Karin/commit/1d252344a1384314bab30e663be019c6d2536317))
|
|
18
|
+
* ci ([56b3823](https://github.com/KarinJS/Karin/commit/56b382335d63577078e5aa8572d6238c63caf3e9))
|
|
19
|
+
* registerBot ws_client ([a9d7905](https://github.com/KarinJS/Karin/commit/a9d7905b5c0c739eb1e8c64beafb658a3c12c64d))
|
|
20
|
+
* test ci ([e998b9d](https://github.com/KarinJS/Karin/commit/e998b9de51941141d842c1e6032fdc6c721efdf8))
|
|
21
|
+
* test ci ([d2c0771](https://github.com/KarinJS/Karin/commit/d2c077180e0f495dd5918a2cb2f0c51683192c0c))
|
|
22
|
+
* test ci ([437350f](https://github.com/KarinJS/Karin/commit/437350f3376af7bc7f3fca6e51e8c6d846f1d798))
|
|
23
|
+
* tips ([9f67525](https://github.com/KarinJS/Karin/commit/9f67525d592094532a3a29fe1f3de41bc1ec1936))
|
|
24
|
+
* version ([1b15d0b](https://github.com/KarinJS/Karin/commit/1b15d0b6c1583a8abc674b97cd746aac97b918c1))
|
|
25
|
+
* 导出 ([33b0683](https://github.com/KarinJS/Karin/commit/33b06831c3c4e6679edb3353962d88d7e2cb4d9b))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### 🎫 Chores
|
|
29
|
+
|
|
30
|
+
* release main ([#219](https://github.com/KarinJS/Karin/issues/219)) ([bfe073f](https://github.com/KarinJS/Karin/commit/bfe073fa5af28364f12e3143bf3aab612cd87c59))
|
|
31
|
+
* release main ([#220](https://github.com/KarinJS/Karin/issues/220)) ([9cb7b59](https://github.com/KarinJS/Karin/commit/9cb7b59d003a1a3582d222413056af1d8ce5b13a))
|
|
32
|
+
* release main ([#221](https://github.com/KarinJS/Karin/issues/221)) ([0c871c5](https://github.com/KarinJS/Karin/commit/0c871c58b3fc26d5cb66b0d2f6e33a0c3bef4bb9))
|
|
33
|
+
* release main ([#224](https://github.com/KarinJS/Karin/issues/224)) ([abdf414](https://github.com/KarinJS/Karin/commit/abdf4149a171f8c9c58ea9f8d4cf7705690e1941))
|
|
34
|
+
* release main ([#225](https://github.com/KarinJS/Karin/issues/225)) ([4343d8d](https://github.com/KarinJS/Karin/commit/4343d8dab7f58f5c913345ee818d19ad14ebac48))
|
|
35
|
+
* release main ([#226](https://github.com/KarinJS/Karin/issues/226)) ([bedfe6a](https://github.com/KarinJS/Karin/commit/bedfe6a98d4637b59d0752565d353caf4a776251))
|
|
36
|
+
* **release:** node-karin 1.0.1 [skip-ci] ([#218](https://github.com/KarinJS/Karin/issues/218)) ([f3ce8b7](https://github.com/KarinJS/Karin/commit/f3ce8b7d0e7ad19ebe96a97e818e8aa4c52130c7))
|
|
37
|
+
|
|
38
|
+
## [1.0.6](https://github.com/KarinJS/Karin/compare/node-karin-v1.0.5...node-karin-v1.0.6) (2025-01-15)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### 🐛 Bug Fixes
|
|
42
|
+
|
|
43
|
+
* test ci ([e998b9d](https://github.com/KarinJS/Karin/commit/e998b9de51941141d842c1e6032fdc6c721efdf8))
|
|
44
|
+
|
|
45
|
+
## [1.0.5](https://github.com/KarinJS/Karin/compare/node-karin-v1.0.4...node-karin-v1.0.5) (2025-01-15)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### 🐛 Bug Fixes
|
|
49
|
+
|
|
50
|
+
* test ci ([d2c0771](https://github.com/KarinJS/Karin/commit/d2c077180e0f495dd5918a2cb2f0c51683192c0c))
|
|
51
|
+
|
|
52
|
+
## [1.0.4](https://github.com/KarinJS/Karin/compare/node-karin-v1.0.3...node-karin-v1.0.4) (2025-01-15)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### 🐛 Bug Fixes
|
|
56
|
+
|
|
57
|
+
* test ci ([437350f](https://github.com/KarinJS/Karin/commit/437350f3376af7bc7f3fca6e51e8c6d846f1d798))
|
|
58
|
+
|
|
3
59
|
## [1.0.3](https://github.com/KarinJS/Karin/compare/node-karin-v1.0.2...node-karin-v1.0.3) (2025-01-15)
|
|
4
60
|
|
|
5
61
|
|
package/dist/cli/index.cjs
CHANGED
|
@@ -87,11 +87,15 @@ var stop = () => {
|
|
|
87
87
|
process.exit(0);
|
|
88
88
|
};
|
|
89
89
|
var restart = () => {
|
|
90
|
+
console.log("[pm2] \u91CD\u542F\u4E2D...");
|
|
90
91
|
if (!fs2__default.default.existsSync(pm2Dir)) {
|
|
91
92
|
console.log(`[pm2] \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728 \u8BF7\u68C0\u67E5 ${pm2Dir} \u662F\u5426\u5B58\u5728`);
|
|
92
93
|
console.log("[pm2] \u5982\u679C\u662F\u65B0\u9879\u76EE\uFF0C\u8BF7\u5148\u524D\u53F0\u542F\u52A8\u751F\u6210\u914D\u7F6E\u6587\u4EF6: pnpm app");
|
|
93
94
|
process.exit(1);
|
|
94
95
|
}
|
|
96
|
+
execSync(`pm2 restart ${pm2Dir}`, { cwd: process.cwd() });
|
|
97
|
+
console.log("[pm2] \u91CD\u542F\u6210\u529F");
|
|
98
|
+
process.exit(0);
|
|
95
99
|
};
|
|
96
100
|
var pm2 = {
|
|
97
101
|
start,
|
|
@@ -259,6 +263,7 @@ var modifyPackageJson = () => {
|
|
|
259
263
|
const pkg = fs2__default.default.readFileSync(path2__default.default.join(dir, "package.json"), "utf-8");
|
|
260
264
|
const data = JSON.parse(pkg);
|
|
261
265
|
data.type = "module";
|
|
266
|
+
if (!data.scripts) data.scripts = {};
|
|
262
267
|
data.scripts.karin = "karin";
|
|
263
268
|
const list = [
|
|
264
269
|
"app",
|
package/dist/cli/index.js
CHANGED
|
@@ -78,11 +78,15 @@ var stop = () => {
|
|
|
78
78
|
process.exit(0);
|
|
79
79
|
};
|
|
80
80
|
var restart = () => {
|
|
81
|
+
console.log("[pm2] \u91CD\u542F\u4E2D...");
|
|
81
82
|
if (!fs2.existsSync(pm2Dir)) {
|
|
82
83
|
console.log(`[pm2] \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728 \u8BF7\u68C0\u67E5 ${pm2Dir} \u662F\u5426\u5B58\u5728`);
|
|
83
84
|
console.log("[pm2] \u5982\u679C\u662F\u65B0\u9879\u76EE\uFF0C\u8BF7\u5148\u524D\u53F0\u542F\u52A8\u751F\u6210\u914D\u7F6E\u6587\u4EF6: pnpm app");
|
|
84
85
|
process.exit(1);
|
|
85
86
|
}
|
|
87
|
+
execSync(`pm2 restart ${pm2Dir}`, { cwd: process.cwd() });
|
|
88
|
+
console.log("[pm2] \u91CD\u542F\u6210\u529F");
|
|
89
|
+
process.exit(0);
|
|
86
90
|
};
|
|
87
91
|
var pm2 = {
|
|
88
92
|
start,
|
|
@@ -250,6 +254,7 @@ var modifyPackageJson = () => {
|
|
|
250
254
|
const pkg = fs2.readFileSync(path2.join(dir, "package.json"), "utf-8");
|
|
251
255
|
const data = JSON.parse(pkg);
|
|
252
256
|
data.type = "module";
|
|
257
|
+
if (!data.scripts) data.scripts = {};
|
|
253
258
|
data.scripts.karin = "karin";
|
|
254
259
|
const list = [
|
|
255
260
|
"app",
|
package/dist/index.d.ts
CHANGED
|
@@ -8742,14 +8742,14 @@ type AxiosFn = {
|
|
|
8742
8742
|
* 对axios进行简单封装,超时、错误后返回null,不会抛出异常
|
|
8743
8743
|
* @param param axios参数
|
|
8744
8744
|
*/
|
|
8745
|
-
(param: AxiosRequestConfig): Promise<AxiosResponse<any> | null>;
|
|
8745
|
+
(param: AxiosRequestConfig): Promise<AxiosResponse<any> | null | undefined>;
|
|
8746
8746
|
/**
|
|
8747
8747
|
* 对axios进行简单封装,超时、错误后返回null,不会抛出异常
|
|
8748
8748
|
* @param url 请求地址
|
|
8749
8749
|
* @param type 请求类型
|
|
8750
8750
|
* @param param axios参数
|
|
8751
8751
|
*/
|
|
8752
|
-
(url: string, type: 'get' | 'post', param?: AxiosRequestConfig): Promise<AxiosResponse<any> | null>;
|
|
8752
|
+
(url: string, type: 'get' | 'post', param?: AxiosRequestConfig): Promise<AxiosResponse<any> | null | undefined>;
|
|
8753
8753
|
};
|
|
8754
8754
|
interface NpmInfo {
|
|
8755
8755
|
plugin: string;
|
|
@@ -8768,6 +8768,7 @@ interface NpmInfo {
|
|
|
8768
8768
|
declare const sleep: (ms: number) => Promise<unknown>;
|
|
8769
8769
|
/**
|
|
8770
8770
|
* axios请求
|
|
8771
|
+
* @description 401时返回 `undefined`
|
|
8771
8772
|
* @param paramOrUrl axios参数或url
|
|
8772
8773
|
* @param type 请求类型 只有在传入url时有效
|
|
8773
8774
|
* @param param axios参数 只有在传入url时有效
|
package/dist/index.js
CHANGED
|
@@ -2718,8 +2718,8 @@ __export(common_exports, {
|
|
|
2718
2718
|
writeYaml: () => write
|
|
2719
2719
|
});
|
|
2720
2720
|
import fs13 from "node:fs";
|
|
2721
|
-
import Axios from "axios";
|
|
2722
2721
|
import path9 from "node:path";
|
|
2722
|
+
import Axios, { AxiosError as AxiosError2 } from "axios";
|
|
2723
2723
|
var sleep, axios3, uptime2, formatTime2, updateYaml, getNpmPlugins, getPlugins2, getGitPlugins, mergeImage, getAbsPath, getImageSize, generateLayout, buildFilterComplex;
|
|
2724
2724
|
var init_common = __esm({
|
|
2725
2725
|
"src/utils/common/index.ts"() {
|
|
@@ -2742,10 +2742,14 @@ var init_common = __esm({
|
|
|
2742
2742
|
init_message();
|
|
2743
2743
|
sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
2744
2744
|
axios3 = async (paramOrUrl, type, param) => {
|
|
2745
|
+
var _a;
|
|
2745
2746
|
try {
|
|
2746
2747
|
const config2 = typeof paramOrUrl === "string" ? { ...param, url: paramOrUrl, method: type } : paramOrUrl;
|
|
2747
2748
|
return await Axios(config2);
|
|
2748
2749
|
} catch (error) {
|
|
2750
|
+
if (error instanceof AxiosError2) {
|
|
2751
|
+
if (((_a = error.response) == null ? void 0 : _a.status) === 401) return void 0;
|
|
2752
|
+
}
|
|
2749
2753
|
logger.debug("[common] axios\u8BF7\u6C42\u5931\u8D25:");
|
|
2750
2754
|
logger.debug(error.stack || error);
|
|
2751
2755
|
return null;
|
|
@@ -3870,10 +3874,14 @@ var init_process = __esm({
|
|
|
3870
3874
|
return;
|
|
3871
3875
|
}
|
|
3872
3876
|
logger.error("\u68C0\u6D4B\u5230\u540E\u53F0\u8FDB\u7A0B \u6B63\u5728\u5173\u95ED...");
|
|
3873
|
-
await axios3({ url: `${host2}/exit`, method: "get", timeout: 500 });
|
|
3877
|
+
const result = await axios3({ url: `${host2}/exit`, method: "get", timeout: 500 });
|
|
3878
|
+
if (typeof result === "undefined") {
|
|
3879
|
+
logger.fatal(logger.red(`\u5F53\u524D\u5B58\u5728\u591A\u5F00Bot\u5360\u7528 ${port2}\u7AEF\u53E3\uFF0C\u8BF7\u66F4\u6362\u7AEF\u53E3\u6216\u8005\u5173\u95ED\u5BF9\u5E94Bot`));
|
|
3880
|
+
processExit(1);
|
|
3881
|
+
}
|
|
3874
3882
|
for (let i = 0; i < 100; i++) {
|
|
3875
|
-
const
|
|
3876
|
-
if (
|
|
3883
|
+
const result2 = await axios3({ url: `${host2}/ping`, method: "get", timeout: 100 });
|
|
3884
|
+
if (result2) {
|
|
3877
3885
|
await sleep(50);
|
|
3878
3886
|
continue;
|
|
3879
3887
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-karin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Lightweight, efficient, concise, and stable robot framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"access": "public",
|
|
92
92
|
"registry": "https://registry.npmjs.org"
|
|
93
93
|
},
|
|
94
|
-
"time": "2025-01-15",
|
|
94
|
+
"time": "2025-01-15-2",
|
|
95
95
|
"exports": {
|
|
96
96
|
".": {
|
|
97
97
|
"import": "./dist/index.js",
|