create-disposabl-app 0.16.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -47,14 +47,15 @@ For example, create a web and mobile app with sign-in:
47
47
  bunx create-disposabl-app@latest my-app --platforms web,ios,android --yes
48
48
  ```
49
49
 
50
- | Option | What it does |
51
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
- | `--platforms <ids>` | Choose `web`, `ios`, `android`, `macos`, `windows`, `linux`, `mcp`, `api`, `cli`, or `typescript-sdk`. Separate multiple choices with commas. Web is always included. |
53
- | `--features <ids>` | Choose features from `--list-options`, such as `authentication` and `docs`. The default is `authentication`. Use `--features none` to omit optional features. |
54
- | `--yes` | Skip the name, platform, and feature questions. Supply an app name in the command. |
55
- | `--list-options` | Show available platforms and features without creating an app. |
56
- | `--skip-install` | Create files without installing dependencies. Account setup still runs. |
57
- | `--json` | Return a result coding agents can read. Supply an app name. Account setup still runs. |
50
+ | Option | What it does |
51
+ | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
+ | `--platforms <ids>` | Choose `web`, `ios`, `android`, `macos`, `windows`, `linux`, `mcp`, `api`, `cli`, or `typescript-sdk`. Separate multiple choices with commas. Web is always included. |
53
+ | `--android-architectures <ids>` | Choose Android ABIs for one APK. Defaults to `arm64-v8a,x86_64`; `armeabi-v7a` and `x86` are also supported. |
54
+ | `--features <ids>` | Choose features from `--list-options`, such as `authentication` and `docs`. The default is `authentication`. Use `--features none` to omit optional features. |
55
+ | `--yes` | Skip the name, platform, and feature questions. Supply an app name in the command. |
56
+ | `--list-options` | Show available platforms and features without creating an app. |
57
+ | `--skip-install` | Create files without installing dependencies. Account setup still runs. |
58
+ | `--json` | Return a result coding agents can read. Supply an app name. Account setup still runs. |
58
59
 
59
60
  CLI and TypeScript SDK include API support automatically. Backend authentication and access checks remain installed even with `--features none`.
60
61
 
@@ -68,6 +69,8 @@ npx create-disposabl-app@<version> my-app --reconfigure-only --features authenti
68
69
 
69
70
  Supply the complete desired feature list. Add `--platforms` with a complete list to change platforms too. Omitted lists stay unchanged. Run `bun install` in the app afterward, review the diff, and test affected platforms. The code-only command does not log in, provision providers, commit, or deploy. Store and payment-provider configuration is a separate step.
70
71
 
72
+ Use `--android-architectures arm64-v8a,x86_64` to change the Android ABI selection. This replaces the list and requires a compatible new native build; it does not create separate APKs.
73
+
71
74
  ## Resume setup
72
75
 
73
76
  Your files are saved. Follow the error's instructions, then run the same command from the parent folder:
package/dist/disposabl.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // ../cli/auth.ts
4
4
  import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
- var version = "0.16.0";
6
+ var version = "0.17.1";
7
7
  var package_default = {
8
8
  name: "@disposabl/cli",
9
9
  version,
package/dist/index.js CHANGED
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
1563
1563
  import { Command, CommanderError } from "commander";
1564
1564
  import * as p2 from "@clack/prompts";
1565
1565
  // package.json
1566
- var version = "0.16.0";
1566
+ var version = "0.17.1";
1567
1567
 
1568
1568
  // ../cli/telemetry.ts
1569
1569
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
@@ -9168,6 +9168,31 @@ async function omitMobilePayments(root) {
9168
9168
  await rm3(join3(root, nativeBillingTest), { force: true });
9169
9169
  }
9170
9170
 
9171
+ // ../disposabl-kit/android-architectures.ts
9172
+ var androidArchitectures = [
9173
+ "arm64-v8a",
9174
+ "x86_64",
9175
+ "armeabi-v7a",
9176
+ "x86"
9177
+ ];
9178
+ var defaultAndroidArchitectures = [
9179
+ "arm64-v8a",
9180
+ "x86_64"
9181
+ ];
9182
+ function validateAndroidArchitectures(values = defaultAndroidArchitectures) {
9183
+ if (!Array.isArray(values) || values.length === 0)
9184
+ throw new Error("Select at least one Android architecture.");
9185
+ const selected = new Set;
9186
+ for (const value of values) {
9187
+ if (typeof value !== "string" || !androidArchitectures.includes(value))
9188
+ throw new Error(`Unknown Android architecture: ${JSON.stringify(value)}.`);
9189
+ if (selected.has(value))
9190
+ throw new Error(`Duplicate Android architecture: ${value}.`);
9191
+ selected.add(value);
9192
+ }
9193
+ return androidArchitectures.filter((value) => selected.has(value));
9194
+ }
9195
+
9171
9196
  // scaffold.ts
9172
9197
  var authStarterPaths = [
9173
9198
  "packages/disposabl-kit/client/routes/_auth-pages",
@@ -9182,7 +9207,8 @@ async function createApp(template, destination, name, config, overwrite = false)
9182
9207
  ...config,
9183
9208
  desktopId: config.desktopId ?? randomUUID2().replaceAll("-", ""),
9184
9209
  platforms: selectPlatforms(config.platforms.join(",")),
9185
- features: selectFeatures(config.features.join(",") || "none")
9210
+ features: selectFeatures(config.features.join(",") || "none"),
9211
+ androidArchitectures: validateAndroidArchitectures(config.androidArchitectures)
9186
9212
  };
9187
9213
  const folders = selectedFolders(config);
9188
9214
  const skill = join4(template, "packages/skill");
@@ -9449,7 +9475,8 @@ async function reconfigureApp(template, directory, version, options) {
9449
9475
  ...existing,
9450
9476
  desktopId: existing.desktopId ?? randomUUID3().replaceAll("-", ""),
9451
9477
  platforms: options.platforms === undefined ? oldPlatforms : selectPlatforms(options.platforms),
9452
- features: options.features === undefined ? oldFeatures : selectFeatures(options.features)
9478
+ features: options.features === undefined ? oldFeatures : selectFeatures(options.features),
9479
+ androidArchitectures: validateAndroidArchitectures(options.androidArchitectures === undefined ? existing.androidArchitectures : options.androidArchitectures.split(",").map((value) => value.trim()))
9453
9480
  };
9454
9481
  const comparisonPlatforms = JSON.stringify(oldFeatures) !== JSON.stringify(config.features) && !oldPlatforms.some((platform) => ["android", "ios"].includes(platform)) && await safeRead(directory, join5("apps", "mobile", "package.json")) ? selectPlatforms([...oldPlatforms, "android"].join(",")) : oldPlatforms;
9455
9482
  const combined = {
@@ -9626,6 +9653,7 @@ async function setupApp(directory, name, run = runDisposabl) {
9626
9653
  if (run === runDisposabl)
9627
9654
  run = (args, interactive) => runDisposabl(args, interactive, origin);
9628
9655
  config.features = resolveFeatures(config.features ?? []);
9656
+ config.androidArchitectures = validateAndroidArchitectures(config.androidArchitectures);
9629
9657
  await writeFile6(path, JSON.stringify(config, null, 2) + `
