dk-frontend-skills 1.1.2 → 1.1.4

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.4",
4
4
  "description": "dk-engineer - 幽默沉稳靠谱的前端开发助手 Claude Skills 配置包,一键注入 .claude/ 技能目录和 CLAUDE.md 人设配置",
5
5
  "author": "XiaoMa",
6
6
  "license": "MIT",
@@ -1,6 +1,5 @@
1
1
  const fs = require("fs");
2
2
  const path = require("path");
3
- const { execSync, spawn } = require("child_process");
4
3
 
5
4
  // 获取用户项目根目录
6
5
  const projectRoot = path.resolve(__dirname, "..", "..", "..");
@@ -46,6 +45,7 @@ function appendLog(level, message) {
46
45
 
47
46
  /**
48
47
  * 备份已有目录到 .claude/backups/<timestamp>/
48
+ * 注意:排除 backups/ 自身,避免复制到子目录
49
49
  * 清理超过 3 份的旧备份
50
50
  */
51
51
  function backupDir(dir) {
@@ -58,13 +58,12 @@ function backupDir(dir) {
58
58
 
59
59
  const ts = backupTimestamp();
60
60
  const bakPath = path.join(backupsDir, ts);
61
+ fs.mkdirSync(bakPath, { recursive: true });
61
62
 
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 });
63
+ // 逐项复制,排除 backups/ 避免自引用
64
+ for (const item of fs.readdirSync(dir)) {
65
+ if (item === "backups") continue;
66
+ fs.cpSync(path.join(dir, item), path.join(bakPath, item), { recursive: true });
68
67
  }
69
68
 
70
69
  appendLog("BACKUP", `backups/${ts}/ created`);
@@ -281,25 +280,6 @@ if (fs.existsSync(logFile)) {
281
280
  console.log("");
282
281
  }
283
282
 
284
- // 自动卸载
285
- // detached 子进程延迟卸载,避免在 npm 生命周期中自卸导致冲突
286
- console.log("🧹 自动卸载安装包...");
287
-
288
- const uninstallCmd = `
289
- const { execSync } = require("child_process");
290
- setTimeout(() => {
291
- execSync("npm uninstall dk-frontend-skills", {
292
- cwd: ${JSON.stringify(projectRoot)},
293
- windowsHide: true,
294
- stdio: "ignore",
295
- });
296
- }, 500);
297
- `;
298
-
299
- const child = spawn(process.execPath, ["-e", uninstallCmd], {
300
- cwd: projectRoot,
301
- detached: true,
302
- stdio: "ignore",
303
- windowsHide: process.platform === "win32",
304
- });
305
- child.unref();
283
+ // 卸载提醒
284
+ console.log("💡 dk-frontend-skills 安装包仍留在 node_modules 中");
285
+ console.log(" 如需移除,可手动执行: npm uninstall dk-frontend-skills\n");