Update files

This commit is contained in:
Mohamed Boudra
2026-02-07 17:51:06 +07:00
parent f9ebf6b523
commit 5b77cd4805
8 changed files with 28 additions and 187 deletions

View File

@@ -106,55 +106,33 @@ Take screenshots like this: `adb exec-out screencap -p > screenshot.png`
Use `APP_VARIANT` in `packages/app/app.config.js` to control app name + package ID (no custom Gradle flavor plugin):
- `prod` -> app name `Paseo`, package `sh.paseo`
- `debug` -> app name `Paseo Debug`, package `sh.paseo.debug`
- `fast` -> app name `Paseo Dev`, package `sh.paseo.dev`
- `production` -> app name `Paseo`, package `sh.paseo`
- `development` -> app name `Paseo Dev`, package `sh.paseo.dev`
EAS profiles live in `packages/app/eas.json` as `prod`, `debug`, and `fast`.
EAS profiles live in `packages/app/eas.json` as `development` and `production`.
`fast` uses Android `debugOptimized` for better runtime performance while still supporting Metro/Fast Refresh.
`development` uses Android `debug`.
### Local build + install (Android device)
From `packages/app`:
```bash
# prod (release)
APP_VARIANT=prod npx expo prebuild --platform android --clean --no-install
(cd android && ./gradlew app:assembleRelease)
adb install -r android/app/build/outputs/apk/release/app-release.apk
# development (debug)
APP_VARIANT=development npx expo run:android --variant=debug
# debug (full debug tooling)
APP_VARIANT=debug npx expo prebuild --platform android --clean --no-install
(cd android && ./gradlew app:assembleDebug)
adb install -r android/app/build/outputs/apk/debug/app-debug.apk
# fast (debugOptimized + Metro/Fast Refresh)
APP_VARIANT=fast npx expo prebuild --platform android --clean --no-install
(cd android && ./gradlew app:assembleDebugOptimized)
adb install -r android/app/build/outputs/apk/debugOptimized/app-debugOptimized.apk
# production (release)
APP_VARIANT=production npx expo run:android --variant=release
```
### Android dev + build scripts (Metro-enabled)
From repo root:
```bash
# Run on phone (installs/launches variant and sets debug_http_host)
npm run android:fast
npm run android:debug
# Build APKs (for shipping over the wire)
npm run android:fast:build
npm run android:debug:build
npm run android:development
npm run android:production
```
Notes:
- Both dev variants are Metro-enabled by default and set `debug_http_host` via adb.
- Default Metro endpoint is `localhost:8080`.
- If `localhost:8080` is not running but `localhost:8081` is, scripts auto-fallback to `localhost:8081`.
- For localhost endpoints, scripts also run `adb reverse tcp:<port> tcp:<port>` automatically.
- Override with `METRO_ENDPOINT=host:port` (for example `METRO_ENDPOINT=192.168.1.25:8081`).
`npm run android:prod` and `npm run android:release` are aliases for `npm run android:production`.
## Testing with Playwright MCP

View File

@@ -23,11 +23,9 @@
"format:check": "prettier --check .",
"start": "npm run start --workspace=@getpaseo/server",
"android": "npm run android --workspace=@getpaseo/app",
"android:fast": "npm run android:fast --workspace=@getpaseo/app",
"android:debug": "npm run android:debug --workspace=@getpaseo/app",
"android:fast:build": "npm run android:fast:build --workspace=@getpaseo/app",
"android:debug:build": "npm run android:debug:build --workspace=@getpaseo/app",
"android:development": "npm run android:development --workspace=@getpaseo/app",
"android:prod": "npm run android:prod --workspace=@getpaseo/app",
"android:production": "npm run android:production --workspace=@getpaseo/app",
"android:release": "npm run android:prod --workspace=@getpaseo/app",
"ios": "npm run ios --workspace=@getpaseo/app",
"web": "npm run web --workspace=@getpaseo/app",

View File

