create-automaticgpt-template
Version:
AutomaticGPT - A production-ready Expo template with AI chat, authentication, conversation management, analytics, and sharing features
117 lines (96 loc) ⢠3.24 kB
JavaScript
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
console.log('š iOS Deployment Setup Helper\n');
// Check if EAS CLI is installed
function checkEASCLI() {
try {
execSync('eas --version', { stdio: 'pipe' });
console.log('ā
EAS CLI is installed');
return true;
} catch (error) {
console.log('ā EAS CLI not found');
console.log('š¦ Installing EAS CLI...');
try {
execSync('npm install -g @expo/eas-cli', { stdio: 'inherit' });
console.log('ā
EAS CLI installed successfully');
return true;
} catch (installError) {
console.log('ā Failed to install EAS CLI');
console.log('Please run: npm install -g @expo/eas-cli');
return false;
}
}
}
// Check if user is logged in to EAS
function checkEASLogin() {
try {
const result = execSync('eas whoami', { stdio: 'pipe', encoding: 'utf8' });
console.log(`ā
Logged in as: ${result.trim()}`);
return true;
} catch (error) {
console.log('ā Not logged in to EAS');
console.log('Please run: eas login');
return false;
}
}
// Check app.json configuration
function checkAppConfig() {
const appJsonPath = path.join(process.cwd(), 'app.json');
if (!fs.existsSync(appJsonPath)) {
console.log('ā app.json not found');
return false;
}
const appJson = JSON.parse(fs.readFileSync(appJsonPath, 'utf8'));
const ios = appJson.expo?.ios;
if (!ios?.bundleIdentifier) {
console.log('ā Bundle identifier not set in app.json');
console.log('Please update app.json with your bundle identifier');
return false;
}
if (ios.bundleIdentifier.includes('yourcompany')) {
console.log('ā ļø Bundle identifier still contains placeholder');
console.log(`Current: ${ios.bundleIdentifier}`);
console.log('Please update with your actual company/domain name');
return false;
}
console.log(`ā
Bundle identifier: ${ios.bundleIdentifier}`);
return true;
}
// Check if .env file exists
function checkEnvFile() {
const envPath = path.join(process.cwd(), '.env');
if (!fs.existsSync(envPath)) {
console.log('ā ļø .env file not found');
console.log('Copy .env.example to .env and fill in your values');
return false;
}
console.log('ā
.env file exists');
return true;
}
// Main setup check
function main() {
console.log('Checking iOS deployment setup...\n');
const checks = [
{ name: 'EAS CLI Installation', fn: checkEASCLI },
{ name: 'EAS Login', fn: checkEASLogin },
{ name: 'App Configuration', fn: checkAppConfig },
{ name: 'Environment Variables', fn: checkEnvFile },
];
let allPassed = true;
checks.forEach((check) => {
console.log(`\nš ${check.name}:`);
const passed = check.fn();
if (!passed) allPassed = false;
});
console.log('\n' + '='.repeat(50));
if (allPassed) {
console.log('š Setup complete! You can now build for iOS:');
console.log(' eas build --platform ios --profile preview');
} else {
console.log('ā Setup incomplete. Please address the issues above.');
console.log('š See docs/deployment/IOS_DEPLOYMENT.md for detailed instructions');
}
}
main();