()
| 35 | } |
| 36 | |
| 37 | async function main() { |
| 38 | const spinner = ora({ |
| 39 | text: 'Creating codebase' |
| 40 | }) |
| 41 | try { |
| 42 | const kebabRegez = /^([a-z]+)(-[a-z0-9]+)*$/ |
| 43 | |
| 44 | program |
| 45 | .name('React Native AI') |
| 46 | .description('Full Stack React Native Boilerplate for building streaming AI apps.') |
| 47 | |
| 48 | program.parse(process.argv) |
| 49 | |
| 50 | const args = program.args |
| 51 | let appName = args[0] |
| 52 | |
| 53 | if (!appName || !kebabRegez.test(args[0])) { |
| 54 | appName = await input({ |
| 55 | message: 'Enter your app name', |
| 56 | default: 'rn-ai', |
| 57 | validate: d => { |
| 58 | if(!kebabRegez.test(d)) { |
| 59 | return 'please enter your app name in the format of my-app-name' |
| 60 | } |
| 61 | return true |
| 62 | } |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | const withEnv = await select({ |
| 67 | message: 'Configure environment variables now?', |
| 68 | choices: [ |
| 69 | { |
| 70 | name: 'Yes', |
| 71 | value: 'yes', |
| 72 | }, |
| 73 | { |
| 74 | name: 'No', |
| 75 | value: 'no', |
| 76 | } |
| 77 | ] |
| 78 | }) |
| 79 | |
| 80 | let clientEnvs = ` |
| 81 | EXPO_PUBLIC_ENV="DEVELOPMENT" |
| 82 | |
| 83 | # Your development URL (localhost or ngrok) |
| 84 | EXPO_PUBLIC_DEV_API_URL="http://localhost:3050" |
| 85 | |
| 86 | # Your production URL |
| 87 | EXPO_PUBLIC_PROD_API_URL="https://staging.example.com" |
| 88 | ` |
| 89 | |
| 90 | let envs = ` |
| 91 | # environment, either PRODUCTION or DEVELOPMENT |
| 92 | ENVIRONMENT="PRODUCTION" |
| 93 | |
| 94 | # OpenAI https://platform.openai.com |
no test coverage detected