@alanwang-merit/meritdata-platform-skill-package 1.0.2 → 1.0.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,13 +1,18 @@
1
1
  {
2
2
  "name": "@alanwang-merit/meritdata-platform-skill-package",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/"
6
6
  },
7
7
  "scripts": {
8
- "update:skill": "npm install @alanwang-merit/meritdata-platform-skill-package@latest && npx skills add @alanwang-merit/meritdata-platform-skill-package"
8
+ "postinstall": "node scripts/postinstall.js"
9
9
  },
10
+ "files": [
11
+ "skills",
12
+ "rules",
13
+ "scripts"
14
+ ],
10
15
  "dependencies": {
11
- "@alanwang-merit/meritdata-platform-skill-package": "^1.0.2"
16
+ "top-package": "^1.0.1"
12
17
  }
13
18
  }
@@ -0,0 +1,39 @@
1
+ // scripts/postinstall.js
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ // 获取当前 npm 包所在的目录
6
+ const packageRoot = __dirname.replace('scripts', '');
7
+ // 获取执行安装命令的项目根目录
8
+ const projectRoot = process.cwd();
9
+
10
+ // 定义需要复制的目录映射:源目录 -> 目标目录
11
+ const copyMappings = [
12
+ { source: 'skills', target: '.claude/skills' },
13
+ { source: 'rules', target: '.claude/rules' }
14
+ ];
15
+
16
+ function copyDir(src, dest) {
17
+ if (!fs.existsSync(src)) return;
18
+
19
+ fs.mkdirSync(dest, { recursive: true });
20
+ const entries = fs.readdirSync(src, { withFileTypes: true });
21
+
22
+ for (const entry of entries) {
23
+ const srcPath = path.join(src, entry.name);
24
+ const destPath = path.join(dest, entry.name);
25
+ if (entry.isDirectory()) {
26
+ copyDir(srcPath, destPath);
27
+ } else {
28
+ fs.copyFileSync(srcPath, destPath);
29
+ }
30
+ }
31
+ }
32
+
33
+ // 执行复制操作
34
+ copyMappings.forEach(({ source, target }) => {
35
+ const srcPath = path.join(packageRoot, source);
36
+ const destPath = path.join(projectRoot, target);
37
+ copyDir(srcPath, destPath);
38
+ console.log(`✅ [postinstall] Copied ${source} to ${target}`);
39
+ });