cc-devflow 2.4.1 → 2.4.2
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 +2 -1
- package/bin/cc-devflow-cli.js +16 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
## [2.4.
|
|
10
|
+
## [2.4.2] - 2026-01-09
|
|
11
11
|
|
|
12
12
|
### 🩹 CLI 增强:增量更新 (Incremental Update)
|
|
13
13
|
|
|
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
18
18
|
- **增量更新机制**: 当目标目录已存在时,`init` 默认进入增量模式。
|
|
19
19
|
- 仅复制目标目录中**缺失**的文件。
|
|
20
20
|
- **保留**所有已存在的文件(即使用户修改过)。
|
|
21
|
+
- 若目标文件存在但内容与新版模板不同,生成 `filename.new` 并提示 `[UPDATE]`。
|
|
21
22
|
- 输出 `[NEW] filename` 提示新增文件。
|
|
22
23
|
- **强制模式重构**: `--force` 选项现在的行为更明确:彻底删除旧目录并重新安装。
|
|
23
24
|
|
package/bin/cc-devflow-cli.js
CHANGED
|
@@ -99,11 +99,25 @@ function copyIncremental(src, dest) {
|
|
|
99
99
|
}
|
|
100
100
|
} else {
|
|
101
101
|
if (!fs.existsSync(dest)) {
|
|
102
|
+
// Case 1: File missing - Copy it
|
|
102
103
|
fs.copyFileSync(src, dest);
|
|
103
104
|
console.log(`[NEW] ${path.relative(process.cwd(), dest)}`);
|
|
104
105
|
} else {
|
|
105
|
-
// File exists -
|
|
106
|
-
|
|
106
|
+
// Case 2: File exists - Compare content
|
|
107
|
+
try {
|
|
108
|
+
const srcContent = fs.readFileSync(src);
|
|
109
|
+
const destContent = fs.readFileSync(dest);
|
|
110
|
+
|
|
111
|
+
if (!srcContent.equals(destContent)) {
|
|
112
|
+
// Content differs - Create .new version
|
|
113
|
+
const newFile = `${dest}.new`;
|
|
114
|
+
fs.copyFileSync(src, newFile);
|
|
115
|
+
console.log(`[UPDATE] ${path.relative(process.cwd(), newFile)} (conflict detected)`);
|
|
116
|
+
}
|
|
117
|
+
// else: Content identical - Silent skip
|
|
118
|
+
} catch (err) {
|
|
119
|
+
console.warn(`[WARN] Could not compare ${path.relative(process.cwd(), dest)}: ${err.message}`);
|
|
120
|
+
}
|
|
107
121
|
}
|
|
108
122
|
}
|
|
109
123
|
}
|