Update files
This commit is contained in:
@@ -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: {
|
||||
|
||||
+6
-17
@@ -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": {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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}"
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user