@maiyunnet/kebab 9.29.0 → 9.29.1
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 +161 -161
- package/index.d.ts +1 -1
- package/index.js +1 -2
- package/lib/core.js +4 -1
- package/package.json +1 -1
- package/sys/master.js +30 -11
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
1
|
/**
|
|
3
2
|
* Project: Kebab, User: JianSuoQiYue
|
|
4
3
|
* Date: 2019-3-30 12:46:41
|
|
5
4
|
* --- 本文件用来定义每个目录实体地址的常量 ---
|
|
6
5
|
*/
|
|
7
6
|
/** --- 当前系统版本号 --- */
|
|
8
|
-
export const VER = '9.29.
|
|
7
|
+
export const VER = '9.29.1';
|
|
9
8
|
// --- 服务端用的路径 ---
|
|
10
9
|
const imu = decodeURIComponent(import.meta.url).replace('file://', '').replace(/^\/(\w:)/, '$1');
|
|
11
10
|
/** --- /xxx/xxx --- */
|
package/lib/core.js
CHANGED
|
@@ -880,7 +880,10 @@ export async function updateCode(sourcePath, path, hosts, config = true, strict
|
|
|
880
880
|
}
|
|
881
881
|
const bodyHash = await rpc.hashFile(sourcePath);
|
|
882
882
|
if (bodyHash === false) {
|
|
883
|
-
return {
|
|
883
|
+
return Object.fromEntries(hosts.map(host => [host, {
|
|
884
|
+
'result': false,
|
|
885
|
+
'return': 'Failed to read deployment archive',
|
|
886
|
+
}]));
|
|
884
887
|
}
|
|
885
888
|
/** --- 各主机使用独立上传流并行部署,结果保持输入顺序 --- */
|
|
886
889
|
const results = await Promise.all(hosts.map(async (host) => {
|
package/package.json
CHANGED
package/sys/master.js
CHANGED
|
@@ -486,7 +486,10 @@ function createRpcListener() {
|
|
|
486
486
|
res.end(`[code][0] [${msg.strict}] Path not found: ${to}`);
|
|
487
487
|
return;
|
|
488
488
|
}
|
|
489
|
-
await lFs.mkdir(to)
|
|
489
|
+
if (!await lFs.mkdir(to)) {
|
|
490
|
+
res.end(`Failed to create directory: ${to}`);
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
490
493
|
}
|
|
491
494
|
const buf = await lFs.getContent(body.file);
|
|
492
495
|
if (!buf) {
|
|
@@ -667,7 +670,10 @@ function createRpcListener() {
|
|
|
667
670
|
res.end(`[code][1] [${msg.strict}] Path not found: ${targetDir}`);
|
|
668
671
|
return;
|
|
669
672
|
}
|
|
670
|
-
await lFs.mkdir(targetDir)
|
|
673
|
+
if (!await lFs.mkdir(targetDir)) {
|
|
674
|
+
res.end(`Failed to create directory: ${targetDir}`);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
671
677
|
}
|
|
672
678
|
const targetFile = await resolvePathInside(to, pat + fname);
|
|
673
679
|
if (!targetFile) {
|
|
@@ -679,7 +685,10 @@ function createRpcListener() {
|
|
|
679
685
|
res.end(`[code][2] [${msg.strict}] Path not found: ${targetFile}`);
|
|
680
686
|
return;
|
|
681
687
|
}
|
|
682
|
-
await lFs.putContent(targetFile, ls[archivePath])
|
|
688
|
+
if (!await lFs.putContent(targetFile, ls[archivePath])) {
|
|
689
|
+
res.end(`Failed to write file: ${targetFile}`);
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
683
692
|
}
|
|
684
693
|
// --- 检查是否更新 config ---
|
|
685
694
|
const configType = msg.config;
|
|
@@ -693,25 +702,35 @@ function createRpcListener() {
|
|
|
693
702
|
}
|
|
694
703
|
const projectContent = await lFs.getContent(projectFile, 'utf8');
|
|
695
704
|
if (!projectContent) {
|
|
696
|
-
|
|
705
|
+
res.end(`Failed to read file: ${projectFile}`);
|
|
706
|
+
return;
|
|
697
707
|
}
|
|
698
708
|
const projectJson = lText.parseJson(projectContent);
|
|
699
709
|
if (!projectJson) {
|
|
700
|
-
|
|
710
|
+
res.end(`Invalid config: ${projectFile}`);
|
|
711
|
+
return;
|
|
701
712
|
}
|
|
702
713
|
projectJson.set ??= {};
|
|
703
714
|
projectJson.set.staticVer = staticVer;
|
|
704
|
-
await lFs.putContent(projectFile, lText.stringifyJson(projectJson, 4), {
|
|
715
|
+
if (!await lFs.putContent(projectFile, lText.stringifyJson(projectJson, 4), {
|
|
705
716
|
'encoding': 'utf8'
|
|
706
|
-
})
|
|
717
|
+
})) {
|
|
718
|
+
res.end(`Failed to write file: ${projectFile}`);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
707
721
|
}
|
|
708
722
|
}
|
|
709
723
|
else if (configType === '2') {
|
|
710
724
|
const configContent = await lFs.getContent(kebab.CONF_CWD + 'config.json', 'utf8');
|
|
711
|
-
if (configContent) {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
725
|
+
if (!configContent) {
|
|
726
|
+
res.end(`Failed to read file: ${kebab.CONF_CWD}config.json`);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
if (!await lFs.putContent(kebab.CONF_CWD + 'config.json', configContent.replace(/"staticVer": ".+?"/, `"staticVer": "${lTime.format(null, 'YmdHis')}"`), {
|
|
730
|
+
'encoding': 'utf8'
|
|
731
|
+
})) {
|
|
732
|
+
res.end(`Failed to write file: ${kebab.CONF_CWD}config.json`);
|
|
733
|
+
return;
|
|
715
734
|
}
|
|
716
735
|
}
|
|
717
736
|
break;
|