@htyf-mp/cli 0.7.1 → 0.7.2

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/README.md CHANGED
@@ -35,7 +35,9 @@ CLI 会自动:
35
35
  - 生成 `app.json` 中的 `htyf` 配置(包含 `appid`、`name`、`zipUrl`、`appUrlConfig` 等)。
36
36
  - 将模板拷贝到你指定的项目目录中。
37
37
 
38
- > 各模板的具体用法,请参考生成项目中 `_apps_temp_` / `_game_temp_` / `_taro_temp_` 目录下的 `README.md`。
38
+ > 各模板的具体用法,请参考生成项目根目录的 `README.md`。RN/Godot 模板在 htyf-cli 中维护;。
39
+
40
+ AI 全量/增量迁移规则单独安装:[htyf-skills](https://github.com/htyf-mp-community/htyf-skills)。当前 CLI 的非交互命令和版本说明见 [仓库指南](https://github.com/htyf-mp-community/htyf-cli)。
39
41
 
40
42
  ## AI / 脚本直接调用
41
43
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  "repository": {
32
32
  "type": "git",
33
33
  "url": "https://github.com/htyf-mp-community/htyf-cli.git",
34
- "directory": "htyf-cli"
34
+ "directory": "packages/cli"
35
35
  },
36
36
  "engines": {
37
37
  "node": ">=18.0.0",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "29d6076f403a5e856e08602ab61d57c887766787"
85
+ "gitHead": "e19498f682a2b6c7d1c9ac07616ef7460ed52e14"
86
86
  }
package/src/config.mjs CHANGED
@@ -15,15 +15,15 @@ export class ProjectConfig {
15
15
  this.templates = {
16
16
  [CONSTANTS.TEMPLATE_TYPES.TARO_TEMPLATE]: {
17
17
  name: 'taro-template',
18
- tempPath: '_taro_temp_'
18
+ tempPath: 'packages/cli/_taro_temp_'
19
19
  },
20
20
  [CONSTANTS.TEMPLATE_TYPES.APP_TEMPLATE]: {
21
21
  name: 'app-template',
22
- tempPath: '_apps_temp_'
22
+ tempPath: 'packages/cli/_apps_temp_'
23
23
  },
24
24
  [CONSTANTS.TEMPLATE_TYPES.GAME_TEMPLATE]: {
25
25
  name: 'game-template',
26
- tempPath: '_game_temp_'
26
+ tempPath: 'packages/cli/_game_temp_'
27
27
  },
28
28
  };
29
29
  }
@@ -179,11 +179,12 @@ export class ProjectInitializer {
179
179
  try {
180
180
  // 克隆仓库
181
181
  spinner.text = '正在克隆模板仓库...';
182
- await this.processor.cloneRepository(repoType, tmpdir, { nonInteractive: userInputs.nonInteractive });
182
+ const template = this.config.templates[templateType];
183
+ await this.processor.cloneRepository(template.repository || repoType, tmpdir, { nonInteractive: userInputs.nonInteractive });
183
184
 
184
185
  // 确定应用根路径
185
- const template = this.config.templates[templateType];
186
- const appRootPath = path.join(tmpdir, 'packages/cli', template.tempPath);
186
+ const appRootPath = path.join(tmpdir, template.tempPath);
187
+ if (!fs.existsSync(appRootPath)) throw new Error(`模板目录不存在: ${template.tempPath}`);
187
188
 
188
189
  // 清理不需要的文件
189
190
  spinner.text = '正在清理模板文件...';
@@ -294,7 +295,9 @@ export class ProjectInitializer {
294
295
  return commands.join('\n');
295
296
  })() + '\n\n' +
296
297
  chalk.blue('常用命令:') + '\n' +
297
- chalk.white(' npm run htyf # 构建红糖云服小程序') + '\n' +
298
+ chalk.white(templateType === CONSTANTS.TEMPLATE_TYPES.TARO_TEMPLATE
299
+ ? ' npm run build:htyf # 进入 Taro 平台菜单,选择打包或调试'
300
+ : ' npx @htyf-mp/cli # 打开构建与调试菜单') + '\n' +
298
301
  chalk.gray('💡 提示: 使用 --debug 参数可以查看详细的调试信息'),
299
302
  {
300
303
  padding: 1,
@@ -48,12 +48,11 @@ export class TemplateProcessor {
48
48
  path.join(tmpdir, 'README.md')
49
49
  ];
50
50
 
51
- const cliTemplatesDir = path.join(tmpdir, 'packages/cli');
52
51
  const selectedTemplate = this.config.templates[templateType];
53
52
  if (selectedTemplate) {
54
- const selectedPath = path.join(cliTemplatesDir, selectedTemplate.tempPath);
53
+ const selectedPath = path.join(tmpdir, selectedTemplate.tempPath);
55
54
  Object.values(this.config.templates).forEach((template) => {
56
- const templatePath = path.join(cliTemplatesDir, template.tempPath);
55
+ const templatePath = path.join(tmpdir, template.tempPath);
57
56
  if (templatePath !== selectedPath) {
58
57
  pathsToRemove.push(templatePath);
59
58
  }