@htyf-mp/cli 0.2.0-alpha.12 → 0.2.0-alpha.14

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.0-alpha.12",
3
+ "version": "0.2.0-alpha.14",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": {
package/src/build.mjs CHANGED
@@ -100,7 +100,7 @@ export async function mpBuildShell(newAppInfo, isGodot) {
100
100
  const scriptName = getMiniAppScriptId(appid, version);
101
101
 
102
102
  const appJson = {
103
- type: 'app',
103
+ type: isGodot ? 'game' : 'app',
104
104
  engines: '2.0.0',
105
105
  name: newAppInfo.name,
106
106
  appid,
@@ -110,7 +110,7 @@ export async function mpBuildShell(newAppInfo, isGodot) {
110
110
  };
111
111
 
112
112
  let outputPath = path.join(mpOutputPath, 'dist');
113
- const distPackagePath = path.join(mpOutputPath, 'dist.dgz');
113
+ let distPackagePath = path.join(mpOutputPath, 'dist.dgz');
114
114
  const rootIndexPath = path.join(tempPath, '..', 'index.js');
115
115
 
116
116
  const mpOptions = {
@@ -154,6 +154,13 @@ export async function mpBuildShell(newAppInfo, isGodot) {
154
154
  await fse.ensureDir(outputPath);
155
155
  await fse.emptyDir(outputPath);
156
156
  await exportGodot(godotOptions);
157
+
158
+ // Godot 项目使用平台特定的文件名
159
+ const platformName = godotOptions.platform === 'ios' ? 'ios' : 'android';
160
+ distPackagePath = path.join(mpOutputPath, `dist.${platformName}.dgz`);
161
+ // 更新 appJson 中的 zipUrl
162
+ appJson.zipUrl = newAppInfo.zipUrl || `${newAppInfo.host}/dist.${platformName}.dgz`;
163
+ await fse.writeJson(appJsonPath, appJson, { spaces: 2 });
157
164
  }
158
165
 
159
166
  await fse.ensureDir(outputPath);
package/src/debug.mjs CHANGED
@@ -13,15 +13,16 @@ import { printQrcode } from './utils-functions.mjs';
13
13
  /**
14
14
  * 小程序真机调试
15
15
  * @param {object} newAppInfo - 应用信息
16
+ * @param {boolean} isGodot - 是否为 Godot 项目
16
17
  */
17
- export async function mpDebugShell(newAppInfo) {
18
+ export async function mpDebugShell(newAppInfo, isGodot = false) {
18
19
  try {
19
- // 验证必需字段
20
- if (!newAppInfo.entry) {
20
+ // 验证必需字段(Godot 项目不需要 entry)
21
+ if (!isGodot && !newAppInfo.entry) {
21
22
  throw new Error('缺少必需的应用信息: entry');
22
23
  }
23
24
 
24
- const zipPath = await mpBuildShell(newAppInfo);
25
+ const zipPath = await mpBuildShell(newAppInfo, isGodot);
25
26
  const assetsPath = path.dirname(zipPath);
26
27
  const appJsonPath = path.join(assetsPath, 'app.json');
27
28