@htyf-mp/cli 0.2.10 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": {
package/src/config.mjs CHANGED
@@ -38,14 +38,15 @@ export class ProjectConfig {
38
38
  }));
39
39
  }
40
40
 
41
- createProjectConfig(appName, displayName, appid) {
41
+ createProjectConfig(appName, displayName, appid, rotate) {
42
42
  return {
43
43
  type: 'app',
44
44
  name: appName,
45
+ rotate: rotate || 'portrait',
45
46
  projectname: displayName,
46
47
  appid: appid,
47
- appUrlConfig: 'https://xxx.cos.ap-chengdu.myqcloud.com/assets/testMiniApps/htyanimation/app.json',
48
- zipUrl: 'https://xxxxx.myqcloud.com/assets/testMiniApps/xxxxx/outputs/dist.dgz'
48
+ appUrlConfig: 'https://xxxxx/app.json',
49
+ zipUrl: 'https://xxxxx/dist.[PLATFORM].dgz'
49
50
  };
50
51
  }
51
52
  }
@@ -187,10 +187,12 @@ export class ProjectInitializer {
187
187
  spinner.text = '正在处理模板...';
188
188
  this.processor.processTemplate(appRootPath, templateType);
189
189
 
190
+ const isGodot = templateType === CONSTANTS.TEMPLATE_TYPES.GAME_TEMPLATE;
191
+
190
192
  // 生成配置
191
193
  spinner.text = '正在生成项目配置...';
192
194
  const appid = this.config.generateAppId();
193
- const projectConfig = this.config.createProjectConfig(appName, displayName, appid);
195
+ const projectConfig = this.config.createProjectConfig(appName, displayName, appid, isGodot ? 'landscape' : 'portrait');
194
196
  // 写入配置文件
195
197
  const configPath = path.join(appRootPath, 'app.json');
196
198
  let existingConfig = {};
@@ -208,7 +210,10 @@ export class ProjectInitializer {
208
210
  }
209
211
 
210
212
  // 添加 htyf 字段
211
- existingConfig.htyf = projectConfig;
213
+ existingConfig.htyf = {
214
+ ...(existingConfig?.htyf || {}),
215
+ ...projectConfig
216
+ };
212
217
 
213
218
  // 写入配置文件
214
219
  fs.writeFileSync(configPath, JSON.stringify(existingConfig, undefined, 2));