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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dk-frontend-skills",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "dk-engineer - 幽默沉稳靠谱的前端开发助手 Claude Skills 配置包,一键注入 .claude/ 技能目录和 CLAUDE.md 人设配置",
5
5
  "author": "XiaoMa",
6
6
  "license": "MIT",
@@ -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
- fs.cpSync(dir, bakPath, { recursive: true });
63
-
64
- // 删掉 backups 目录自身的递归副本
65
- const selfBak = path.join(bakPath, "backups");
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`);