diff --git a/.env.development b/.env.development index 359221c888..be1080d6da 100644 --- a/.env.development +++ b/.env.development @@ -11,8 +11,8 @@ VITE_WEBSOCKET_HOST=localhost VITE_WEBSOCKET_PORT=3001 # CAPACITOR -# Local IP addresses should only be defined in .env.development.local so that they are not checked into version control. -CAPACITOR_SERVER_URL= +# This is the default address the vite dev server runs at – change in .env.development.local if necessary. +CAPACITOR_SERVER_URL=http://localhost:3000 # AI SERVER VITE_AI_URL=http://localhost:3001/ai diff --git a/capacitor.config.ts b/capacitor.config.ts index 35a76c6d6d..4cfc0ea39e 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -3,13 +3,15 @@ import * as dotenv from 'dotenv' import * as path from 'path' const nodeEnv = process.env.NODE_ENV || 'development' -console.info(`Configuring ${nodeEnv} build`) +const buildMode = process.env.BUILD_MODE || 'server' +console.info(`Configuring ${nodeEnv} build in ${buildMode} mode`) + dotenv.config({ path: path.resolve(process.cwd(), '.env') }) -dotenv.config({ path: path.resolve(process.cwd(), `.env.${nodeEnv}`) }) -dotenv.config({ path: path.resolve(process.cwd(), `.env.${nodeEnv}.local`) }) +dotenv.config({ path: path.resolve(process.cwd(), `.env.${nodeEnv}`), override: true }) +dotenv.config({ path: path.resolve(process.cwd(), `.env.${nodeEnv}.local`), override: true }) const serverConfig = - nodeEnv === 'development' + nodeEnv === 'development' && buildMode === 'server' ? { server: { url: process.env.CAPACITOR_SERVER_URL, diff --git a/package.json b/package.json index 21b25fb9c7..aa02b4b5be 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,14 @@ "browserless": "docker run -p 7566:3000 -e \"CONNECTION_TIMEOUT=-1\" browserless/chrome", "build": "yarn build:styles && vite build", "build:styles": "echo \"Building styles...\" && panda codegen", - "cap:android": "yarn cap:sync && cap open android", + "cap:android": "yarn cap:android:dev", + "cap:ios": "yarn cap:ios:dev", + "cap:android:dev": "BUILD_MODE=server yarn cap:sync && cap open android", + "cap:ios:dev": "BUILD_MODE=server yarn cap:sync && cap open ios", + "cap:android:static": "yarn build && BUILD_MODE=static yarn cap:sync && cap open android", + "cap:ios:static": "yarn build && BUILD_MODE=static yarn cap:sync && cap open ios", "cap:copy:prod": "NODE_ENV=production && cap copy", "cap:copy": "NODE_ENV=development && cap copy", - "cap:ios": "yarn cap:sync && cap open ios", "cap:sync:prod": "yarn build && NODE_ENV=production cap sync", "cap:sync": "NODE_ENV=development && cap sync", "clean": "rm -rf ./node_modules/.cache && rm -rf ./node_modules/.vite && rm -rf .eslintcache",