dk-frontend-skills 1.1.2 → 1.1.3
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/scripts/copy-skills.js +6 -6
package/package.json
CHANGED
package/scripts/copy-skills.js
CHANGED
|
@@ -46,6 +46,7 @@ function appendLog(level, message) {
|
|
|
46
46
|
|
|
47
47
|
/**
|
|
48
48
|
* 备份已有目录到 .claude/backups/<timestamp>/
|
|
49
|
+
* 注意:排除 backups/ 自身,避免复制到子目录
|
|
49
50
|
* 清理超过 3 份的旧备份
|
|
50
51
|
*/
|
|
51
52
|
function backupDir(dir) {
|
|
@@ -58,13 +59,12 @@ function backupDir(dir) {
|
|
|
58
59
|
|
|
59
60
|
const ts = backupTimestamp();
|
|
60
61
|
const bakPath = path.join(backupsDir, ts);
|
|
62
|
+
fs.mkdirSync(bakPath, { recursive: true });
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (fs.existsSync(selfBak)) {
|
|
67
|
-
fs.rmSync(selfBak, { recursive: true, force: true });
|
|
64
|
+
// 逐项复制,排除 backups/ 避免自引用
|
|
65
|
+
for (const item of fs.readdirSync(dir)) {
|
|
66
|
+
if (item === "backups") continue;
|
|
67
|
+
fs.cpSync(path.join(dir, item), path.join(bakPath, item), { recursive: true });
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
appendLog("BACKUP", `backups/${ts}/ created`);
|