Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capacitor build script fixes #2516

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions capacitor.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down