固定移动壳本地构建产物路径

移动壳 EAS 本地构建脚本输出到根 build/native/mobile

移动壳配置检查校验 APK 与 iOS simulator 压缩包路径

同步原生壳方案文档和共享决策记录
This commit is contained in:
2026-06-20 21:16:27 +08:00
parent b9abc747da
commit c578f6cf29
5 changed files with 40 additions and 8 deletions
+18 -2
View File
@@ -206,6 +206,10 @@ const rootPackageLock = JSON.parse(fs.readFileSync(rootPackageLockPath, 'utf8'))
const iconPath = new URL('../assets/icon.png', import.meta.url);
const icon = PNG.sync.read(fs.readFileSync(iconPath));
const brandBackgroundColor = '#fffdf9';
const androidBuildOutputPath =
'../../build/native/mobile/genarrative-mobile-android.apk';
const iosSimulatorBuildOutputPath =
'../../build/native/mobile/genarrative-mobile-ios-simulator.tar.gz';
const productionSourceRoots = [
new URL('../App.tsx', import.meta.url),
new URL('../app.json', import.meta.url),
@@ -706,8 +710,8 @@ for (const [scriptName, expected] of Object.entries({
android: 'expo run:android',
ios: 'expo run:ios',
test: 'vitest run -c vitest.config.ts',
'build:android': 'eas build --local --profile production --platform android',
'build:ios': 'eas build --local --profile production-simulator --platform ios',
'build:android': `eas build --local --profile production --platform android --output ${androidBuildOutputPath}`,
'build:ios': `eas build --local --profile production-simulator --platform ios --output ${iosSimulatorBuildOutputPath}`,
'build-config:smoke': 'node scripts/check-eas-build-config.mjs',
'config:smoke': 'node scripts/check-expo-config.mjs',
'export:smoke': 'node scripts/check-expo-export.mjs',
@@ -1217,6 +1221,18 @@ if (easConfig.cli?.version !== '>= 20.3.0' || easConfig.cli?.appVersionSource !=
throw new Error('mobile shell EAS builds must pin CLI floor and use local app version fields');
}
for (const [label, outputPath, extension] of [
['Android', androidBuildOutputPath, '.apk'],
['iOS simulator', iosSimulatorBuildOutputPath, '.tar.gz'],
]) {
if (!outputPath.startsWith('../../build/native/mobile/')) {
throw new Error(`mobile shell ${label} local build output must stay under root build/native/mobile`);
}
if (!outputPath.endsWith(extension)) {
throw new Error(`mobile shell ${label} local build output must end with ${extension}`);
}
}
if (
easConfig.build?.production?.distribution !== 'internal' ||
easConfig.build?.production?.channel !== 'production' ||
@@ -8,6 +8,10 @@ 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';
const androidBuildOutputPath =
'../../build/native/mobile/genarrative-mobile-android.apk';
const iosSimulatorBuildOutputPath =
'../../build/native/mobile/genarrative-mobile-ios-simulator.tar.gz';
function assertObject(value, label) {
if (!value || typeof value !== 'object' || Array.isArray(value)) {
@@ -69,18 +73,30 @@ for (const scriptName of ['build:android', 'build:ios', 'build-config:smoke']) {
if (
packageConfig.scripts['build:android'] !==
'eas build --local --profile production --platform android'
`eas build --local --profile production --platform android --output ${androidBuildOutputPath}`
) {
throw new Error('mobile shell Android package build script drifted');
}
if (
packageConfig.scripts['build:ios'] !==
'eas build --local --profile production-simulator --platform ios'
`eas build --local --profile production-simulator --platform ios --output ${iosSimulatorBuildOutputPath}`
) {
throw new Error('mobile shell iOS package build script drifted');
}
for (const [label, outputPath, extension] of [
['Android', androidBuildOutputPath, '.apk'],
['iOS simulator', iosSimulatorBuildOutputPath, '.tar.gz'],
]) {
if (!outputPath.startsWith('../../build/native/mobile/')) {
throw new Error(`mobile shell ${label} local build output must stay under root build/native/mobile`);
}
if (!outputPath.endsWith(extension)) {
throw new Error(`mobile shell ${label} local build output must end with ${extension}`);
}
}
if (packageConfig.scripts['build-config:smoke'] !== 'node scripts/check-eas-build-config.mjs') {
throw new Error('mobile shell EAS config smoke script drifted');
}