@htyf-mp/cli 0.7.2 → 0.7.4

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
@@ -105,7 +105,9 @@ node src/index.mjs
105
105
  3. 提示输入版本号(默认在当前版本基础上自动 +1,例如 `1.0.0 -> 1.0.1`)。
106
106
  4. 更新 `app.json` 中的版本号并执行构建,将资源输出到 `dist` 目录。
107
107
 
108
- 构建完成后,可以将产物上传到 `zipUrl` 指定的地址,供红糖云服 App 拉取与更新。
108
+ 构建完成后,会在压缩包旁生成 `dist/qrcode.png`,并在终端显示分享链接和二维码。扫码进入应用分享页,二维码包含本次构建的应用信息和版本。原有 `dist/dist/qrcode.png` 仍为资源下载二维码。
109
+
110
+ 使用分享二维码前,请将资源包和 `app.json` 分别上传到配置中的 `zipUrl` 和 `appUrlConfig` 地址,供红糖云服 App 拉取与更新。
109
111
 
110
112
  ### 真机调试
111
113
 
@@ -146,4 +148,3 @@ node src/index.mjs --clean cache # 清理缓存文件
146
148
  > - React Native 应用小程序:`_apps_temp_/README.md`
147
149
  > - Godot 游戏小程序:`_game_temp_/README.md`
148
150
  > - Web/H5 小程序:`_web_temp_/RADME.md`
149
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htyf-mp/cli",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "红糖云服app小程序模板-cli",
5
5
  "type": "module",
6
6
  "bin": {
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "e19498f682a2b6c7d1c9ac07616ef7460ed52e14"
85
+ "gitHead": "d6e78c9de9837bedf71d540c7129c3d1eeb4c3ee"
86
86
  }
package/src/build.mjs CHANGED
@@ -83,6 +83,7 @@ async function syncWebH5Output(projectDistRoot, zipInputDir) {
83
83
  'build', // RN bundle 输出目录
84
84
  'app.json',
85
85
  'manifest.json',
86
+ 'qrcode.png', // 分享图片不属于 H5 应用资源
86
87
  ]);
87
88
 
88
89
  for (const entry of entries) {
@@ -117,6 +118,16 @@ async function generateBuildQrCode(outputPath, appJson) {
117
118
  Logger.success(`二维码已生成: ${qrFilePath}`);
118
119
  }
119
120
 
121
+ /** 在压缩包旁生成分享二维码,使用与 App 分享页一致的应用信息协议。 */
122
+ async function generateShareQrCode(outputPath, appJson) {
123
+ const shareUrl = `https://mp.dagouzhi.com/share?data=${encodeURIComponent(JSON.stringify(appJson))}`;
124
+ const qrFilePath = path.join(outputPath, 'qrcode.png');
125
+ await QRCode.toFile(qrFilePath, shareUrl, { scale: 6, margin: 4 });
126
+ Logger.success(`分享二维码已生成: ${qrFilePath}`);
127
+ Logger.info(`分享链接: ${shareUrl}`);
128
+ console.log(await QRCode.toString(shareUrl, { type: 'terminal', small: true }));
129
+ }
130
+
120
131
  /**
121
132
  * 压缩文件夹为 ZIP 文件
122
133
  *
@@ -411,10 +422,10 @@ export async function mpBuildShell(newAppInfo, isGodot = false, buildOptions = {
411
422
  // 压缩输出目录为最终包
412
423
  const zipPath = await handleZip(outputPath, distPackagePath);
413
424
  Logger.success(`压缩包已创建: ${zipPath}`);
425
+ await generateShareQrCode(mpOutputPath, appJson);
414
426
  return zipPath;
415
427
  } catch (error) {
416
428
  Logger.error(`小程序构建失败: ${error.message}`);
417
429
  throw error;
418
430
  }
419
431
  }
420
-