@htyf-mp/cli 0.2.9 → 0.2.11
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 +1 -1
- package/src/build.mjs +2 -2
- package/src/config.mjs +4 -3
- package/src/project-initializer.mjs +7 -2
package/package.json
CHANGED
package/src/build.mjs
CHANGED
|
@@ -275,10 +275,10 @@ export async function mpBuildShell(newAppInfo, isGodot = false) {
|
|
|
275
275
|
|
|
276
276
|
// Godot 项目使用平台特定的文件名(如 dist.ios.dgz 或 dist.android.dgz)
|
|
277
277
|
const platformName = godotOptions.platform === 'ios' ? 'ios' : 'android';
|
|
278
|
-
distPackagePath = path.join(mpOutputPath, `dist
|
|
278
|
+
distPackagePath = path.join(mpOutputPath, `dist.${platformName}.dgz`);
|
|
279
279
|
|
|
280
280
|
// 更新 app.json 中的 zipUrl
|
|
281
|
-
appJson.zipUrl = newAppInfo.zipUrl || `${newAppInfo.host}/dist
|
|
281
|
+
appJson.zipUrl = newAppInfo.zipUrl || `${newAppInfo.host}/dist.${platformName}.dgz`;
|
|
282
282
|
await fse.writeJson(appJsonPath, appJson, { spaces: 2 });
|
|
283
283
|
}
|
|
284
284
|
|
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://
|
|
48
|
-
zipUrl: 'https://xxxxx
|
|
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 = this.config.templates[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 =
|
|
213
|
+
existingConfig.htyf = {
|
|
214
|
+
...(existingConfig?.htyf || {}),
|
|
215
|
+
...projectConfig
|
|
216
|
+
};
|
|
212
217
|
|
|
213
218
|
// 写入配置文件
|
|
214
219
|
fs.writeFileSync(configPath, JSON.stringify(existingConfig, undefined, 2));
|