@maiyunnet/kebab 9.3.8 → 9.3.10
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/doc/kebab-rag.md +25 -25
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/lib/core.d.ts +2 -2
- package/lib/core.js +5 -2
- package/lib/undici/response.d.ts +1 -1
- package/package.json +1 -1
- package/sys/master.js +29 -5
package/doc/kebab-rag.md
CHANGED
|
@@ -1360,7 +1360,7 @@ index/variables/VER.md
|
|
|
1360
1360
|
|
|
1361
1361
|
# Variable: VER
|
|
1362
1362
|
|
|
1363
|
-
> `const` **VER**: `"9.3.
|
|
1363
|
+
> `const` **VER**: `"9.3.10"` = `'9.3.10'`
|
|
1364
1364
|
|
|
1365
1365
|
Defined in: [index.ts:10](https://github.com/maiyunnet/kebab/blob/master/index.ts#L10)
|
|
1366
1366
|
|
|
@@ -3258,7 +3258,7 @@ lib/core/functions/clone.md
|
|
|
3258
3258
|
|
|
3259
3259
|
> **clone**\<`T`\>(`obj`): `T`
|
|
3260
3260
|
|
|
3261
|
-
Defined in: [lib/core.ts:
|
|
3261
|
+
Defined in: [lib/core.ts:1105](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1105)
|
|
3262
3262
|
|
|
3263
3263
|
完整的克隆一份数组/对象
|
|
3264
3264
|
|
|
@@ -3322,7 +3322,7 @@ lib/core/functions/debug.md
|
|
|
3322
3322
|
|
|
3323
3323
|
> **debug**(`message?`, ...`optionalParams`): `void`
|
|
3324
3324
|
|
|
3325
|
-
Defined in: [lib/core.ts:
|
|
3325
|
+
Defined in: [lib/core.ts:1139](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1139)
|
|
3326
3326
|
|
|
3327
3327
|
打印调试信息,线上环境不会打印
|
|
3328
3328
|
|
|
@@ -3357,7 +3357,7 @@ lib/core/functions/display.md
|
|
|
3357
3357
|
|
|
3358
3358
|
> **display**(`message?`, ...`optionalParams`): `void`
|
|
3359
3359
|
|
|
3360
|
-
Defined in: [lib/core.ts:
|
|
3360
|
+
Defined in: [lib/core.ts:1152](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1152)
|
|
3361
3361
|
|
|
3362
3362
|
向控制台直接显示内容,一般情况下禁止使用
|
|
3363
3363
|
|
|
@@ -3462,7 +3462,7 @@ lib/core/functions/getLog.md
|
|
|
3462
3462
|
|
|
3463
3463
|
> **getLog**(`opt`): `Promise`\<`false` \| `string`[][] \| `null`\>
|
|
3464
3464
|
|
|
3465
|
-
Defined in: [lib/core.ts:
|
|
3465
|
+
Defined in: [lib/core.ts:1012](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1012)
|
|
3466
3466
|
|
|
3467
3467
|
获取日志内容为一个数组
|
|
3468
3468
|
|
|
@@ -3568,7 +3568,7 @@ lib/core/functions/loadEnv.md
|
|
|
3568
3568
|
|
|
3569
3569
|
> **loadEnv**(`dir`): `Promise`\<`void`\>
|
|
3570
3570
|
|
|
3571
|
-
Defined in: [lib/core.ts:
|
|
3571
|
+
Defined in: [lib/core.ts:1204](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1204)
|
|
3572
3572
|
|
|
3573
3573
|
加载 .env 文件到 process.env,若文件不存在则跳过
|
|
3574
3574
|
|
|
@@ -3597,7 +3597,7 @@ lib/core/functions/log.md
|
|
|
3597
3597
|
|
|
3598
3598
|
> **log**(`opt`, `msg`, `fend?`): `void`
|
|
3599
3599
|
|
|
3600
|
-
Defined in: [lib/core.ts:
|
|
3600
|
+
Defined in: [lib/core.ts:906](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L906)
|
|
3601
3601
|
|
|
3602
3602
|
写入文件日志
|
|
3603
3603
|
|
|
@@ -3638,7 +3638,7 @@ lib/core/functions/ls.md
|
|
|
3638
3638
|
|
|
3639
3639
|
> **ls**(`opt`): `Promise`\<`object`[]\>
|
|
3640
3640
|
|
|
3641
|
-
Defined in: [lib/core.ts:
|
|
3641
|
+
Defined in: [lib/core.ts:1066](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1066)
|
|
3642
3642
|
|
|
3643
3643
|
获取目录内文件/文件夹列表
|
|
3644
3644
|
|
|
@@ -3999,7 +3999,7 @@ lib/core/functions/resolveEnvVars.md
|
|
|
3999
3999
|
|
|
4000
4000
|
> **resolveEnvVars**(`obj`): `void`
|
|
4001
4001
|
|
|
4002
|
-
Defined in: [lib/core.ts:
|
|
4002
|
+
Defined in: [lib/core.ts:1234](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1234)
|
|
4003
4003
|
|
|
4004
4004
|
将配置对象中的 ${ENV_VAR} 占位符替换为 process.env 的值
|
|
4005
4005
|
|
|
@@ -4063,7 +4063,7 @@ lib/core/functions/sendPackage.md
|
|
|
4063
4063
|
|
|
4064
4064
|
> **sendPackage**(`content`, `hosts?`): `Promise`\<`string`[]\>
|
|
4065
4065
|
|
|
4066
|
-
Defined in: [lib/core.ts:
|
|
4066
|
+
Defined in: [lib/core.ts:851](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L851)
|
|
4067
4067
|
|
|
4068
4068
|
向本机或局域网 RPC 发送 package.json 更新操作
|
|
4069
4069
|
|
|
@@ -4139,7 +4139,7 @@ lib/core/functions/sendProject.md
|
|
|
4139
4139
|
|
|
4140
4140
|
> **sendProject**(`path`, `key`, `value`, `hosts?`): `Promise`\<`string`[]\>
|
|
4141
4141
|
|
|
4142
|
-
Defined in: [lib/core.ts:
|
|
4142
|
+
Defined in: [lib/core.ts:808](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L808)
|
|
4143
4143
|
|
|
4144
4144
|
向本机或局域网 RPC 发送项目配置更新操作
|
|
4145
4145
|
|
|
@@ -4414,9 +4414,9 @@ zip 文件
|
|
|
4414
4414
|
|
|
4415
4415
|
### config?
|
|
4416
4416
|
|
|
4417
|
-
`
|
|
4417
|
+
`string` \| `boolean`
|
|
4418
4418
|
|
|
4419
|
-
是否自动更新 config 的 set.staticVer
|
|
4419
|
+
是否自动更新 config 的 set.staticVer 为最新,默认更新,'0'|false-不更新,'1'|true-更新kebab.json若有,'2'|true-更新全局
|
|
4420
4420
|
|
|
4421
4421
|
### strict?
|
|
4422
4422
|
|
|
@@ -4441,7 +4441,7 @@ lib/core/functions/writeEventStreamHead.md
|
|
|
4441
4441
|
|
|
4442
4442
|
> **writeEventStreamHead**(`res`): `void`
|
|
4443
4443
|
|
|
4444
|
-
Defined in: [lib/core.ts:
|
|
4444
|
+
Defined in: [lib/core.ts:1174](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1174)
|
|
4445
4445
|
|
|
4446
4446
|
## Parameters
|
|
4447
4447
|
|
|
@@ -4466,7 +4466,7 @@ lib/core/functions/writeHead.md
|
|
|
4466
4466
|
|
|
4467
4467
|
> **writeHead**(`res`, `statusCode`, `headers?`): `void`
|
|
4468
4468
|
|
|
4469
|
-
Defined in: [lib/core.ts:
|
|
4469
|
+
Defined in: [lib/core.ts:1163](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1163)
|
|
4470
4470
|
|
|
4471
4471
|
让 res 发送头部(前提是头部没有被发送才能调用本方法
|
|
4472
4472
|
|
|
@@ -4507,7 +4507,7 @@ lib/core/functions/write.md
|
|
|
4507
4507
|
|
|
4508
4508
|
> **write**(`res`, `data`): `void`
|
|
4509
4509
|
|
|
4510
|
-
Defined in: [lib/core.ts:
|
|
4510
|
+
Defined in: [lib/core.ts:1186](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L1186)
|
|
4511
4511
|
|
|
4512
4512
|
向 res 发送数据
|
|
4513
4513
|
|
|
@@ -4678,7 +4678,7 @@ lib/core/interfaces/ILogOptions.md
|
|
|
4678
4678
|
|
|
4679
4679
|
# Interface: ILogOptions
|
|
4680
4680
|
|
|
4681
|
-
Defined in: [lib/core.ts:
|
|
4681
|
+
Defined in: [lib/core.ts:889](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L889)
|
|
4682
4682
|
|
|
4683
4683
|
log 设置的选项
|
|
4684
4684
|
|
|
@@ -4688,7 +4688,7 @@ log 设置的选项
|
|
|
4688
4688
|
|
|
4689
4689
|
> `optional` **cookie?**: `Record`\<`string`, `string`\>
|
|
4690
4690
|
|
|
4691
|
-
Defined in: [lib/core.ts:
|
|
4691
|
+
Defined in: [lib/core.ts:895](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L895)
|
|
4692
4692
|
|
|
4693
4693
|
***
|
|
4694
4694
|
|
|
@@ -4696,7 +4696,7 @@ Defined in: [lib/core.ts:892](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4696
4696
|
|
|
4697
4697
|
> `optional` **get?**: `Record`\<`string`, `any`\>
|
|
4698
4698
|
|
|
4699
|
-
Defined in: [lib/core.ts:
|
|
4699
|
+
Defined in: [lib/core.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L894)
|
|
4700
4700
|
|
|
4701
4701
|
***
|
|
4702
4702
|
|
|
@@ -4704,7 +4704,7 @@ Defined in: [lib/core.ts:891](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4704
4704
|
|
|
4705
4705
|
> `optional` **headers?**: `IncomingHttpHeaders`
|
|
4706
4706
|
|
|
4707
|
-
Defined in: [lib/core.ts:
|
|
4707
|
+
Defined in: [lib/core.ts:897](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L897)
|
|
4708
4708
|
|
|
4709
4709
|
***
|
|
4710
4710
|
|
|
@@ -4712,7 +4712,7 @@ Defined in: [lib/core.ts:894](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4712
4712
|
|
|
4713
4713
|
> `optional` **hostname?**: `string`
|
|
4714
4714
|
|
|
4715
|
-
Defined in: [lib/core.ts:
|
|
4715
|
+
Defined in: [lib/core.ts:892](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L892)
|
|
4716
4716
|
|
|
4717
4717
|
***
|
|
4718
4718
|
|
|
@@ -4720,7 +4720,7 @@ Defined in: [lib/core.ts:889](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4720
4720
|
|
|
4721
4721
|
> `optional` **path?**: `string`
|
|
4722
4722
|
|
|
4723
|
-
Defined in: [lib/core.ts:
|
|
4723
|
+
Defined in: [lib/core.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L890)
|
|
4724
4724
|
|
|
4725
4725
|
***
|
|
4726
4726
|
|
|
@@ -4728,7 +4728,7 @@ Defined in: [lib/core.ts:887](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4728
4728
|
|
|
4729
4729
|
> `optional` **req?**: `IncomingMessage` \| `Http2ServerRequest` \| `null`
|
|
4730
4730
|
|
|
4731
|
-
Defined in: [lib/core.ts:
|
|
4731
|
+
Defined in: [lib/core.ts:893](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L893)
|
|
4732
4732
|
|
|
4733
4733
|
***
|
|
4734
4734
|
|
|
@@ -4736,7 +4736,7 @@ Defined in: [lib/core.ts:890](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4736
4736
|
|
|
4737
4737
|
> `optional` **session?**: `Record`\<`string`, `any`\>
|
|
4738
4738
|
|
|
4739
|
-
Defined in: [lib/core.ts:
|
|
4739
|
+
Defined in: [lib/core.ts:896](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L896)
|
|
4740
4740
|
|
|
4741
4741
|
***
|
|
4742
4742
|
|
|
@@ -4744,7 +4744,7 @@ Defined in: [lib/core.ts:893](https://github.com/maiyunnet/kebab/blob/master/lib
|
|
|
4744
4744
|
|
|
4745
4745
|
> `optional` **urlFull?**: `string`
|
|
4746
4746
|
|
|
4747
|
-
Defined in: [lib/core.ts:
|
|
4747
|
+
Defined in: [lib/core.ts:891](https://github.com/maiyunnet/kebab/blob/master/lib/core.ts#L891)
|
|
4748
4748
|
|
|
4749
4749
|
lib/core/type-aliases/TPm2Action.md
|
|
4750
4750
|
---
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
7
7
|
*/
|
|
8
8
|
/** --- 当前系统版本号 --- */
|
|
9
|
-
export const VER = '9.3.
|
|
9
|
+
export const VER = '9.3.10';
|
|
10
10
|
// --- 服务端用的路径 ---
|
|
11
11
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
12
12
|
/** --- /xxx/xxx --- */
|
package/lib/core.d.ts
CHANGED
|
@@ -203,10 +203,10 @@ export declare function removeGlobal(key: string, hosts?: string[]): Promise<str
|
|
|
203
203
|
* @param sourcePath zip 文件
|
|
204
204
|
* @param path 要更新的目标路径,无所谓是否 / 开头 / 结尾,是对方 kebab 的根据路径开始算起
|
|
205
205
|
* @param hosts 局域网多机部署,不设置默认本机部署
|
|
206
|
-
* @param config 是否自动更新 config 的 set.staticVer
|
|
206
|
+
* @param config 是否自动更新 config 的 set.staticVer 为最新,默认更新,'0'|false-不更新,'1'|true-更新kebab.json若有,'2'|true-更新全局
|
|
207
207
|
* @param strict 严格模式,只有存在的文件才会被覆盖,不存在则中途直接报错,默认为 true
|
|
208
208
|
*/
|
|
209
|
-
export declare function updateCode(sourcePath: string, path: string, hosts?: string[] | 'config', config?: boolean, strict?: boolean): Promise<Record<string, {
|
|
209
|
+
export declare function updateCode(sourcePath: string, path: string, hosts?: string[] | 'config', config?: boolean | string, strict?: boolean): Promise<Record<string, {
|
|
210
210
|
'result': boolean;
|
|
211
211
|
'return': string;
|
|
212
212
|
}>>;
|
package/lib/core.js
CHANGED
|
@@ -658,10 +658,13 @@ export async function removeGlobal(key, hosts) {
|
|
|
658
658
|
* @param sourcePath zip 文件
|
|
659
659
|
* @param path 要更新的目标路径,无所谓是否 / 开头 / 结尾,是对方 kebab 的根据路径开始算起
|
|
660
660
|
* @param hosts 局域网多机部署,不设置默认本机部署
|
|
661
|
-
* @param config 是否自动更新 config 的 set.staticVer
|
|
661
|
+
* @param config 是否自动更新 config 的 set.staticVer 为最新,默认更新,'0'|false-不更新,'1'|true-更新kebab.json若有,'2'|true-更新全局
|
|
662
662
|
* @param strict 严格模式,只有存在的文件才会被覆盖,不存在则中途直接报错,默认为 true
|
|
663
663
|
*/
|
|
664
664
|
export async function updateCode(sourcePath, path, hosts, config = true, strict = true) {
|
|
665
|
+
if (typeof config === 'boolean') {
|
|
666
|
+
config = config ? '2' : '0';
|
|
667
|
+
}
|
|
665
668
|
if (hosts === 'config') {
|
|
666
669
|
hosts = globalConfig.hosts;
|
|
667
670
|
}
|
|
@@ -677,7 +680,7 @@ export async function updateCode(sourcePath, path, hosts, config = true, strict
|
|
|
677
680
|
continue;
|
|
678
681
|
}
|
|
679
682
|
fd.putString('path', path);
|
|
680
|
-
fd.putString('config', config
|
|
683
|
+
fd.putString('config', config);
|
|
681
684
|
fd.putString('strict', strict ? '1' : '0');
|
|
682
685
|
const res = await lUndici.post('http://' + host + ':' + globalConfig.rpcPort.toString() + '/' + lCrypto.aesEncrypt(lText.stringifyJson({
|
|
683
686
|
'action': 'code',
|
package/lib/undici/response.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export declare class Response {
|
|
|
31
31
|
/**
|
|
32
32
|
* --- 获取响应读取流对象 ---
|
|
33
33
|
*/
|
|
34
|
-
getStream():
|
|
34
|
+
getStream(): (import("undici/types/readable").default & undici.Dispatcher.BodyMixin) | zlib.Gunzip | zlib.Inflate | zlib.BrotliDecompress | null;
|
|
35
35
|
/**
|
|
36
36
|
* --- 获取原生响应读取流对象 ---
|
|
37
37
|
*/
|
package/package.json
CHANGED
package/sys/master.js
CHANGED
|
@@ -230,7 +230,7 @@ function createRpcListener() {
|
|
|
230
230
|
to += '/';
|
|
231
231
|
}
|
|
232
232
|
if (!await lFs.isDir(to)) {
|
|
233
|
-
res.end('Path not found: ' + to);
|
|
233
|
+
res.end('[project] Path not found: ' + to);
|
|
234
234
|
return;
|
|
235
235
|
}
|
|
236
236
|
const projectFile = to + 'kebab.json';
|
|
@@ -303,7 +303,7 @@ function createRpcListener() {
|
|
|
303
303
|
}
|
|
304
304
|
if (!await lFs.isDir(to)) {
|
|
305
305
|
if (rtn.post['strict'] === '1') {
|
|
306
|
-
res.end('Path not found:
|
|
306
|
+
res.end(`[code][0] [${rtn.post['strict']}] Path not found: ${to}`);
|
|
307
307
|
await sRoute.unlinkUploadFiles(rtn.files);
|
|
308
308
|
return;
|
|
309
309
|
}
|
|
@@ -438,7 +438,7 @@ function createRpcListener() {
|
|
|
438
438
|
// --- 看文件夹是否存在 ---
|
|
439
439
|
if (pat && !await lFs.isDir(to + pat)) {
|
|
440
440
|
if (rtn.post['strict'] === '1') {
|
|
441
|
-
res.end('Path not found:
|
|
441
|
+
res.end(`[code][1] [${rtn.post['strict']}] Path not found: ${to + pat}`);
|
|
442
442
|
await sRoute.unlinkUploadFiles(rtn.files);
|
|
443
443
|
return;
|
|
444
444
|
}
|
|
@@ -446,7 +446,7 @@ function createRpcListener() {
|
|
|
446
446
|
}
|
|
447
447
|
// --- 覆盖或创建文件 ---
|
|
448
448
|
if ((rtn.post['strict'] === '1') && !await lFs.isFile(to + pat + fname)) {
|
|
449
|
-
res.end('Path not found:
|
|
449
|
+
res.end(`[code][2] [${rtn.post['strict']}] Path not found: ${to + pat + fname}`);
|
|
450
450
|
await sRoute.unlinkUploadFiles(rtn.files);
|
|
451
451
|
return;
|
|
452
452
|
}
|
|
@@ -454,7 +454,31 @@ function createRpcListener() {
|
|
|
454
454
|
}
|
|
455
455
|
await sRoute.unlinkUploadFiles(rtn.files);
|
|
456
456
|
// --- 检查是否更新 config ---
|
|
457
|
-
|
|
457
|
+
const configType = rtn.post['config'];
|
|
458
|
+
if (configType === '1') {
|
|
459
|
+
/** --- 本次部署要更新的静态版本号 --- */
|
|
460
|
+
const staticVer = lTime.format(null, 'YmdHis');
|
|
461
|
+
for (const kdir of kebabProjectDirs) {
|
|
462
|
+
const projectFile = `${to}${kdir}kebab.json`;
|
|
463
|
+
if (!await lFs.isFile(projectFile)) {
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const projectContent = await lFs.getContent(projectFile, 'utf8');
|
|
467
|
+
if (!projectContent) {
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
const projectJson = lText.parseJson(projectContent);
|
|
471
|
+
if (!projectJson) {
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
projectJson.set ??= {};
|
|
475
|
+
projectJson.set.staticVer = staticVer;
|
|
476
|
+
await lFs.putContent(projectFile, lText.stringifyJson(projectJson, 4), {
|
|
477
|
+
'encoding': 'utf8'
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
else if (configType === '2') {
|
|
458
482
|
const configContent = await lFs.getContent(kebab.CONF_CWD + 'config.json', 'utf8');
|
|
459
483
|
if (configContent) {
|
|
460
484
|
await lFs.putContent(kebab.CONF_CWD + 'config.json', configContent.replace(/"staticVer": ".+?"/, `"staticVer": "${lTime.format(null, 'YmdHis')}"`), {
|