zen-gitsync 2.10.7 → 2.10.9
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/package.json +1 -1
- package/src/config.js +46 -2
- package/src/ui/public/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/src/ui/public/assets/css.worker-DJHgoStD.js +93 -0
- package/src/ui/public/assets/editor.worker-1JAmoQSB.js +26 -0
- package/src/ui/public/assets/html.worker-BSNtyp_I.js +470 -0
- package/src/ui/public/assets/index-BS0V07Ya.css +1 -0
- package/src/ui/public/assets/index-DGL8BdDB.js +107 -0
- package/src/ui/public/assets/json.worker--DwPKSpO.js +58 -0
- package/src/ui/public/assets/ts.worker--OkPaiLD.js +67731 -0
- package/src/ui/public/assets/vendor-D8Cadz3F.js +1328 -0
- package/src/ui/public/assets/vendor-DpSHka1A.css +1 -0
- package/src/ui/public/index.html +4 -4
- package/src/ui/server/routes/config.js +27 -0
- package/src/ui/server/routes/exec.js +15 -4
- package/src/ui/public/assets/index-5z2rWrTJ.js +0 -106
- package/src/ui/public/assets/index-bVmQ0atC.css +0 -1
- package/src/ui/public/assets/vendor-BreftYKt.css +0 -1
- package/src/ui/public/assets/vendor-CrYGMytM.js +0 -95
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -10,10 +10,28 @@ const configPath = path.join(os.homedir(), '.git-commit-tool.json');
|
|
|
10
10
|
const defaultConfig = {
|
|
11
11
|
defaultCommitMessage: "submit",
|
|
12
12
|
descriptionTemplates: [], // 添加描述模板数组
|
|
13
|
+
scopeTemplates: [],
|
|
14
|
+
messageTemplates: [],
|
|
15
|
+
commandTemplates: [
|
|
16
|
+
'echo "{{cmd}}"',
|
|
17
|
+
'npm run dev',
|
|
18
|
+
'npm run build',
|
|
19
|
+
'git status',
|
|
20
|
+
'git add .',
|
|
21
|
+
'git commit -m "{{message}}" --no-verify',
|
|
22
|
+
'git push',
|
|
23
|
+
],
|
|
13
24
|
lockedFiles: [], // 添加锁定文件数组
|
|
14
25
|
customCommands: [], // 添加自定义命令数组
|
|
26
|
+
orchestrations: [],
|
|
15
27
|
startupItems: [], // 添加项目启动项数组
|
|
16
|
-
startupAutoRun: false // 添加启动项自动执行开关
|
|
28
|
+
startupAutoRun: false, // 添加启动项自动执行开关
|
|
29
|
+
afterQuickPushAction: {
|
|
30
|
+
enabled: false,
|
|
31
|
+
type: 'command',
|
|
32
|
+
refId: ''
|
|
33
|
+
},
|
|
34
|
+
currentDirectory: ''
|
|
17
35
|
};
|
|
18
36
|
|
|
19
37
|
// 规范化项目路径作为配置键
|
|
@@ -48,6 +66,20 @@ async function writeRawConfigFile(obj) {
|
|
|
48
66
|
await fs.writeFile(configPath, JSON.stringify(obj, null, 2), 'utf-8');
|
|
49
67
|
}
|
|
50
68
|
|
|
69
|
+
async function backupConfigFileIfExists() {
|
|
70
|
+
try {
|
|
71
|
+
await fs.access(configPath);
|
|
72
|
+
} catch (_) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
await fs.copyFile(configPath, `${configPath}.bak`);
|
|
78
|
+
} catch (_) {
|
|
79
|
+
// 备份失败不阻断主流程
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
51
83
|
// 更安全的读取,区分“文件不存在”和“解析失败”
|
|
52
84
|
async function safeLoadRaw() {
|
|
53
85
|
try {
|
|
@@ -79,6 +111,16 @@ async function loadConfig() {
|
|
|
79
111
|
|
|
80
112
|
// 异步保存配置
|
|
81
113
|
async function saveConfig(config) {
|
|
114
|
+
if(!config || typeof config !== 'object' || Array.isArray(config)){
|
|
115
|
+
console.warn(chalk.yellow('⚠️ 配置文件为空,已取消写入以避免覆盖。'));
|
|
116
|
+
console.warn(chalk.gray(`文件: ${configPath}`));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (Object.keys(config).length === 0) {
|
|
120
|
+
console.warn(chalk.yellow('⚠️ 配置文件为空,已取消写入以避免覆盖。'));
|
|
121
|
+
console.warn(chalk.gray(`文件: ${configPath}`));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
82
124
|
const key = getCurrentProjectKey();
|
|
83
125
|
const state = await safeLoadRaw();
|
|
84
126
|
if (!state.ok) {
|
|
@@ -95,7 +137,9 @@ async function saveConfig(config) {
|
|
|
95
137
|
}
|
|
96
138
|
|
|
97
139
|
// 写入当前项目配置(在 defaultConfig 基础上合并,但不清空顶层其它键)
|
|
98
|
-
raw.projects[key]
|
|
140
|
+
const existingProjectConfig = (raw.projects[key] && typeof raw.projects[key] === 'object') ? raw.projects[key] : {};
|
|
141
|
+
raw.projects[key] = { ...defaultConfig, ...existingProjectConfig, ...config };
|
|
142
|
+
await backupConfigFileIfExists();
|
|
99
143
|
await writeRawConfigFile(raw);
|
|
100
144
|
}
|
|
101
145
|
// 文件锁定管理函数
|
|
Binary file
|