@htyf-mp/cli 0.2.15 → 0.2.17
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/HtyfImportsPlugin.mjs +3 -1
- package/src/build.mjs +6 -4
- package/src/config.mjs +4 -0
- package/src/constants.mjs +1 -0
- package/src/debug.mjs +4 -2
- package/src/template-processor.mjs +6 -0
package/package.json
CHANGED
|
@@ -307,7 +307,9 @@ export class HtyfModulesPlugin {
|
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
// 首次处理该包
|
|
310
|
-
|
|
310
|
+
// react-native 必须视为原生依赖,无论是否检测到 ios/android 目录
|
|
311
|
+
const nativeModule =
|
|
312
|
+
packageName === "react-native" ? true : hasNativeCode(packageName);
|
|
311
313
|
const dependencyInfo = {
|
|
312
314
|
name: packageName,
|
|
313
315
|
version: getPackageVersion(packageName),
|
package/src/build.mjs
CHANGED
|
@@ -147,10 +147,11 @@ export async function mpBuildShell(newAppInfo, isGodot = false) {
|
|
|
147
147
|
const scriptName = getMiniAppScriptId(appid, version);
|
|
148
148
|
|
|
149
149
|
// 构建 app.json 配置
|
|
150
|
+
const appType = newAppInfo.type || (isGodot ? 'game' : 'app');
|
|
150
151
|
const appJson = {
|
|
151
152
|
...newAppInfo,
|
|
152
153
|
rotate: newAppInfo.rotate || 'portrait',
|
|
153
|
-
type:
|
|
154
|
+
type: appType, // 支持 app / game / web 等类型
|
|
154
155
|
engines: '2.0.0',
|
|
155
156
|
name: newAppInfo.name,
|
|
156
157
|
appid,
|
|
@@ -207,7 +208,8 @@ export async function mpBuildShell(newAppInfo, isGodot = false) {
|
|
|
207
208
|
|
|
208
209
|
// ========== 执行构建 ==========
|
|
209
210
|
try {
|
|
210
|
-
|
|
211
|
+
const isWeb = appType === 'web';
|
|
212
|
+
if (!isGodot && !isWeb) {
|
|
211
213
|
// ========== 普通小程序构建流程 ==========
|
|
212
214
|
Logger.info('使用 React Native 构建小程序包...');
|
|
213
215
|
|
|
@@ -247,7 +249,7 @@ export async function mpBuildShell(newAppInfo, isGodot = false) {
|
|
|
247
249
|
timeout: 120000, // 2 分钟超时
|
|
248
250
|
showCommand: false
|
|
249
251
|
});
|
|
250
|
-
} else {
|
|
252
|
+
} else if (isGodot) {
|
|
251
253
|
// ========== Godot 游戏构建流程 ==========
|
|
252
254
|
Logger.info('检测到 Godot 项目,开始执行 Godot 导出流程...');
|
|
253
255
|
|
|
@@ -286,7 +288,7 @@ export async function mpBuildShell(newAppInfo, isGodot = false) {
|
|
|
286
288
|
// 将 app.json 复制到输出目录
|
|
287
289
|
await fse.ensureDir(outputPath);
|
|
288
290
|
await fse.copy(appJsonPath, path.join(outputPath, 'app.json'));
|
|
289
|
-
if (!isGodot) {
|
|
291
|
+
if (!isGodot && appType !== 'web') {
|
|
290
292
|
fse.copyFileSync(path.join(outputPath, '../manifest.json'), path.join(outputPath, 'manifest.json'));
|
|
291
293
|
}
|
|
292
294
|
|
package/src/config.mjs
CHANGED
package/src/constants.mjs
CHANGED
package/src/debug.mjs
CHANGED
|
@@ -45,8 +45,10 @@ import { printQrcode } from './utils-functions.mjs';
|
|
|
45
45
|
export async function mpDebugShell(newAppInfo, isGodot = false) {
|
|
46
46
|
try {
|
|
47
47
|
// ========== 参数验证 ==========
|
|
48
|
-
// Godot 项目不需要 entry
|
|
49
|
-
|
|
48
|
+
// Godot 项目不需要 entry 字段,Web 类型也不需要;
|
|
49
|
+
// 仅普通小程序(非 Godot 且非 Web)需要 entry
|
|
50
|
+
const isWeb = newAppInfo.type === 'web';
|
|
51
|
+
if (!isGodot && !isWeb && !newAppInfo.entry) {
|
|
50
52
|
throw new Error('缺少必需的应用信息: entry');
|
|
51
53
|
}
|
|
52
54
|
|
|
@@ -53,6 +53,12 @@ export class TemplateProcessor {
|
|
|
53
53
|
if (templateType === CONSTANTS.TEMPLATE_TYPES.APP_TEMPLATE) {
|
|
54
54
|
pathsToRemove.push(path.join(tmpdir, 'mini-apps-template'));
|
|
55
55
|
}
|
|
56
|
+
if (templateType === CONSTANTS.TEMPLATE_TYPES.WEB_TEMPLATE) {
|
|
57
|
+
pathsToRemove.push(
|
|
58
|
+
path.join(tmpdir, 'mini-apps-template'),
|
|
59
|
+
path.join(tmpdir, 'mini-game-template')
|
|
60
|
+
);
|
|
61
|
+
}
|
|
56
62
|
|
|
57
63
|
pathsToRemove.forEach(pathToRemove => {
|
|
58
64
|
try {
|