9630
9658
  `);
9631
9659
  const status = await run(["login", "status"]);
@@ -9655,7 +9683,9 @@ async function setupApp(directory, name, run = runDisposabl) {
9655
9683
  "--platforms",
9656
9684
  JSON.stringify(config.platforms),
9657
9685
  "--features",
9658
- JSON.stringify(config.features)
9686
+ JSON.stringify(config.features),
9687
+ "--androidArchitectures",
9688
+ JSON.stringify(config.androidArchitectures)
9659
9689
  ]);
9660
9690
  config.appId = app.appId;
9661
9691
  await writeFile6(path, JSON.stringify(config, null, 2) + `
@@ -9665,7 +9695,7 @@ async function setupApp(directory, name, run = runDisposabl) {
9665
9695
  stdio: "pipe"
9666
9696
  });
9667
9697
  }
9668
- await run([
9698
+ const configured = await run([
9669
9699
  "previews",
9670
9700
  "token",
9671
9701
  "create",
@@ -9677,9 +9707,24 @@ async function setupApp(directory, name, run = runDisposabl) {
9677
9707
  JSON.stringify(config.platforms),
9678
9708
  "--features",
9679
9709
  JSON.stringify(config.features),
9710
+ "--androidArchitectures",
9711
+ JSON.stringify(config.androidArchitectures),
9712
+ "--configurationLease",
9713
+ "true",
9680
9714
  "--configure",
9681
9715
  directory
9682
9716
  ]);
9717
+ if (configured?.configured !== true || !Number.isSafeInteger(configured.configurationLeaseUntil) || configured.configurationLeaseUntil <= 0)
9718
+ throw new Error("Local configuration did not return a valid setup lease. Retry setup.");
9719
+ await run([
9720
+ "previews",
9721
+ "token",
9722
+ "complete",
9723
+ "--appId",
9724
+ config.appId,
9725
+ "--until",
9726
+ String(configured.configurationLeaseUntil)
9727
+ ]);
9683
9728
  return config.appId;
9684
9729
  }
9685
9730
  async function install(directory, interactive) {
@@ -9719,7 +9764,7 @@ function commitApp(directory) {
9719
9764
 
9720
9765
  // index.ts
9721
9766
  var jsonOutput = process.argv.slice(2).includes("--json");
9722
- var program = new Command("create-disposabl-app").description("Create a Disposabl starter. Web is always included.").version(version, "-v, --version").argument("[appname]", "App name and new directory").option("--platforms <ids>", "Comma-separated platform IDs; Web is always included").option("--features <ids>", "Comma-separated feature IDs, or none (default: authentication)").option("-y, --yes", "Skip app options prompts; include Web and authentication by default").option("--skip-install", "Create files without running bun install").option("--reconfigure-only", "Change an existing app's code and selections without login or provider setup").option("--app-id <uuid>", "Set up an existing Disposabl app in this directory").option("--list-options", "List every platform and feature, including disabled choices").option("--json", "Skip app options prompts and emit JSON; login and install logs go to stderr").helpOption("-h, --help").addHelpText("after", `
9767
+ var program = new Command("create-disposabl-app").description("Create a Disposabl starter. Web is always included.").version(version, "-v, --version").argument("[appname]", "App name and new directory").option("--platforms <ids>", "Comma-separated platform IDs; Web is always included").option("--features <ids>", "Comma-separated feature IDs, or none (default: authentication)").option("--android-architectures <ids>", "Android ABIs (default: arm64-v8a,x86_64; optional: armeabi-v7a,x86)").option("-y, --yes", "Skip app options prompts; include Web and authentication by default").option("--skip-install", "Create files without running bun install").option("--reconfigure-only", "Change an existing app's code and selections without login or provider setup").option("--app-id <uuid>", "Set up an existing Disposabl app in this directory").option("--list-options", "List every platform and feature, including disabled choices").option("--json", "Skip app options prompts and emit JSON; login and install logs go to stderr").helpOption("-h, --help").addHelpText("after", `
9723
9768
  Disposabl collects limited generator usage when configured. Set DO_NOT_TRACK=1 to opt out.
9724
9769
 
9725
9770
  Platforms:
@@ -9798,11 +9843,12 @@ async function main() {
9798
9843
  return showOptions(Boolean(options.json));
9799
9844
  if (options.reconfigureOnly && options.appId)
9800
9845
  throw new Error("--reconfigure-only cannot be combined with --app-id.");
9801
- if (options.reconfigureOnly && options.platforms === undefined && options.features === undefined)
9802
- throw new Error("--reconfigure-only requires --platforms or --features.");
9846
+ if (options.reconfigureOnly && options.platforms === undefined && options.features === undefined && options.androidArchitectures === undefined)
9847
+ throw new Error("--reconfigure-only requires --platforms, --features or --android-architectures.");
9803
9848
  const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY && !p2.isCI() && !options.yes && !options.json);
9804
9849
  let chosenPlatforms = selectPlatforms(options.platforms);
9805
9850
  let chosenFeatures = selectFeatures(options.features);
9851
+ const chosenAndroidArchitectures = validateAndroidArchitectures(options.androidArchitectures === undefined ? undefined : options.androidArchitectures.split(",").map((value) => value.trim()));
9806
9852
  let name = program.args[0];
9807
9853
  if (interactive) {
9808
9854
  if (!name)
@@ -9827,7 +9873,7 @@ async function main() {
9827
9873
  if (existing.appId !== options.appId)
9828
9874
  throw new Error("This directory belongs to a different app. Choose a new directory.");
9829
9875
  }
9830
- if (options.platforms !== undefined || options.features !== undefined) {
9876
+ if (options.platforms !== undefined || options.features !== undefined || options.androidArchitectures !== undefined) {
9831
9877
  const template = fileURLToPath2(new URL("./templates/default", import.meta.url));
9832
9878
  await reconfigureApp(template, directory, version, options);
9833
9879
  if (!options.skipInstall)
@@ -9892,7 +9938,8 @@ Setup complete.
9892
9938
  ...options.appId ? { appId: options.appId } : {},
9893
9939
  version,
9894
9940
  platforms: chosenPlatforms,
9895
- features: chosenFeatures
9941
+ features: chosenFeatures,
9942
+ androidArchitectures: chosenAndroidArchitectures
9896
9943
  };
9897
9944
  const setup = options.json ? undefined : projectSetup(name, config);
9898
9945
  let installationStarted = false;
@@ -4,9 +4,10 @@ set -euo pipefail
4
4
  case "${1:?operation required}" in
5
5
  prepare)
6
6
  df -Pk .
7
+ available=$(df -Pk . | awk 'END {print $4}')
7
8
  # Only disposable GitHub-hosted Linux runners. Keep Android, Java, Node,
8
9
  # the checkout and dependency caches intact; these toolchains are unused.
9
- if [[ "${GITHUB_ACTIONS:-}" == true && "${RUNNER_ENVIRONMENT:-}" == github-hosted && "${RUNNER_OS:-}" == Linux ]]; then
10
+ if [[ "${GITHUB_ACTIONS:-}" == true && "${RUNNER_ENVIRONMENT:-}" == github-hosted && "${RUNNER_OS:-}" == Linux && "$available" =~ ^[0-9]+$ ]] && (( available < 25 * 1024 * 1024 )); then
10
11
  unused=(/usr/share/dotnet /usr/local/.ghcup /opt/ghc /opt/hostedtoolcache/CodeQL
11
12
  /usr/share/swift /usr/share/miniconda /opt/microsoft/powershell /usr/local/share/powershell
12
13
  /usr/local/share/vcpkg /home/linuxbrew)
@@ -36,7 +37,24 @@ case "${1:?operation required}" in
36
37
  TIMEFORMAT='Gradle elapsed: %3R seconds; shell and child CPU: %3U user, %3S system'
37
38
  status=0
38
39
  time ./gradlew :app:assembleRelease --no-daemon --build-cache || status=$?
40
+ if [[ -n "${CCACHE_DIR:-}" ]]; then ccache --show-stats; fi
39
41
  exit "$status"
40
42
  ;;
43
+ prime)
44
+ now=$(date +%s)
45
+ start=${ANDROID_PRIME_STARTED_AT:-}
46
+ [[ "$start" =~ ^[0-9]+$ ]] && (( start <= now )) || { echo 'Missing or invalid warmup start time.' >&2; exit 1; }
47
+ # The first step records the start; leave four minutes for setup-job overhead,
48
+ # signal handling, cache uploads and setup-gradle post-job cleanup.
49
+ remaining=$((start + 16 * 60 - now))
50
+ (( remaining > 0 )) || { echo 'Insufficient time remaining to compile and save cache.' >&2; exit 1; }
51
+ echo "Native compilation budget: ${remaining}s; four-minute reserve from first-step start for job overhead and cache saving."
52
+ timeout --signal=INT --kill-after=15s "${remaining}s" ./gradlew :app:externalNativeBuildRelease --no-daemon --build-cache
53
+ ccache --show-stats
54
+ result=$(find "${CCACHE_DIR:?}" -type f -name '*R' -size +0c -print -quit)
55
+ [[ -n "$result" ]] || { echo 'No compiler result was cached.' >&2; exit 1; }
56
+ inspection=$(ccache --inspect "$result")
57
+ [[ "$inspection" == *' (result)'* ]] || { echo 'Invalid compiler result.' >&2; exit 1; }
58
+ ;;
41
59
  *) echo "Unknown operation: $1" >&2; exit 1 ;;
42
60
  esac
@@ -3,7 +3,7 @@ set -euo pipefail
3
3
  manifest() {
4
4
  bun x --no-install expo config --json | jq -ce --arg channel "${CHANNEL:-}" --arg runtime "${RUNTIME:-}" '
5
5
  def required($name): if type == "string" and (test("[^[:space:]]")) then . else error("Missing or invalid " + $name) end;
6
- {channel: ($channel | required("channel")), projectId: (.extra.eas.projectId | required("projectId")), applicationId: (.android.package | required("applicationId")), runtimeVersion: ($runtime | required("runtimeVersion") | if test("^[a-f0-9]{40,64}$") then . else error("Invalid runtimeVersion") end)}
6
+ {channel: ($channel | required("channel")), projectId: (.extra.eas.projectId | required("projectId")), applicationId: (.android.package | required("applicationId")), runtimeVersion: ($runtime | required("runtimeVersion") | if test("^[a-f0-9]{40,64}$") then . else error("Invalid runtimeVersion") end), androidArchitectures: (.extra.disposablAndroidArchitectures | if type == "array" and length > 0 then . else error("Missing Android architectures") end)}
7
7
  '
8
8
  }
9
9
  case "${1:?operation required}" in
@@ -78,7 +78,7 @@ bun -e '
78
78
  const wanted = JSON.parse(process.env.MANIFEST);
79
79
  const release = await Bun.file(`${process.env.RUNNER_TEMP}/release.json`).json();
80
80
  const prior = JSON.parse(/<!-- android (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
81
- const reusable = prior && Object.keys(wanted).every(k => prior[k] === wanted[k]) && /^[a-f0-9]{64}$/.test(prior.sha256 || "") && release.assets.some(a => a.name === process.env.artifact && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${prior.sha256}`);
81
+ const reusable = prior && Object.keys(wanted).every(k => JSON.stringify(prior[k]) === JSON.stringify(wanted[k])) && /^[a-f0-9]{64}$/.test(prior.sha256 || "") && release.assets.some(a => a.name === process.env.artifact && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${prior.sha256}`);
82
82
  const blocked = !reusable && process.env.CHANNEL === "production" && process.env.ANDROID_SIGNING_READY !== "true";
83
83
  if (blocked) {
84
84
  const reason = "Configure Android production signing credentials before building a production APK.";
@@ -131,6 +131,7 @@ binary=android/app/build/outputs/apk/release/app-release.apk
131
131
  fingerprint=assets/fingerprint
132
132
 
133
133
  (cd android && bash ../../../.github/scripts/android-runner.sh build)
134
+ node ../../.github/scripts/verify-android-abis.mjs "$binary" "$MANIFEST"
134
135
  test "$(unzip -p "$binary" "$fingerprint")" = "$RUNTIME"
135
136
  test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
136
137
  mkdir -p ../../dist/release
@@ -68,6 +68,7 @@ for platform in android linux windows macos; do
68
68
  if (release.draft !== false || !prior || wanted.channel !== process.env.CHANNEL
69
69
  || !/^[a-f0-9]{40,64}$/.test(wanted.runtimeVersion || "") || !/^[a-f0-9]{64}$/.test(wanted.sha256 || "")
70
70
  || !fields.every(k => typeof wanted[k] === "string" && wanted[k].trim() && prior[k] === wanted[k])
71
+ || !Array.isArray(wanted.androidArchitectures) || !wanted.androidArchitectures.length || JSON.stringify(prior.androidArchitectures) !== JSON.stringify(wanted.androidArchitectures)
71
72
  || !release.assets?.some(a => a.name === "android.apk" && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${wanted.sha256}`)) {
72
73
  throw new Error("Android source release does not match the OTA manifest.");
73
74
  }
@@ -0,0 +1,22 @@
1
+ import { execFileSync } from "node:child_process";
2
+
3
+ const [apk, manifest] = process.argv.slice(2);
4
+ const expected = JSON.parse(manifest).androidArchitectures;
5
+ const entries = execFileSync("unzip", ["-Z1", apk], { encoding: "utf8" }).split(
6
+ "\n",
7
+ );
8
+ const actual = [
9
+ ...new Set(
10
+ entries
11
+ .map((path) => /^lib\/([^/]+)\/.+\.so$/.exec(path)?.[1])
12
+ .filter(Boolean),
13
+ ),
14
+ ].sort();
15
+ if (
16
+ !Array.isArray(expected) ||
17
+ !expected.length ||
18
+ JSON.stringify(actual) !== JSON.stringify([...expected].sort())
19
+ )
20
+ throw new Error(
21
+ `APK architectures mismatch: expected ${expected?.join(",")}; found ${actual.join(",")}`,
22
+ );
@@ -0,0 +1,64 @@
1
+ name: Prime Android native cache
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ prime:
11
+ if: github.ref == 'refs/heads/main'
12
+ runs-on: ubuntu-24.04
13
+ timeout-minutes: 20
14
+ env:
15
+ DO_NOT_TRACK: "1"
16
+ E2E_TELEMETRY_DISABLED: "1"
17
+ EXPO_NO_TELEMETRY: "1"
18
+ EXPO_NO_DOTENV: "1"
19
+ DISPOSABL_MOBILE_CHANNEL: production
20
+ EXPO_PROJECT_ID: 00000000-0000-4000-8000-000000000001
21
+ CCACHE_COMPILERCHECK: content
22
+ CMAKE_C_COMPILER_LAUNCHER: ccache
23
+ CMAKE_CXX_COMPILER_LAUNCHER: ccache
24
+ steps:
25
+ - name: Record warmup start
26
+ run: |
27
+ printf 'ANDROID_PRIME_STARTED_AT=%s\nCCACHE_DIR=%s\n' "$(date +%s)" "$RUNNER_TEMP/ccache" >> "$GITHUB_ENV"
28
+ - uses: actions/checkout@v6
29
+ with: { persist-credentials: false }
30
+ - uses: actions/setup-node@v6
31
+ with: { node-version: "24", package-manager-cache: false }
32
+ - uses: oven-sh/setup-bun@v2
33
+ with: { bun-version: "1.4.4" }
34
+ - run: bun install --frozen-lockfile --filter @disposabl/mobile
35
+ - uses: actions/setup-java@v5
36
+ with: { distribution: temurin, java-version: "17" }
37
+ - uses: android-actions/setup-android@v3
38
+ with: { packages: platform-tools }
39
+ - uses: gradle/actions/setup-gradle@v4
40
+ with: { cache-read-only: false }
41
+ - name: Install compiler cache
42
+ run: |
43
+ sudo apt-get update -qq
44
+ sudo apt-get install -y ccache
45
+ - name: Restore compiler cache
46
+ id: cache
47
+ uses: actions/cache/restore@v4
48
+ with:
49
+ path: ${{ runner.temp }}/ccache
50
+ key: android-ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
51
+ - name: Prebuild Android
52
+ if: steps.cache.outputs.cache-hit != 'true'
53
+ working-directory: apps/mobile
54
+ run: bun x --no-install expo prebuild --platform android --no-install
55
+ - name: Compile native targets within budget
56
+ if: steps.cache.outputs.cache-hit != 'true'
57
+ working-directory: apps/mobile/android
58
+ run: bash ../../../.github/scripts/android-runner.sh prime
59
+ - name: Save compiler cache
60
+ if: steps.cache.outputs.cache-hit != 'true'
61
+ uses: actions/cache/save@v4
62
+ with:
63
+ path: ${{ runner.temp }}/ccache
64
+ key: android-ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
@@ -215,6 +215,19 @@ jobs:
215
215
  - name: Gradle
216
216
  uses: gradle/actions/setup-gradle@v4
217
217
  with: { cache-read-only: false }
218
+ - name: Restore native compiler cache
219
+ if: github.event_name == 'push'
220
+ id: native-cache
221
+ uses: actions/cache/restore@v4
222
+ with:
223
+ path: ${{ runner.temp }}/ccache
224
+ key: android-ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}
225
+ - name: Install native compiler cache
226
+ if: github.event_name == 'push' && steps.native-cache.outputs.cache-hit == 'true'
227
+ run: |
228
+ sudo apt-get update -qq
229
+ sudo apt-get install -y ccache
230
+ printf 'CCACHE_DIR=%s\nCCACHE_COMPILERCHECK=content\nCMAKE_C_COMPILER_LAUNCHER=ccache\nCMAKE_CXX_COMPILER_LAUNCHER=ccache\n' "$RUNNER_TEMP/ccache" >> "$GITHUB_ENV"
218
231
  - name: Build
219
232
  working-directory: apps/mobile
220
233
  env:
@@ -42,12 +42,15 @@ module.exports = ({ config }) => {
42
42
  }
43
43
  return {
44
44
  ...config,
45
- scheme: [
46
- ...new Set([
47
- ...[config.scheme || []].flat(),
48
- `disposabl-${project.name.replace(/[^a-z0-9.-]/g, "-")}`,
49
- ]),
50
- ],
45
+ scheme:
46
+ process.env.EXPO_PUBLIC_E2E === "true" && process.env.E2E_ANDROID_SCHEME
47
+ ? [process.env.E2E_ANDROID_SCHEME]
48
+ : [
49
+ ...new Set([
50
+ ...[config.scheme || []].flat(),
51
+ `disposabl-${project.name.replace(/[^a-z0-9.-]/g, "-")}`,
52
+ ]),
53
+ ],
51
54
  owner: process.env.EXPO_OWNER || config.owner,
52
55
  slug: process.env.EXPO_SLUG || config.slug,
53
56
  ios: {
@@ -63,9 +66,11 @@ module.exports = ({ config }) => {
63
66
  ...config.android,
64
67
  ...(projectId ? { runtimeVersion: { policy: "fingerprint" } } : {}),
65
68
  package:
66
- channel === "production"
67
- ? basePackage
68
- : `${basePackage}.${channel.replaceAll("-", "")}`,
69
+ process.env.EXPO_PUBLIC_E2E === "true" && process.env.E2E_ANDROID_APP_ID
70
+ ? process.env.E2E_ANDROID_APP_ID
71
+ : channel === "production"
72
+ ? basePackage
73
+ : `${basePackage}.${channel.replaceAll("-", "")}`,
69
74
  versionCode,
70
75
  },
71
76
  plugins: [
@@ -73,9 +78,13 @@ module.exports = ({ config }) => {
73
78
  "./plugins/with-android-signing.js",
74
79
  ...(process.env.EXPO_PUBLIC_E2E === "true"
75
80
  ? [
81
+ ...(process.env.E2E_ANDROID_LOOPBACK === "true"
82
+ ? ["./plugins/with-e2e-network.js"]
83
+ : []),
76
84
  [
77
85
  "expo-dev-client",
78
86
  {
87
+ addGeneratedScheme: false,
79
88
  toolsButton: false,
80
89
  skipOnboarding: true,
81
90
  showMenuAtLaunch: false,
@@ -0,0 +1,41 @@
1
+ const {
2
+ withAndroidManifest,
3
+ withDangerousMod,
4
+ } = require("@expo/config-plugins");
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+
8
+ module.exports = function withE2ENetwork(config) {
9
+ const backend = new URL(process.env.EXPO_PUBLIC_CONVEX_URL || "");
10
+ if (
11
+ process.env.EXPO_PUBLIC_E2E !== "true" ||
12
+ process.env.E2E_ANDROID_LOOPBACK !== "true" ||
13
+ backend.protocol !== "http:" ||
14
+ backend.hostname !== "10.0.2.2"
15
+ ) {
16
+ throw new Error(
17
+ "E2E network configuration requires the Android emulator loopback backend",
18
+ );
19
+ }
20
+ config = withAndroidManifest(config, (result) => {
21
+ result.modResults.manifest.application[0].$[
22
+ "android:networkSecurityConfig"
23
+ ] = "@xml/e2e_network_security_config";
24
+ return result;
25
+ });
26
+ return withDangerousMod(config, [
27
+ "android",
28
+ async (result) => {
29
+ const dir = path.join(
30
+ result.modRequest.platformProjectRoot,
31
+ "app/src/main/res/xml",
32
+ );
33
+ fs.mkdirSync(dir, { recursive: true });
34
+ fs.writeFileSync(
35
+ path.join(dir, "e2e_network_security_config.xml"),
36
+ '<?xml version="1.0" encoding="utf-8"?>\n<network-security-config><domain-config cleartextTrafficPermitted="true"><domain includeSubdomains="false">10.0.2.2</domain></domain-config></network-security-config>\n',
37
+ );
38
+ return result;
39
+ },
40
+ ]);
41
+ };
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "platforms": ["web", "android", "ios", "api", "mcp", "cli", "typescript-sdk"],
4
- "features": ["authentication", "docs", "analytics"]
4
+ "features": ["authentication", "docs", "analytics"],
5
+ "androidArchitectures": ["arm64-v8a", "x86_64"]
5
6
  }
@@ -0,0 +1,35 @@
1
+ export const androidArchitectures = [
2
+ "arm64-v8a",
3
+ "x86_64",
4
+ "armeabi-v7a",
5
+ "x86",
6
+ ] as const;
7
+
8
+ export type AndroidArchitecture = (typeof androidArchitectures)[number];
9
+
10
+ export const defaultAndroidArchitectures: readonly AndroidArchitecture[] = [
11
+ "arm64-v8a",
12
+ "x86_64",
13
+ ];
14
+
15
+ /** Validate persisted selections and return them in a stable order. */
16
+ export function validateAndroidArchitectures(
17
+ values: unknown = defaultAndroidArchitectures,
18
+ ): AndroidArchitecture[] {
19
+ if (!Array.isArray(values) || values.length === 0)
20
+ throw new Error("Select at least one Android architecture.");
21
+ const selected = new Set<AndroidArchitecture>();
22
+ for (const value of values) {
23
+ if (
24
+ typeof value !== "string" ||
25
+ !androidArchitectures.includes(value as AndroidArchitecture)
26
+ )
27
+ throw new Error(
28
+ `Unknown Android architecture: ${JSON.stringify(value)}.`,
29
+ );
30
+ if (selected.has(value as AndroidArchitecture))
31
+ throw new Error(`Duplicate Android architecture: ${value}.`);
32
+ selected.add(value as AndroidArchitecture);
33
+ }
34
+ return androidArchitectures.filter((value) => selected.has(value));
35
+ }
@@ -1,11 +1,33 @@
1
1
  const {
2
2
  withAppBuildGradle,
3
3
  withAndroidManifest,
4
+ withGradleProperties,
4
5
  } = require("expo/config-plugins");
6
+ const { validateAndroidArchitectures } = require("../android-architectures.ts");
5
7
 
6
8
  // RN's default bundle inputs cover the app directory, not workspace packages.
7
9
  module.exports = (config) => {
8
- if (require("../../../disposabl.json").features.includes("payments")) {
10
+ const app = require("../../../disposabl.json");
11
+ const architectures = validateAndroidArchitectures(app.androidArchitectures);
12
+ const payments = app.features.includes("payments");
13
+ config.extra = {
14
+ ...config.extra,
15
+ disposablAndroidArchitectures: architectures,
16
+ disposablAndroidPayments: payments,
17
+ };
18
+ config = withGradleProperties(config, (mod) => {
19
+ mod.modResults = mod.modResults.filter(
20
+ (item) =>
21
+ item.type !== "property" || item.key !== "reactNativeArchitectures",
22
+ );
23
+ mod.modResults.push({
24
+ type: "property",
25
+ key: "reactNativeArchitectures",
26
+ value: architectures.join(","),
27
+ });
28
+ return mod;
29
+ });
30
+ if (payments) {
9
31
  config = withAndroidManifest(config, (mod) => {
10
32
  const application = mod.modResults.manifest.application?.[0];
11
33
  const activity = application?.activity?.find(
@@ -9,6 +9,8 @@ Use this skill in the existing generated app, including an app already published
9
9
 
10
10
  Read `disposabl.json`, the Git diff, and the affected workspace instructions. Record the current selections and the user's intended complete selections. `--features` and `--platforms` replace their respective lists; omit a flag to keep that list. Dependencies are resolved by the generator, including Authentication for Payments and Analytics, API for CLI/SDK, and Web for every app.
11
11
 
12
+ `--android-architectures` replaces the Android ABI list. The default is `arm64-v8a,x86_64`; `armeabi-v7a` and `x86` are available when needed. A change requires a compatible native build and produces one APK containing the selected ABIs.
13
+
12
14
  ## Apply code changes
13
15
 
14
16
  Use the generator version recorded in `disposabl.json`, not `latest`. From the parent directory, run the following with the actual version, directory, and complete desired lists:
@@ -0,0 +1,43 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { execFileSync, spawnSync } from "node:child_process";
4
+ import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
5
+ import { tmpdir } from "node:os";
6
+ import { join, resolve } from "node:path";
7
+ import { validateAndroidArchitectures } from "../disposabl-kit/android-architectures";
8
+
9
+ test("Android architectures validate and preserve a stable supported selection", () => {
10
+ assert.deepEqual(validateAndroidArchitectures(), ["arm64-v8a", "x86_64"]);
11
+ assert.deepEqual(validateAndroidArchitectures(["x86_64", "arm64-v8a"]), [
12
+ "arm64-v8a",
13
+ "x86_64",
14
+ ]);
15
+ for (const invalid of [[], ["arm64-v8a", "arm64-v8a"], ["mips"], null])
16
+ assert.throws(() => validateAndroidArchitectures(invalid));
17
+ });
18
+
19
+ test("APK inspection accepts exactly the selected native architectures", () => {
20
+ const dir = mkdtempSync(join(tmpdir(), "android-abi-apk-"));
21
+ for (const abi of ["arm64-v8a", "x86_64"]) {
22
+ mkdirSync(join(dir, "lib", abi), { recursive: true });
23
+ writeFileSync(join(dir, "lib", abi, "libexample.so"), "fixture");
24
+ }
25
+ execFileSync("zip", ["-qr", "fixture.apk", "lib"], { cwd: dir });
26
+ const script = resolve(
27
+ import.meta.dirname,
28
+ "../../.github/scripts/verify-android-abis.mjs",
29
+ );
30
+ for (const [selected, success] of [
31
+ [["arm64-v8a", "x86_64"], true],
32
+ [["arm64-v8a"], false],
33
+ [["arm64-v8a", "x86_64", "x86"], false],
34
+ [[], false],
35
+ ] as const) {
36
+ const result = spawnSync(process.execPath, [
37
+ script,
38
+ join(dir, "fixture.apk"),
39
+ JSON.stringify({ androidArchitectures: selected }),
40
+ ]);
41
+ assert.equal(result.status === 0, success);
42
+ }
43
+ });
@@ -31,6 +31,7 @@ function publish(
31
31
  projectId: "project",
32
32
  applicationId: "app.fixture",
33
33
  runtimeVersion: "b".repeat(40),
34
+ androidArchitectures: ["arm64-v8a", "x86_64"],
34
35
  sha256,
35
36
  action: options.native ? "build" : "update",
36
37
  sourceTag,
@@ -40,6 +41,8 @@ function publish(
40
41
  if (options.fault === "channel") prior.channel = "pr-2";
41
42
  if (options.fault === "project") prior.projectId = "different";
42
43
  if (options.fault === "application") prior.applicationId = "app.different";
44
+ if (options.fault === "architectures")
45
+ prior.androidArchitectures = ["arm64-v8a"];
43
46
  if (options.fault === "tag") manifest.sourceTag = "app-pr-2-android";
44
47
  writeFileSync(
45
48
  join(cwd, "artifacts/release-android/android.json"),
@@ -204,6 +207,7 @@ test("OTA reuse rejects mismatched, missing, corrupt and stale inputs before pub
204
207
  "channel",
205
208
  "project",
206
209
  "application",
210
+ "architectures",
207
211
  "tag",
208
212
  "draft",
209
213
  "missing",
@@ -261,7 +265,7 @@ else writeFileSync(join(args[args.indexOf("--dir")+1],"android.apk"),${JSON.stri
261
265
  `#!${process.execPath}
262
266
  import {writeFileSync,mkdirSync} from "node:fs";
263
267
  const args=process.argv.slice(2);
264
- if(args.includes("config")) console.log(JSON.stringify({android:{package:"app.fixture"},extra:{eas:{projectId:"project"}}}));
268
+ if(args.includes("config")) console.log(JSON.stringify({android:{package:"app.fixture"},extra:{eas:{projectId:"project"},disposablAndroidArchitectures:["arm64-v8a","x86_64"]}}));
265
269
  else if(args.includes("runtimeversion:resolve")) console.log(JSON.stringify({runtimeVersion:"${"b".repeat(40)}"}));
266
270
  else if(args.includes("export")) mkdirSync("dist/update",{recursive:true});
267
271
  else if(args.includes("update")) writeFileSync("../../published-update","yes");
@@ -11,8 +11,8 @@ import { tmpdir } from "node:os";
11
11
  import { join, resolve } from "node:path";
12
12
  import { spawnSync } from "node:child_process";
13
13
 
14
- test("OTA selection accepts only source tags supported by the trusted publisher", () => {
15
- for (const [channel, tag, reusable] of [
14
+ function verifyOtaSelection() {
15
+ for (const [channel, tag, reusable, architectures] of [
16
16
  ["pr-1", "app-pr-1-android", true],
17
17
  ["production", "app-production-android", true],
18
18
  ["production", "app-production-android-8-1", true],
@@ -22,6 +22,8 @@ test("OTA selection accepts only source tags supported by the trusted publisher"
22
22
  ["production", "app-production-android-invalid", false],
23
23
  ["pr-1", "app-pr-2-android", false],
24
24
  ["pr-1", "app-pr-1-windows", false],
25
+ ["production", "app-production-android-8-1", false, ["arm64-v8a"]],
26
+ ["production", "app-production-android-8-1", false, null],
25
27
  ] as const) {
26
28
  const cwd = mkdtempSync(join(tmpdir(), "android-ota-selection-"));
27
29
  try {
@@ -33,6 +35,9 @@ test("OTA selection accepts only source tags supported by the trusted publisher"
33
35
  projectId: "project",
34
36
  applicationId: "app.fixture",
35
37
  runtimeVersion: runtime,
38
+ ...(architectures === null
39
+ ? {}
40
+ : { androidArchitectures: architectures ?? ["arm64-v8a", "x86_64"] }),
36
41
  sha256: hash,
37
42
  };
38
43
  const release = {
@@ -62,7 +67,7 @@ if(args[0]==="-e") {
62
67
  const child=Bun.spawnSync([process.execPath,...args],{stdout:"inherit",stderr:"inherit"});
63
68
  process.exit(child.exitCode);
64
69
  }
65
- if(args.includes("config")) console.log(JSON.stringify({android:{package:"app.fixture"},extra:{eas:{projectId:"project"}}}));
70
+ if(args.includes("config")) console.log(JSON.stringify({android:{package:"app.fixture"},extra:{eas:{projectId:"project"},disposablAndroidArchitectures:["arm64-v8a","x86_64"]}}));
66
71
  else if(args.includes("runtimeversion:resolve")) console.log(JSON.stringify({runtimeVersion:"${runtime}",fingerprintSources:[]}));
67
72
  else process.exit(1);
68
73
  `,
@@ -108,4 +113,10 @@ else process.exit(1);
108
113
  rmSync(cwd, { recursive: true, force: true });
109
114
  }
110
115
  }
111
- });
116
+ }
117
+
118
+ test(
119
+ "OTA selection accepts only source tags supported by the trusted publisher",
120
+ { timeout: 30000 },
121
+ verifyOtaSelection,
122
+ );
@@ -3,7 +3,7 @@ import assert from "node:assert/strict";
3
3
  import { mkdtempSync, writeFileSync, readFileSync, rmSync } from "node:fs";
4
4
  import { tmpdir } from "node:os";
5
5
  import { join, resolve } from "node:path";
6
- import { spawnSync } from "node:child_process";
6
+ import { execFileSync, spawnSync } from "node:child_process";
7
7
 
8
8
  test("Android build diagnostics preserve Gradle arguments and failure status", () => {
9
9
  const dir = mkdtempSync(join(tmpdir(), "android-build-"));
@@ -114,6 +114,8 @@ test("Android disk preparation only removes unused hosted-runner toolchains", ()
114
114
  assert.equal(readFileSync(calls, "utf8"), "");
115
115
  }
116
116
  assert.equal(run("prepare").status, 0);
117
+ assert.equal(readFileSync(calls, "utf8"), "");
118
+ assert.equal(run("prepare", { AVAILABLE: "1024" }).status, 0);
117
119
  assert.equal(
118
120
  readFileSync(calls, "utf8"),
119
121
  "rm -rf -- /usr/share/dotnet /usr/local/.ghcup /opt/ghc /opt/hostedtoolcache/CodeQL /usr/share/swift /usr/share/miniconda /opt/microsoft/powershell /usr/local/share/powershell /usr/local/share/vcpkg /home/linuxbrew\n",
@@ -127,8 +129,110 @@ test("Android disk preparation only removes unused hosted-runner toolchains", ()
127
129
  assert.equal(run("check", { AVAILABLE: "invalid" }).status, 1);
128
130
  assert.equal(run("unsupported").status, 1);
129
131
  writeFileSync(join(dir, "sudo"), "#!/bin/sh\nexit 42\n", { mode: 0o755 });
130
- assert.equal(run("prepare").status, 42);
132
+ assert.equal(run("prepare", { AVAILABLE: "1024" }).status, 42);
131
133
  } finally {
132
134
  rmSync(dir, { recursive: true, force: true });
133
135
  }
134
136
  });
137
+
138
+ test("native warmup requires completed Gradle work, a real result, and enough remaining time", () => {
139
+ const dir = mkdtempSync(join(tmpdir(), "android-prime-"));
140
+ try {
141
+ writeFileSync(
142
+ join(dir, "gradlew"),
143
+ '#!/bin/sh\nprintf "%s\\n" "$*" > "$GRADLE_CALL"\nif [ "$GRADLE_SLEEP" = 1 ]; then sleep 5; fi\nexit "$GRADLE_RESULT"\n',
144
+ { mode: 0o755 },
145
+ );
146
+ writeFileSync(
147
+ join(dir, "ccache"),
148
+ '#!/bin/sh\nif [ "$1" = "--inspect" ]; then echo "Entry type: 0 (result)"; fi\n',
149
+ { mode: 0o755 },
150
+ );
151
+ const script = resolve(
152
+ import.meta.dirname,
153
+ "../../.github/scripts/android-runner.sh",
154
+ );
155
+ const resultFile = join(dir, "testR");
156
+ writeFileSync(resultFile, "cached result fixture");
157
+ const run = (status: number, age: number, sleep = false) =>
158
+ spawnSync("bash", [script, "prime"], {
159
+ cwd: dir,
160
+ encoding: "utf8",
161
+ timeout: 10000,
162
+ env: {
163
+ ...process.env,
164
+ PATH: `${dir}:${process.env.PATH}`,
165
+ CCACHE_DIR: dir,
166
+ ANDROID_PRIME_STARTED_AT: String(Math.floor(Date.now() / 1000) - age),
167
+ GRADLE_CALL: join(dir, "gradle-call"),
168
+ GRADLE_RESULT: String(status),
169
+ GRADLE_SLEEP: sleep ? "1" : "0",
170
+ },
171
+ });
172
+ const ok = run(0, 100);
173
+ assert.equal(ok.status, 0, ok.stderr);
174
+ assert.match(ok.stdout, /Native compilation budget: 8[0-9][0-9]s/);
175
+ assert.match(
176
+ readFileSync(join(dir, "gradle-call"), "utf8"),
177
+ /:app:externalNativeBuildRelease/,
178
+ );
179
+ assert.equal(run(124, 100).status, 124);
180
+ const timedOut = run(0, 958, true);
181
+ assert.ok(
182
+ timedOut.status === 124 || timedOut.status === 137,
183
+ `expected timeout failure, got ${timedOut.status}`,
184
+ );
185
+ assert.equal(run(42, 100).status, 42);
186
+ assert.match(run(0, 961).stderr, /Insufficient time remaining/);
187
+ rmSync(resultFile);
188
+ assert.match(run(0, 100).stderr, /No compiler result was cached/);
189
+ } finally {
190
+ rmSync(dir, { recursive: true, force: true });
191
+ }
192
+ });
193
+
194
+ test("native warmup and production use the same exact-commit cache", () => {
195
+ const root = resolve(import.meta.dirname, "../..");
196
+ const primeText = readFileSync(
197
+ join(root, ".github/workflows/android-cache-prime.yml"),
198
+ "utf8",
199
+ );
200
+ const pipelineText = readFileSync(
201
+ join(root, ".github/workflows/pipeline.yml"),
202
+ "utf8",
203
+ );
204
+ const prime = JSON.parse(
205
+ execFileSync(
206
+ process.execPath,
207
+ [
208
+ "-e",
209
+ "console.log(JSON.stringify(Bun.YAML.parse(await Bun.file(process.argv[1]).text())))",
210
+ join(root, ".github/workflows/android-cache-prime.yml"),
211
+ ],
212
+ { encoding: "utf8" },
213
+ ),
214
+ ) as {
215
+ jobs: {
216
+ prime: {
217
+ if: string;
218
+ "timeout-minutes": number;
219
+ env: Record<string, string>;
220
+ };
221
+ };
222
+ };
223
+ assert.equal(prime.jobs.prime.if, "github.ref == 'refs/heads/main'");
224
+ assert.equal(prime.jobs.prime["timeout-minutes"], 20);
225
+ assert.doesNotMatch(
226
+ JSON.stringify(prime.jobs.prime.env),
227
+ /\$\{\{\s*runner\./,
228
+ );
229
+ assert.match(primeText, /CCACHE_DIR=%s\\n.*\$RUNNER_TEMP\/ccache/);
230
+ assert.doesNotMatch(primeText, /secrets\.|id-token|publish|report/i);
231
+ const key =
232
+ "android-ccache-v1-${{ runner.os }}-${{ runner.arch }}-${{ github.sha }}";
233
+ assert.equal(primeText.split(key).length - 1, 2);
234
+ assert.equal(pipelineText.split(key).length - 1, 1);
235
+ assert.match(primeText, /actions\/cache\/save@v4/);
236
+ assert.match(pipelineText, /actions\/cache\/restore@v4/);
237
+ assert.doesNotMatch(primeText + pipelineText, /CCACHE_SLOPPINESS/);
238
+ });
@@ -0,0 +1,112 @@
1
+ import { test } from "node:test";
2
+ import assert from "node:assert/strict";
3
+ import { createRequire } from "node:module";
4
+
5
+ const require = createRequire(import.meta.url);
6
+ const configure = require("../../apps/mobile/app.config.js");
7
+ const network = require("../../apps/mobile/plugins/with-e2e-network.js");
8
+ const keys = [
9
+ "EXPO_PUBLIC_E2E",
10
+ "E2E_ANDROID_LOOPBACK",
11
+ "EXPO_PUBLIC_CONVEX_URL",
12
+ "E2E_ANDROID_APP_ID",
13
+ "E2E_ANDROID_SCHEME",
14
+ "DISPOSABL_MOBILE_CHANNEL",
15
+ ] as const;
16
+
17
+ function withEnv(values: Record<string, string>, run: () => void) {
18
+ const old = Object.fromEntries(keys.map((key) => [key, process.env[key]]));
19
+ for (const key of keys) delete process.env[key];
20
+ Object.assign(process.env, values);
21
+ try {
22
+ run();
23
+ } finally {
24
+ for (const key of keys) {
25
+ if (old[key] === undefined) delete process.env[key];
26
+ else process.env[key] = old[key];
27
+ }
28
+ }
29
+ }
30
+
31
+ test("production and E2E-off configurations retain default network security", () => {
32
+ for (const e2e of [undefined, "false"])
33
+ withEnv(
34
+ {
35
+ DISPOSABL_MOBILE_CHANNEL: "production",
36
+ E2E_ANDROID_LOOPBACK: "true",
37
+ E2E_ANDROID_APP_ID: "app.example.override",
38
+ E2E_ANDROID_SCHEME: "override",
39
+ ...(e2e ? { EXPO_PUBLIC_E2E: e2e } : {}),
40
+ },
41
+ () => {
42
+ const config = configure({
43
+ config: {
44
+ android: { package: "app.example.production" },
45
+ scheme: "original",
46
+ },
47
+ });
48
+ assert.equal(config.android.package, "app.example.production");
49
+ assert.ok(config.scheme.includes("original"));
50
+ assert.ok(!config.scheme.includes("override"));
51
+ assert.ok(!config.plugins.includes("./plugins/with-e2e-network.js"));
52
+ assert.notEqual(config.updates.enabled, false);
53
+ assert.ok(
54
+ !config.plugins.some(
55
+ (plugin: unknown) =>
56
+ Array.isArray(plugin) && plugin[0] === "expo-dev-client",
57
+ ),
58
+ );
59
+ },
60
+ );
61
+ });
62
+
63
+ test("E2E loopback configuration has isolated identity, scheme, updates and network", () => {
64
+ withEnv(
65
+ {
66
+ EXPO_PUBLIC_E2E: "true",
67
+ E2E_ANDROID_LOOPBACK: "true",
68
+ EXPO_PUBLIC_CONVEX_URL: "http://10.0.2.2:3310",
69
+ E2E_ANDROID_APP_ID: "app.disposabl.androidround10.preview",
70
+ E2E_ANDROID_SCHEME: "disposabl-androidround10-preview",
71
+ },
72
+ () => {
73
+ const config = configure({ config: {} });
74
+ assert.equal(
75
+ config.android.package,
76
+ "app.disposabl.androidround10.preview",
77
+ );
78
+ assert.deepEqual(config.scheme, ["disposabl-androidround10-preview"]);
79
+ assert.equal(config.updates.enabled, false);
80
+ assert.ok(config.plugins.includes("./plugins/with-e2e-network.js"));
81
+ assert.equal(
82
+ config.plugins.find(
83
+ (plugin: unknown) =>
84
+ Array.isArray(plugin) && plugin[0] === "expo-dev-client",
85
+ )[1].addGeneratedScheme,
86
+ false,
87
+ );
88
+ assert.doesNotThrow(() => network({}));
89
+ for (const url of [
90
+ "http://example.com:3310",
91
+ "https://10.0.2.2:3310",
92
+ "http://127.0.0.1:3310",
93
+ ]) {
94
+ process.env.EXPO_PUBLIC_CONVEX_URL = url;
95
+ assert.throws(() => network({}));
96
+ }
97
+ process.env.EXPO_PUBLIC_CONVEX_URL = "http://10.0.2.2:3310";
98
+ delete process.env.EXPO_PUBLIC_E2E;
99
+ assert.throws(() => network({}));
100
+ },
101
+ );
102
+ });
103
+
104
+ test("E2E without loopback opt-in does not add cleartext policy", () => {
105
+ withEnv({ EXPO_PUBLIC_E2E: "true" }, () => {
106
+ assert.ok(
107
+ !configure({ config: {} }).plugins.includes(
108
+ "./plugins/with-e2e-network.js",
109
+ ),
110
+ );
111
+ });
112
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",