@deppon/create-deppon-app 2.4.9 → 2.4.12

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/deppon.js CHANGED
@@ -38,7 +38,11 @@ let projectName = '';
38
38
  async function getPackageVersion(packageName, defaultVersion) {
39
39
  // 尝试从本地 packages 目录读取
40
40
  const packagesDir = path.resolve(__dirname, '../../packages');
41
- const packageDirName = packageName.replace('@deppon/', 'deppon-');
41
+ /** 作用域名与磁盘目录不一致时在此映射(如 @deppon/deppon-skills deppon-skills) */
42
+ const localDirOverrides = {
43
+ '@deppon/deppon-skills': 'deppon-skills',
44
+ };
45
+ const packageDirName = localDirOverrides[packageName] ?? packageName.replace('@deppon/', 'deppon-');
42
46
  const localPackagePath = path.join(packagesDir, packageDirName, 'package.json');
43
47
 
44
48
  if (fs.existsSync(localPackagePath)) {
@@ -320,6 +324,48 @@ export default request;
320
324
  // 模板中的 main.ts 已经包含了所有必要的导入和初始化代码
321
325
  }
322
326
 
327
+ /**
328
+ * 引入 @deppon/deppon-skills:写入 devDependencies 与 postinstall,安装依赖后自动执行 deppon-skills-install
329
+ * @param {string} root
330
+ */
331
+ async function mergeDepponSkillsIntoProject(root) {
332
+ const pkgPath = path.join(root, 'package.json');
333
+ if (!fs.existsSync(pkgPath)) return;
334
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
335
+ pkg.devDependencies = pkg.devDependencies || {};
336
+ const skillsVersion = await getPackageVersion('@deppon/deppon-skills', '^2.4.11');
337
+ pkg.devDependencies['@deppon/deppon-skills'] = skillsVersion;
338
+ delete pkg.devDependencies['deppon-skills'];
339
+ pkg.scripts = pkg.scripts || {};
340
+ const hook = 'deppon-skills-install';
341
+ if (!pkg.scripts.postinstall) {
342
+ pkg.scripts.postinstall = hook;
343
+ } else if (!pkg.scripts.postinstall.includes(hook)) {
344
+ pkg.scripts.postinstall = `${hook} && ${pkg.scripts.postinstall}`;
345
+ }
346
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 4));
347
+ }
348
+
349
+ /**
350
+ * 本地联调时若存在 packages/deppon-skills/dist,则预复制到项目 .cursor/skills(发布后一般无 dist,需 npm install 触发 postinstall)
351
+ * @param {string} root
352
+ */
353
+ function tryCopyBundledDepponSkills(root) {
354
+ const bundledDist = path.resolve(__dirname, '../deppon-skills/dist');
355
+ const dest = path.join(root, '.cursor', 'skills');
356
+ if (!fs.existsSync(bundledDist)) return;
357
+ const entries = fs.readdirSync(bundledDist, { withFileTypes: true }).filter(d => d.isDirectory());
358
+ if (entries.length === 0) return;
359
+ fs.mkdirSync(dest, { recursive: true });
360
+ for (const e of entries) {
361
+ const from = path.join(bundledDist, e.name);
362
+ const to = path.join(dest, e.name);
363
+ fs.rmSync(to, { recursive: true, force: true });
364
+ fs.cpSync(from, to, { recursive: true });
365
+ }
366
+ console.log(chalk.green('已从本地 deppon-skills/dist 预同步 Cursor skills → .cursor/skills'));
367
+ }
368
+
323
369
  program.name('create-deppon-app').description(pkg.description).version(pkg.version);
324
370
 
325
371
  program
@@ -475,6 +521,10 @@ async function createProject() {
475
521
  const readmeContent = `
476
522
  # ${appName.toUpperCase()}
477
523
 
524
+ ## Cursor Agent Skills
525
+
526
+ 项目已依赖 \`@deppon/deppon-skills\`,执行 \`npm install\` 时会通过 \`postinstall\` 自动将技能同步到 \`.cursor/skills/\`。若需手动同步:\`npx deppon-skills-install\`。
527
+
478
528
  ## 启动
479
529
 
480
530
  \`\`\`bash
@@ -493,6 +543,9 @@ npm run build
493
543
  console.log(`初始化文件`);
494
544
  fs.cpSync(templateDir, root, { recursive: true });
495
545
 
546
+ await mergeDepponSkillsIntoProject(root);
547
+ tryCopyBundledDepponSkills(root);
548
+
496
549
  // 注意:不再生成 deppon.config.js,模板中已包含 vite.config.ts 配置文件
497
550
  // 模板中的 vite.config.ts 已经包含了完整的 Vite 配置
498
551
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deppon/create-deppon-app",
3
- "version": "2.4.9",
3
+ "version": "2.4.12",
4
4
  "description": "Vue 3 project scaffold CLI tool",
5
5
  "author": {
6
6
  "name": "",
@@ -2,6 +2,10 @@
2
2
 
3
3
  基于 @deppon 系列包的 Vue 3 项目模板
4
4
 
5
+ ## Cursor Agent Skills
6
+
7
+ 模板已依赖 `@deppon/deppon-skills`。执行 `npm install` 时通过 `postinstall` 自动将技能同步到 `.cursor/skills/`。手动同步:`npx deppon-skills-install`。
8
+
5
9
  ## 启动
6
10
 
7
11
  ```bash
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "",
3
3
  "description": "",
4
- "version": "2.4.9",
4
+ "version": "2.4.12",
5
5
  "license": "MIT",
6
6
  "scripts": {
7
+ "postinstall": "deppon-skills-install",
7
8
  "dev": "vite --mode development",
8
9
  "dev:test": "vite --mode test",
9
10
  "dev:local": "vite --mode dev-local",
@@ -16,14 +17,14 @@
16
17
  "format": "prettier --write **/*.{js,ts,vue} && eslint . --ext js,ts,vue --fix"
17
18
  },
18
19
  "dependencies": {
19
- "@deppon/deppon-assets": "^2.4.9",
20
- "@deppon/deppon-auth": "^2.4.9",
21
- "@deppon/deppon-pinia": "^2.4.9",
22
- "@deppon/deppon-request": "^2.4.9",
23
- "@deppon/deppon-router": "^2.4.9",
24
- "@deppon/deppon-template": "^2.4.9",
25
- "@deppon/deppon-ui": "^2.4.9",
26
- "@deppon/deppon-utils": "^2.4.9",
20
+ "@deppon/deppon-assets": "^2.4.12",
21
+ "@deppon/deppon-auth": "^2.4.12",
22
+ "@deppon/deppon-pinia": "^2.4.12",
23
+ "@deppon/deppon-request": "^2.4.12",
24
+ "@deppon/deppon-router": "^2.4.12",
25
+ "@deppon/deppon-template": "^2.4.12",
26
+ "@deppon/deppon-ui": "^2.4.12",
27
+ "@deppon/deppon-utils": "^2.4.12",
27
28
  "dayjs": "^1.11.19",
28
29
  "echarts": "^6.0.0",
29
30
  "element-plus": "^2.11.7",
@@ -34,7 +35,8 @@
34
35
  "vue": "^3.5.24"
35
36
  },
36
37
  "devDependencies": {
37
- "@deppon/deppon-eslint-config": "^2.4.9",
38
+ "@deppon/deppon-skills": "^2.4.12",
39
+ "@deppon/deppon-eslint-config": "^2.4.12",
38
40
  "@types/node": "^24.10.1",
39
41
  "@types/nprogress": "^0.2.3",
40
42
  "@vitejs/plugin-legacy": "^5.4.0",