From 3be3cc36fc74989d365f0c3c35b9a1df4be6dec7 Mon Sep 17 00:00:00 2001 From: kdletters Date: Sat, 20 Jun 2026 20:52:34 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=81=E5=AE=9A=E7=A7=BB=E5=8A=A8=E5=A3=B3EA?= =?UTF-8?q?S=E6=9C=AC=E5=9C=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 移动壳构建配置检查执行本地 EAS CLI 版本校验 同步原生壳方案文档和共享决策记录 --- .../scripts/check-eas-build-config.mjs | 29 +++++++++++++++++++ .../shared-memory/decision-log.md | 2 +- ...ExpoReactNative与Tauri宿主壳方案-2026-06-17.md | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/apps/mobile-shell/scripts/check-eas-build-config.mjs b/apps/mobile-shell/scripts/check-eas-build-config.mjs index c83e9f46f..6854103db 100644 --- a/apps/mobile-shell/scripts/check-eas-build-config.mjs +++ b/apps/mobile-shell/scripts/check-eas-build-config.mjs @@ -1,4 +1,5 @@ import fs from 'node:fs'; +import {spawnSync} from 'node:child_process'; const shellRoot = new URL('../', import.meta.url); const easConfigPath = new URL('eas.json', shellRoot); @@ -6,6 +7,7 @@ const packagePath = new URL('package.json', shellRoot); const easConfig = JSON.parse(fs.readFileSync(easConfigPath, 'utf8')); const packageConfig = JSON.parse(fs.readFileSync(packagePath, 'utf8')); +const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm'; function assertObject(value, label) { if (!value || typeof value !== 'object' || Array.isArray(value)) { @@ -28,6 +30,33 @@ if (easConfig.cli.version !== '>= 20.3.0') { throw new Error('mobile shell EAS CLI version gate must stay pinned to the checked devDependency floor'); } +if (packageConfig.devDependencies?.['eas-cli'] !== '^20.3.0') { + throw new Error('mobile shell package must declare the checked EAS CLI devDependency'); +} + +const easVersionResult = spawnSync(npmCommand, ['exec', 'eas', '--', '--version'], { + cwd: shellRoot, + encoding: 'utf8', +}); + +if (easVersionResult.error) { + throw new Error(`failed to start local EAS CLI version check: ${easVersionResult.error.message}`); +} + +if (easVersionResult.signal) { + throw new Error(`local EAS CLI version check was terminated by signal ${easVersionResult.signal}`); +} + +if ((easVersionResult.status ?? 0) !== 0) { + process.stdout.write(easVersionResult.stdout ?? ''); + process.stderr.write(easVersionResult.stderr ?? ''); + process.exit(easVersionResult.status ?? 1); +} + +if (!(easVersionResult.stdout ?? '').trim().startsWith('eas-cli/20.3.0 ')) { + throw new Error('mobile shell local EAS CLI version drifted'); +} + if (easConfig.cli.appVersionSource !== 'local') { throw new Error('mobile shell EAS builds must use local app.json version fields'); } diff --git a/docs/project-memory/shared-memory/decision-log.md b/docs/project-memory/shared-memory/decision-log.md index a39d9f127..658ccce97 100644 --- a/docs/project-memory/shared-memory/decision-log.md +++ b/docs/project-memory/shared-memory/decision-log.md @@ -2974,7 +2974,7 @@ ## 2026-06-20 移动壳 EAS 原生包构建 profile - 背景:移动壳已能通过 Expo managed config 和 Metro production bundle smoke,但缺少原生安装包构建 profile;如果只保留 `expo export`,无法证明 Android / iOS 壳有进入原生分发链路的配置。 -- 决策:新增 `apps/mobile-shell/eas.json` 和 `eas-cli` devDependency。Android `production` profile 使用本地 EAS build 产出内部 APK;iOS `production-simulator` profile 产出 simulator release 包,避免在没有真实签名凭据时写入伪证书配置。两端 profile 都用本地 `app.json` 版本字段并设置 `EXPO_NO_DOTENV=1`,当前不配置商店提交、签名凭据来源、自动递增、OTA runtimeVersion 或 releaseChannel。 +- 决策:新增 `apps/mobile-shell/eas.json` 和 `eas-cli` devDependency。Android `production` profile 使用本地 EAS build 产出内部 APK;iOS `production-simulator` profile 产出 simulator release 包,避免在没有真实签名凭据时写入伪证书配置。两端 profile 都用本地 `app.json` 版本字段并设置 `EXPO_NO_DOTENV=1`,当前不配置商店提交、签名凭据来源、自动递增、OTA runtimeVersion 或 releaseChannel;`check-eas-build-config.mjs` 必须从 `apps/mobile-shell` 目录执行本地 EAS CLI 版本检查,确认解析到受检版本。 - 影响范围:`apps/mobile-shell/eas.json`、`apps/mobile-shell/package.json`、`apps/mobile-shell/scripts/check-eas-build-config.mjs`、`apps/mobile-shell/scripts/check-config.mjs`、`scripts/check-native-shells.mjs`、原生壳方案和验收文档。 - 验证方式:`npm run mobile-shell:build-config`、`npm run mobile-shell:typecheck`、`npm run check:native-shells`、`npm run check:encoding`、`git diff --check`。 diff --git a/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md b/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md index 675a64200..436c6882e 100644 --- a/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md +++ b/docs/【前端架构】ExpoReactNative与Tauri宿主壳方案-2026-06-17.md @@ -515,7 +515,7 @@ GameBridge 禁止: 2026-06-18 追加:移动壳 Metro export 烟测进入统一验收。`npm run check:native-shells` 会执行 `npm run mobile-shell:export`,用 Expo CLI 分别为 Android 和 iOS 生成 production bundle,校验 Metro metadata 与 `AppEntry` bundle 已产出后清理临时 `.expo-export-smoke/` 目录。该烟测不生成 APK、AAB 或 IPA,也不写商店资料,只证明移动壳入口、Expo/RN 依赖和平台差异代码能被真实生产 bundler 打包。 -2026-06-20 追加:移动壳新增 EAS 原生包构建 profile。`apps/mobile-shell/eas.json` 固定 EAS CLI 下限、使用本地 `app.json` 版本字段,并提供 Android `production` 本地构建脚本产出可安装 APK、iOS `production-simulator` 本地构建脚本产出 release simulator 包;两者都设置 `EXPO_NO_DOTENV=1`,避免本机 `.env` 把开发 H5 URL 或私密配置带进可分发包。当前仍不写商店提交 profile、签名凭据来源、自动递增、OTA runtimeVersion 或 releaseChannel;`npm run check:native-shells` 只跑 `mobile-shell:build-config` 校验构建 profile 和脚本,真实 `mobile-shell:build:android` / `mobile-shell:build:ios` 作为具备 Android SDK、Xcode / simulator 环境和 EAS 本地构建依赖时的分发构建命令。 +2026-06-20 追加:移动壳新增 EAS 原生包构建 profile。`apps/mobile-shell/eas.json` 固定 EAS CLI 下限、使用本地 `app.json` 版本字段,并提供 Android `production` 本地构建脚本产出可安装 APK、iOS `production-simulator` 本地构建脚本产出 release simulator 包;两者都设置 `EXPO_NO_DOTENV=1`,避免本机 `.env` 把开发 H5 URL 或私密配置带进可分发包。当前仍不写商店提交 profile、签名凭据来源、自动递增、OTA runtimeVersion 或 releaseChannel;`npm run check:native-shells` 只跑 `mobile-shell:build-config` 校验构建 profile、脚本、本地 `eas-cli` devDependency 和从 `apps/mobile-shell` 目录解析到的 EAS CLI 版本,真实 `mobile-shell:build:android` / `mobile-shell:build:ios` 作为具备 Android SDK、Xcode / simulator 环境和 EAS 本地构建依赖时的分发构建命令。 2026-06-18 追加:登录 / 支付能力伪声明进入门禁。`auth.requestLogin` 和 `payment.request` 保留在共享 HostBridge 契约中供未来真实接入,但 Expo 与 Tauri 壳在没有真实 SDK、渠道流程和后端契约前不得声明这些 capability,也不得把它们写入 `hostCapabilities`;请求到达壳层时必须返回明确 `unsupported_method`,让 H5 fallback 承接。两端壳测试会直接覆盖这两个 method,避免后续半接入时返回伪成功。