Align staging/production builds with APP_VARIANT bundle IDs, allow staging HTTP on iOS, add ios-prebuild scripts for TestFlight, and show connected API URL on About for non-production builds. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
772 B
JavaScript
23 lines
772 B
JavaScript
/**
|
||
* 将 app-expo/.env.<name> 复制为 .env,供 Metro/Expo 读取 EXPO_PUBLIC_*。
|
||
*
|
||
* 参数 name → 源文件:
|
||
* development → .env.development(仓库已提交;npm start / prestart 默认)
|
||
* staging → .env.staging
|
||
* production → .env.production
|
||
*
|
||
* CI:.github/workflows/app-expo-deploy.yml 按分支/tag 调用本脚本,与后端 env 策略对齐。
|
||
*/
|
||
const fs = require('fs');
|
||
const path = require('path');
|
||
const env = process.argv[2] || 'development';
|
||
const src = path.join(__dirname, '..', `.env.${env}`);
|
||
const dest = path.join(__dirname, '..', '.env');
|
||
if (fs.existsSync(src)) {
|
||
fs.copyFileSync(src, dest);
|
||
console.log(`Switched to .env.${env}`);
|
||
} else {
|
||
console.error(`Missing .env.${env}`);
|
||
process.exit(1);
|
||
}
|