create-disposabl-app 0.16.0 → 0.17.0
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 +11 -8
- package/dist/disposabl.js +1 -1
- package/dist/index.js +57 -10
- package/dist/templates/default/.github/scripts/mobile.sh +3 -2
- package/dist/templates/default/.github/scripts/release.sh +1 -0
- package/dist/templates/default/.github/scripts/verify-android-abis.mjs +22 -0
- package/dist/templates/default/apps/mobile/app.config.js +18 -9
- package/dist/templates/default/apps/mobile/plugins/with-e2e-network.js +41 -0
- package/dist/templates/default/disposabl.json +2 -1
- package/dist/templates/default/packages/disposabl-kit/android-architectures.ts +35 -0
- package/dist/templates/default/packages/disposabl-kit/mobile/expo-plugin.cjs +23 -1
- package/dist/templates/default/packages/reconfigure-skill/SKILL.md +2 -0
- package/dist/templates/default/packages/tests/android-architectures.test.ts +43 -0
- package/dist/templates/default/packages/tests/android-ota-artifacts.test.ts +5 -1
- package/dist/templates/default/packages/tests/android-ota-selection.test.ts +7 -2
- package/dist/templates/default/packages/tests/mobile-android-e2e-network.test.ts +112 -0
- package/package.json +1 -1
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
|
|
51
|
-
|
|
|
52
|
-
| `--platforms <ids>`
|
|
53
|
-
| `--
|
|
54
|
-
| `--
|
|
55
|
-
| `--
|
|
56
|
-
| `--
|
|
57
|
-
| `--
|
|
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
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.
|
|
1566
|
+
var version = "0.17.0";
|
|
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 --
|
|
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;
|
|
@@ -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
|
+
);
|
|
@@ -42,12 +42,15 @@ module.exports = ({ config }) => {
|
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
44
|
...config,
|
|
45
|
-
scheme:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
67
|
-
?
|
|
68
|
-
:
|
|
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
|
+
};
|
|
@@ -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
|
-
|
|
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");
|
|
@@ -12,7 +12,7 @@ import { join, resolve } from "node:path";
|
|
|
12
12
|
import { spawnSync } from "node:child_process";
|
|
13
13
|
|
|
14
14
|
test("OTA selection accepts only source tags supported by the trusted publisher", () => {
|
|
15
|
-
for (const [channel, tag, reusable] of [
|
|
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
|
`,
|
|
@@ -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
|
+
});
|