@@ -1,22 +1,18 @@
const pkg = require("./package.json");
const appVariant = process.env.APP_VARIANT ?? "prod";
const appVariant = process.env.APP_VARIANT ?? "production";
const variants = {
prod: {
production: {
name: "Paseo",
packageId: "sh.paseo",
},
debug: {
name: "Paseo Debug",
packageId: "sh.paseo.debug",
},
fast: {
development: {
name: "Paseo Dev",
packageId: "sh.paseo.dev",
},
};
const variant = variants[appVariant] ?? variants.prod;
const variant = variants[appVariant] ?? variants.production;
export default {
expo: {

View File

@@ -3,36 +3,25 @@
"version": ">= 14.0.0"
},
"build": {
"debug": {
"development": {
"developmentClient": true,
"distribution": "internal",
"channel": "debug",
"channel": "development",
"env": {
"APP_VARIANT": "debug"
"APP_VARIANT": "development"
},
"android": {
"gradleCommand": ":app:assembleDebug"
}
},
"fast": {
"developmentClient": true,
"distribution": "internal",
"channel": "fast",
"env": {
"APP_VARIANT": "fast"
},
"android": {
"gradleCommand": ":app:assembleDebugOptimized"
}
},
"prod": {
"production": {
"channel": "production",
"env": {
"APP_VARIANT": "prod"
"APP_VARIANT": "production"
}
}
},
"submit": {
"prod": {}
"production": {}
}
}

View File

@@ -5,13 +5,11 @@
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "npm run android:fast",
"android:fast": "APP_VARIANT=fast bash ./scripts/android-run-variant.sh",
"android:debug": "APP_VARIANT=debug bash ./scripts/android-run-variant.sh",
"android:fast:build": "APP_VARIANT=fast bash ./scripts/android-build-variant.sh",
"android:debug:build": "APP_VARIANT=debug bash ./scripts/android-build-variant.sh",
"android:prod": "APP_VARIANT=prod npx expo prebuild --platform android --clean --no-install && (cd android && ./gradlew clean app:assembleRelease --rerun-tasks) && adb install -r android/app/build/outputs/apk/release/app-release.apk",
"android:release": "npm run android:prod",
"android": "npm run android:development",
"android:development": "APP_VARIANT=development expo run:android --variant=debug",
"android:production": "APP_VARIANT=production expo run:android --variant=release",
"android:prod": "npm run android:production",
"android:release": "npm run android:production",
"ios": "expo run:ios",
"ios:release": "expo run:ios --configuration Release",
"web": "expo start --web",

View File

@@ -1,24 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
app_variant="${APP_VARIANT:-fast}"
case "$app_variant" in
fast)
gradle_task="app:assembleDebugOptimized"
apk_path="android/app/build/outputs/apk/debugOptimized/app-debugOptimized.apk"
;;
debug)
gradle_task="app:assembleDebug"
apk_path="android/app/build/outputs/apk/debug/app-debug.apk"
;;
*)
echo "APP_VARIANT must be one of: fast, debug"
exit 1
;;
esac
APP_VARIANT="$app_variant" npx expo prebuild --platform android --clean --no-install
(cd android && ./gradlew "$gradle_task")
echo "Built APK: ${apk_path}"

View File

@@ -1,73 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
app_variant="${APP_VARIANT:-fast}"
metro_endpoint="${METRO_ENDPOINT:-localhost:8080}"
launch_app="${LAUNCH_APP:-1}"
case "$app_variant" in
fast)
package_id="sh.paseo.dev"
app_name="Paseo Dev"
;;
debug)
package_id="sh.paseo.debug"
app_name="Paseo Debug"
;;
*)
echo "APP_VARIANT must be one of: fast, debug"
exit 1
;;
esac
if ! [[ "$metro_endpoint" =~ ^[A-Za-z0-9._-]+:[0-9]{1,5}$ ]]; then
echo "Invalid METRO_ENDPOINT '$metro_endpoint'. Expected host:port (for example macbook:8081)."
exit 1
fi
if ! command -v adb >/dev/null 2>&1; then
echo "adb is not installed or not on PATH."
exit 1
fi
if ! adb get-state >/dev/null 2>&1; then
echo "No Android device detected by adb."
exit 1
fi
metro_host="${metro_endpoint%:*}"
metro_port="${metro_endpoint##*:}"
if [[ "$metro_host" == "localhost" || "$metro_host" == "127.0.0.1" ]]; then
if ! lsof -nP -iTCP:"${metro_port}" -sTCP:LISTEN >/dev/null 2>&1; then
if [[ "$metro_port" == "8080" ]] && lsof -nP -iTCP:8081 -sTCP:LISTEN >/dev/null 2>&1; then
metro_endpoint="localhost:8081"
metro_host="localhost"
metro_port="8081"
echo "Metro was not listening on localhost:8080; using localhost:8081."
else
echo "No Metro server detected on ${metro_endpoint}. Start Metro there or set METRO_ENDPOINT=host:port."
exit 1
fi
fi
adb reverse "tcp:${metro_port}" "tcp:${metro_port}" >/dev/null 2>&1 || true
fi
prefs_file="${package_id}_preferences.xml"
prefs_path="shared_prefs/${prefs_file}"
prefs_xml="<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>
<map>
<string name=\"debug_http_host\">${metro_endpoint}</string>
</map>"
adb shell run-as "$package_id" mkdir -p shared_prefs
printf '%s\n' "$prefs_xml" | adb shell run-as "$package_id" tee "$prefs_path" >/dev/null
echo "Configured ${app_name} (${package_id}) to use Metro at ${metro_endpoint}."
if [[ "$launch_app" == "1" ]]; then
adb shell am force-stop "$package_id" >/dev/null 2>&1 || true
adb shell monkey -p "$package_id" -c android.intent.category.LAUNCHER 1 >/dev/null
echo "Launched ${app_name}."
fi

View File

@@ -1,21 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
app_variant="${APP_VARIANT:-fast}"
metro_endpoint="${METRO_ENDPOINT:-localhost:8080}"
case "$app_variant" in
fast)
gradle_variant="debugOptimized"
;;
debug)
gradle_variant="debug"
;;
*)
echo "APP_VARIANT must be one of: fast, debug"
exit 1
;;
esac
APP_VARIANT="$app_variant" npx expo run:android --variant="$gradle_variant"
APP_VARIANT="$app_variant" METRO_ENDPOINT="$metro_endpoint" LAUNCH_APP=1 bash ./scripts/android-configure-metro-host.sh