Files
life-echo/app-expo/scripts/use-env.js
Kevin 6d281c92a5 feat(app-expo): env variants, local iOS prebuild, and About diagnostics
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>
2026-05-19 15:43:16 +08:00

23 lines
772 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 将 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);
}