create-disposabl-app 0.13.1 → 0.13.3

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.
Files changed (27) hide show
  1. package/README.md +4 -0
  2. package/dist/disposabl.js +1 -1
  3. package/dist/index.js +193 -88
  4. package/dist/templates/default/apps/mobile/metro.config.js +11 -1
  5. package/dist/templates/default/apps/web/package.json +2 -1
  6. package/dist/templates/default/bun.lock +1 -0
  7. package/dist/templates/default/package.json +2 -1
  8. package/dist/templates/default/packages/disposabl-kit/PAYMENTS.md +2 -0
  9. package/dist/templates/default/packages/disposabl-kit/client/components/logo.tsx +6 -1
  10. package/dist/templates/default/packages/disposabl-kit/client/components/password-auth-form.tsx +2 -1
  11. package/dist/templates/default/packages/disposabl-kit/client/components/password-page.tsx +10 -7
  12. package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +2 -1
  13. package/dist/templates/default/packages/disposabl-kit/legal/config.ts +3 -3
  14. package/dist/templates/default/packages/disposabl-kit/lib/app-name.ts +10 -0
  15. package/dist/templates/default/packages/disposabl-kit/mobile/components/settings-page.tsx +43 -9
  16. package/dist/templates/default/packages/disposabl-kit/mobile/design/brand-mark.tsx +17 -1
  17. package/dist/templates/default/packages/disposabl-kit/mobile/index.ts +1 -0
  18. package/dist/templates/default/packages/disposabl-kit/mobile/screens/account.tsx +14 -4
  19. package/dist/templates/default/packages/disposabl-kit/server/http.ts +2 -1
  20. package/dist/templates/default/packages/tests/README.md +2 -0
  21. package/dist/templates/default/packages/tests/flows/mobile-auth-disabled.e2e.ts +2 -2
  22. package/dist/templates/default/packages/tests/helpers/mobile.ts +5 -3
  23. package/dist/templates/default/packages/tests/telemetry.test.ts +1 -113
  24. package/dist/templates/default/patches/expo-modules-core@58.0.30.patch +23 -0
  25. package/dist/templates/default/turbo.json +12 -1
  26. package/package.json +3 -2
  27. package/dist/templates/default/apps/web/src/router/mobile-login.tsx +0 -84
package/README.md CHANGED
@@ -89,3 +89,7 @@ Push the generated initial commit to `main` before opening feature pull requests
89
89
  See the [coding-agent guide](https://github.com/disposabl-dev/create-disposabl-app/blob/main/packages/skill/SKILL.md) for the full delivery workflow, or [report a problem](https://github.com/disposabl-dev/create-disposabl-app/issues).
90
90
 
91
91
  Set `features` to include `faster-ci` in `disposabl.json` to use Blacksmith runners (the GitHub App must be installed). The initial selection job remains GitHub-hosted so it can read the configuration.
92
+
93
+ ## Generator release checks
94
+
95
+ Before publishing the generator, `bun run --cwd packages/create-disposabl-app build && bun run --cwd packages/create-disposabl-app verify:starter` creates fresh minimal-web, Web + Android, mobile-without-authentication, and all-platform projects. Each follows the CLI's formatting and installation steps, then runs the first CI frozen install, `bun run check`, its retained unit tests, and web and selected CLI/SDK builds. Pass `web-minimal`, `web-android`, `mobile-minimal`, or `all-platforms` after `verify:starter` to check one selection. These checks use no provider credentials and do not provision or deploy resources. Native builds and installed-app behavior still need the platform checks below.
package/dist/disposabl.js CHANGED
@@ -5,7 +5,7 @@ import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
6
  var package_default = {
7
7
  name: "@disposabl/cli",
8
- version: "0.13.1",
8
+ version: "0.13.3",
9
9
  type: "module",
10
10
  description: "Command-line access to your Disposabl app",
11
11
  license: "MIT",
package/dist/index.js CHANGED
@@ -3,12 +3,12 @@
3
3
  // index.ts
4
4
  import { execFileSync as execFileSync2, spawnSync as spawnSync3 } from "node:child_process";
5
5
  import { lstatSync, readFileSync } from "node:fs";
6
- import { join as join5, resolve as resolve3 } from "node:path";
6
+ import { join as join6, resolve as resolve3 } from "node:path";
7
7
  import { fileURLToPath as fileURLToPath2 } from "node:url";
8
8
  import { Command, CommanderError } from "commander";
9
9
  import * as p2 from "@clack/prompts";
10
10
  // package.json
11
- var version = "0.13.1";
11
+ var version = "0.13.3";
12
12
 
13
13
  // ../disposabl-kit/platforms.ts
14
14
  var platforms = [
@@ -313,15 +313,76 @@ function projectSetup(name, config) {
313
313
  import {
314
314
  cp,
315
315
  mkdir,
316
- readFile,
316
+ readFile as readFile2,
317
317
  readdir,
318
318
  rename,
319
- rm,
320
- writeFile
319
+ rm as rm2,
320
+ writeFile as writeFile2
321
321
  } from "node:fs/promises";
322
- import { existsSync } from "node:fs";
323
- import { basename, join } from "node:path";
322
+ import { existsSync as existsSync2 } from "node:fs";
323
+ import { basename, join as join2 } from "node:path";
324
324
  import { randomUUID } from "node:crypto";
325
+
326
+ // mobile-payments.ts
327
+ import { existsSync } from "node:fs";
328
+ import { readFile, rm, writeFile } from "node:fs/promises";
329
+ import { join, sep } from "node:path";
330
+ var nativeBillingPath = join("packages", "disposabl-kit", "mobile", "billing") + sep;
331
+ var nativeBillingTest = join("packages", "tests", "native-billing.test.ts");
332
+ var purchasesPackage = "react-native-purchases";
333
+ var dependencyFields = [
334
+ "dependencies",
335
+ "peerDependencies",
336
+ "peerDependenciesMeta"
337
+ ];
338
+ function mergePurchasesManifest(prior, next, current) {
339
+ const before = JSON.parse(prior.toString());
340
+ const after = JSON.parse(next.toString());
341
+ const actual = JSON.parse(current.toString());
342
+ const withoutSdk = (value) => {
343
+ const copy = structuredClone(value);
344
+ for (const field of dependencyFields)
345
+ delete copy[field]?.[purchasesPackage];
346
+ return JSON.stringify(copy);
347
+ };
348
+ if (withoutSdk(before) !== withoutSdk(after))
349
+ return;
350
+ for (const field of dependencyFields) {
351
+ const oldValue = before[field]?.[purchasesPackage];
352
+ const newValue = after[field]?.[purchasesPackage];
353
+ const currentValue = actual[field]?.[purchasesPackage];
354
+ if (JSON.stringify(oldValue) === JSON.stringify(newValue))
355
+ continue;
356
+ if (JSON.stringify(currentValue) !== JSON.stringify(oldValue) && JSON.stringify(currentValue) !== JSON.stringify(newValue))
357
+ throw new Error(`Cannot reconfigure: customized ${purchasesPackage} ${field}. No files were changed.`);
358
+ if (newValue === undefined)
359
+ delete actual[field]?.[purchasesPackage];
360
+ else
361
+ (actual[field] ??= {})[purchasesPackage] = newValue;
362
+ }
363
+ return Buffer.from(JSON.stringify(actual, null, 2) + `
364
+ `);
365
+ }
366
+ async function omitMobilePayments(root) {
367
+ for (const name of ["apps/mobile", "packages/disposabl-kit"]) {
368
+ const path = join(root, name, "package.json");
369
+ if (!existsSync(path))
370
+ continue;
371
+ const manifest = JSON.parse(await readFile(path, "utf8"));
372
+ for (const field of dependencyFields)
373
+ if (manifest[field])
374
+ delete manifest[field][purchasesPackage];
375
+ await writeFile(path, JSON.stringify(manifest, null, 2) + `
376
+ `);
377
+ }
378
+ const path = join(root, "packages/disposabl-kit/mobile/screens/account.tsx");
379
+ const source = await readFile(path, "utf8");
380
+ await writeFile(path, source.replace(/^[ \t]*\/\/ payments:start\r?\n[\s\S]*?^[ \t]*\/\/ payments:end\r?\n/gm, "").replace(/^[ \t]*\{\/\* payments:start \*\/\}\r?\n[\s\S]*?^[ \t]*\{\/\* payments:end \*\/\}\r?\n/gm, ""));
381
+ await rm(join(root, nativeBillingPath), { recursive: true, force: true });
382
+ await rm(join(root, nativeBillingTest), { force: true });
383
+ }
384
+
385
+ // scaffold.ts
325
386
  async function createApp(template, destination, name, config, overwrite = false) {
326
387
  config = {
327
388
  ...config,
@@ -330,101 +391,109 @@ async function createApp(template, destination, name, config, overwrite = false)
330
391
  features: selectFeatures(config.features.join(",") || "none")
331
392
  };
332
393
  const folders = selectedFolders(config);
333
- const skill = join(template, "packages/skill");
334
- if (!existsSync(join(skill, "SKILL.md")))
394
+ const skill = join2(template, "packages/skill");
395
+ if (!existsSync2(join2(skill, "SKILL.md")))
335
396
  throw new Error("The bundled starter is missing the Disposabl skill. Rebuild the CLI.");
336
397
  for (const folder of folders) {
337
- if (!existsSync(join(template, folder, "package.json"))) {
398
+ if (!existsSync2(join2(template, folder, "package.json"))) {
338
399
  throw new Error("The bundled starter is missing " + folder + "/package.json. Rebuild the CLI.");
339
400
  }
340
401
  }
341
402
  if (overwrite)
342
- await rm(destination, { recursive: true, force: true });
403
+ await rm2(destination, { recursive: true, force: true });
343
404
  await mkdir(destination);
344
405
  try {
345
406
  for (const entry of await readdir(template)) {
346
- await cp(join(template, entry), join(destination, entry), {
407
+ await cp(join2(template, entry), join2(destination, entry), {
347
408
  recursive: true,
348
409
  force: false,
349
410
  errorOnExist: true
350
411
  });
351
412
  }
352
413
  for (const agent of [".agents", ".claude"]) {
353
- const skills = join(destination, agent, "skills");
414
+ const skills = join2(destination, agent, "skills");
354
415
  await mkdir(skills, { recursive: true });
355
- await cp(skill, join(skills, "disposabl-app"), { recursive: true });
416
+ await cp(skill, join2(skills, "disposabl-app"), { recursive: true });
356
417
  }
357
- const instructions = join(destination, "AGENTS.md");
358
- await writeFile(instructions, await readFile(instructions, "utf8") + `
418
+ const instructions = join2(destination, "AGENTS.md");
419
+ await writeFile2(instructions, await readFile2(instructions, "utf8") + `
359
420
  ## Disposabl
360
421
 
361
422
  For Disposabl development and delivery, read [.agents/skills/disposabl-app/SKILL.md](.agents/skills/disposabl-app/SKILL.md). Work in this generated app; create another app only when requested.
362
423
  `);
363
- for (const entry of await readdir(join(destination, "apps"))) {
424
+ for (const entry of await readdir(join2(destination, "apps"))) {
364
425
  if (!folders.includes("apps/" + entry))
365
- await rm(join(destination, "apps", entry), {
426
+ await rm2(join2(destination, "apps", entry), {
366
427
  recursive: true,
367
428
  force: true
368
429
  });
369
430
  }
431
+ const tests = join2(destination, "packages/tests");
432
+ for (const entry of await readdir(tests)) {
433
+ if (!folders.includes("apps/desktop") && /^desktop-.*\.test\.ts$/.test(entry) || !folders.includes("apps/mobile") && /^(mobile-.*|native-billing|ios-ota)\.test\.ts$/.test(entry))
434
+ await rm2(join2(tests, entry));
435
+ }
370
436
  if (!config.features.includes("authentication")) {
371
437
  for (const path of [
372
438
  "packages/disposabl-kit/client/routes/_auth-pages",
373
439
  "packages/disposabl-kit/client/routes/consent.tsx",
440
+ "packages/disposabl-kit/client/routes/_authenticated/change-password.tsx",
374
441
  "apps/web/src/router/_authenticated/dashboard.api-keys.tsx",
375
442
  "apps/mobile/src/app/(auth)"
376
443
  ]) {
377
- await rm(join(destination, path), { recursive: true, force: true });
444
+ await rm2(join2(destination, path), { recursive: true, force: true });
378
445
  }
379
- await writeFile(join(destination, "apps/web/src/router/_authenticated/dashboard.tsx"), `import { createFileRoute } from "@tanstack/react-router";
446
+ await writeFile2(join2(destination, "apps/web/src/router/_authenticated/dashboard.tsx"), `import { createFileRoute } from "@tanstack/react-router";
380
447
 
381
448
  export const Route = createFileRoute("/_providers/_authenticated/dashboard")({
382
449
  component: () => <h1>Dashboard</h1>,
383
450
  });
384
451
  `);
385
452
  if (folders.includes("apps/mobile")) {
386
- await writeFile(join(destination, "apps/mobile/src/app/index.tsx"), `export { PublicHomeScreen as default } from "@disposabl/disposabl-kit/mobile";
453
+ await writeFile2(join2(destination, "apps/mobile/src/app/index.tsx"), `export { PublicHomeScreen as default } from "@disposabl/disposabl-kit/mobile";
387
454
  `);
388
455
  }
389
456
  }
457
+ if (!config.features.includes("payments"))
458
+ await omitMobilePayments(destination);
390
459
  if (!config.features.includes("docs")) {
391
- const webPackage = join(destination, "apps/web/package.json");
392
- const web = JSON.parse(await readFile(webPackage, "utf8"));
460
+ const webPackage = join2(destination, "apps/web/package.json");
461
+ const web = JSON.parse(await readFile2(webPackage, "utf8"));
393
462
  delete web.devDependencies["@disposabl/docs"];
394
- await writeFile(webPackage, JSON.stringify(web, null, 2) + `
463
+ await writeFile2(webPackage, JSON.stringify(web, null, 2) + `
395
464
  `);
396
465
  for (const file of [
397
466
  "apps/web/vite.config.ts",
398
467
  "packages/disposabl-kit/client/lib/prerender.ts",
399
468
  "packages/disposabl-kit/server/http.ts"
400
469
  ]) {
401
- const path = join(destination, file);
402
- const source = await readFile(path, "utf8");
403
- await writeFile(path, source.replace(/^[ \t]*\/\/ docs:start\r?\n[\s\S]*?^[ \t]*\/\/ docs:end\r?\n/gm, ""));
470
+ const path = join2(destination, file);
471
+ const source = await readFile2(path, "utf8");
472
+ await writeFile2(path, source.replace(/^[ \t]*\/\/ docs:start\r?\n[\s\S]*?^[ \t]*\/\/ docs:end\r?\n/gm, ""));
404
473
  }
405
- const turboPath = join(destination, "turbo.json");
406
- const turbo = JSON.parse(await readFile(turboPath, "utf8"));
474
+ const turboPath = join2(destination, "turbo.json");
475
+ const turbo = JSON.parse(await readFile2(turboPath, "utf8"));
407
476
  delete turbo.tasks["@disposabl/docs#build"];
408
477
  delete turbo.tasks["@disposabl/web#build"];
409
- await writeFile(turboPath, JSON.stringify(turbo, null, 2) + `
478
+ await writeFile2(turboPath, JSON.stringify(turbo, null, 2) + `
410
479
  `);
411
- await rm(join(destination, "packages/disposabl-kit/server/lib/docs.ts"));
480
+ await rm2(join2(destination, "packages/disposabl-kit/server/lib/docs.ts"));
412
481
  }
413
482
  for (const kind of ["cli", "sdk"]) {
414
- const folder = join(destination, "packages", kind);
483
+ const folder = join2(destination, "packages", kind);
415
484
  if (!folders.includes(`packages/${kind}`)) {
416
- await rm(folder, { recursive: true, force: true });
485
+ await rm2(folder, { recursive: true, force: true });
417
486
  continue;
418
487
  }
419
- const packagePath = join(folder, "package.json");
420
- const client = JSON.parse(await readFile(packagePath, "utf8"));
488
+ const packagePath = join2(folder, "package.json");
489
+ const client = JSON.parse(await readFile2(packagePath, "utf8"));
421
490
  client.name = `${name}-${kind}`;
422
491
  delete client.repository;
423
492
  if (client.name.length > 214)
424
493
  throw new Error("Project name is too long for generated package names.");
425
494
  if (kind === "cli") {
426
495
  client.bin = { [name]: "dist/index.js" };
427
- await writeFile(join(folder, "index.ts"), `#!/usr/bin/env node
496
+ await writeFile2(join2(folder, "index.ts"), `#!/usr/bin/env node
428
497
  import { readFile } from "node:fs/promises";
429
498
  import { runCli } from "./commands";
430
499
 
@@ -463,52 +532,52 @@ main().catch((error) => {
463
532
  });
464
533
  `);
465
534
  }
466
- await writeFile(packagePath, JSON.stringify(client, null, 2) + `
535
+ await writeFile2(packagePath, JSON.stringify(client, null, 2) + `
467
536
  `);
468
- const readme = join(folder, "README.md");
469
- if (existsSync(readme))
470
- await writeFile(readme, (await readFile(readme, "utf8")).replaceAll(`@disposabl/${kind}`, client.name));
537
+ const readme = join2(folder, "README.md");
538
+ if (existsSync2(readme))
539
+ await writeFile2(readme, (await readFile2(readme, "utf8")).replaceAll(`@disposabl/${kind}`, client.name));
471
540
  }
472
541
  for (const path of await readdir(destination, { recursive: true })) {
473
542
  if (basename(path) === "gitignore") {
474
- await rename(join(destination, path), join(destination, path.replace(/gitignore$/, ".gitignore")));
543
+ await rename(join2(destination, path), join2(destination, path.replace(/gitignore$/, ".gitignore")));
475
544
  }
476
545
  }
477
- const manifestPath = join(destination, "package.json");
478
- const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
546
+ const manifestPath = join2(destination, "package.json");
547
+ const manifest = JSON.parse(await readFile2(manifestPath, "utf8"));
479
548
  manifest.name = name;
480
- await writeFile(manifestPath, JSON.stringify(manifest, null, 2) + `
549
+ await writeFile2(manifestPath, JSON.stringify(manifest, null, 2) + `
481
550
  `);
482
551
  if (folders.includes("apps/desktop")) {
483
- const desktopPath = join(destination, "apps/desktop/package.json");
484
- const desktop = JSON.parse(await readFile(desktopPath, "utf8"));
552
+ const desktopPath = join2(destination, "apps/desktop/package.json");
553
+ const desktop = JSON.parse(await readFile2(desktopPath, "utf8"));
485
554
  if (!/^[a-f0-9]{32}$/.test(config.desktopId))
486
555
  throw new Error("Invalid desktop identity.");
487
556
  desktop.name = `disposabl-desktop-${config.desktopId}`;
488
557
  desktop.disposablDesktopId = config.desktopId;
489
558
  desktop.productName = name;
490
559
  desktop.description = `${name} desktop app`;
491
- await writeFile(desktopPath, JSON.stringify(desktop, null, 2) + `
560
+ await writeFile2(desktopPath, JSON.stringify(desktop, null, 2) + `
492
561
  `);
493
- const lockPath = join(destination, "bun.lock");
494
- let lock = await readFile(lockPath, "utf8");
562
+ const lockPath = join2(destination, "bun.lock");
563
+ let lock = await readFile2(lockPath, "utf8");
495
564
  lock = lock.replace(`"apps/desktop": {
496
565
  "name": "desktop"`, `"apps/desktop": {
497
566
  "name": "${desktop.name}"`).replace('"desktop": ["desktop@workspace:apps/desktop"]', `"${desktop.name}": ["${desktop.name}@workspace:apps/desktop"]`);
498
- await writeFile(lockPath, lock);
567
+ await writeFile2(lockPath, lock);
499
568
  }
500
569
  if (folders.includes("apps/mobile")) {
501
- const appConfigPath = join(destination, "apps/mobile/app.json");
502
- const appConfig = JSON.parse(await readFile(appConfigPath, "utf8"));
570
+ const appConfigPath = join2(destination, "apps/mobile/app.json");
571
+ const appConfig = JSON.parse(await readFile2(appConfigPath, "utf8"));
503
572
  appConfig.expo.name = name;
504
573
  appConfig.expo.slug = name;
505
- await writeFile(appConfigPath, JSON.stringify(appConfig, null, 2) + `
574
+ await writeFile2(appConfigPath, JSON.stringify(appConfig, null, 2) + `
506
575
  `);
507
576
  }
508
- await writeFile(join(destination, "disposabl.json"), JSON.stringify(config, null, 2) + `
577
+ await writeFile2(join2(destination, "disposabl.json"), JSON.stringify(config, null, 2) + `
509
578
  `);
510
579
  } catch (error) {
511
- await rm(destination, { recursive: true, force: true });
580
+ await rm2(destination, { recursive: true, force: true });
512
581
  throw error;
513
582
  }
514
583
  return folders;
@@ -519,20 +588,20 @@ import {
519
588
  lstat,
520
589
  mkdtemp,
521
590
  mkdir as mkdir2,
522
- readFile as readFile2,
591
+ readFile as readFile3,
523
592
  readdir as readdir2,
524
- rm as rm2,
525
- writeFile as writeFile2
593
+ rm as rm3,
594
+ writeFile as writeFile3
526
595
  } from "node:fs/promises";
527
596
  import { tmpdir } from "node:os";
528
597
  import { randomUUID as randomUUID2 } from "node:crypto";
529
- import { dirname, join as join2, resolve, sep } from "node:path";
598
+ import { basename as basename2, dirname, join as join3, resolve, sep as sep2 } from "node:path";
530
599
  async function files(root, path = "") {
531
600
  const result = [];
532
- for (const entry of await readdir2(join2(root, path), {
601
+ for (const entry of await readdir2(join3(root, path), {
533
602
  withFileTypes: true
534
603
  })) {
535
- const relative = join2(path, entry.name);
604
+ const relative = join3(path, entry.name);
536
605
  if (entry.isSymbolicLink())
537
606
  throw new Error(`Symlink in starter: ${relative}`);
538
607
  if (entry.isDirectory())
@@ -549,11 +618,11 @@ async function safeRead(root, path) {
549
618
  if ((await lstat(base)).isSymbolicLink())
550
619
  throw new Error(`Refusing symlink: ${base}`);
551
620
  const target = resolve(base, path);
552
- if (!target.startsWith(base + sep))
621
+ if (!target.startsWith(base + sep2))
553
622
  throw new Error(`Unsafe path: ${path}`);
554
623
  let current = base;
555
- for (const part of path.split(sep)) {
556
- current = join2(current, part);
624
+ for (const part of path.split(sep2)) {
625
+ current = join3(current, part);
557
626
  const stat = await lstat(current).catch((error) => {
558
627
  if (error.code === "ENOENT")
559
628
  return;
@@ -564,7 +633,7 @@ async function safeRead(root, path) {
564
633
  if (stat.isSymbolicLink())
565
634
  throw new Error(`Refusing symlink: ${current}`);
566
635
  }
567
- return readFile2(target);
636
+ return readFile3(target);
568
637
  }
569
638
  async function reconfigureApp(template, directory, version, options) {
570
639
  const configPath = "disposabl.json";
@@ -598,10 +667,10 @@ async function reconfigureApp(template, directory, version, options) {
598
667
  if (typeof name !== "string" || !/^[a-z0-9][a-z0-9._-]*$/.test(name))
599
668
  throw new Error("Invalid app name in package.json.");
600
669
  await files(template);
601
- const temp = await mkdtemp(join2(tmpdir(), "disposabl-reconfigure-"));
670
+ const temp = await mkdtemp(join3(tmpdir(), "disposabl-reconfigure-"));
602
671
  try {
603
- const before = join2(temp, "before");
604
- const after = join2(temp, "after");
672
+ const before = join3(temp, "before");
673
+ const after = join3(temp, "after");
605
674
  await createApp(template, before, name, {
606
675
  ...existing,
607
676
  desktopId: config.desktopId,
@@ -609,13 +678,31 @@ async function reconfigureApp(template, directory, version, options) {
609
678
  features: oldFeatures
610
679
  });
611
680
  await createApp(template, after, name, combined);
681
+ if (oldFeatures.includes("payments") && !config.features.includes("payments"))
682
+ await omitMobilePayments(after);
612
683
  const oldFiles = new Set(await files(before));
684
+ const nextFiles = new Set(await files(after));
613
685
  const changes = [];
614
- for (const path of await files(after)) {
686
+ if (oldFeatures.includes("payments") && !config.features.includes("payments")) {
687
+ const billing = join3(directory, nativeBillingPath);
688
+ const stat = await lstat(billing).catch((error) => {
689
+ if (error.code === "ENOENT")
690
+ return;
691
+ throw error;
692
+ });
693
+ if (stat?.isSymbolicLink())
694
+ throw new Error(`Refusing symlink: ${billing}`);
695
+ if (stat)
696
+ for (const path of await files(billing)) {
697
+ if (!oldFiles.has(nativeBillingPath + path))
698
+ throw new Error(`Cannot disable payments: ${nativeBillingPath + path} is a custom billing file. No files were changed.`);
699
+ }
700
+ }
701
+ for (const path of nextFiles) {
615
702
  if (path === configPath)
616
703
  continue;
617
- const next = await readFile2(join2(after, path));
618
- const prior = oldFiles.has(path) ? await readFile2(join2(before, path)) : undefined;
704
+ const next = await readFile3(join3(after, path));
705
+ const prior = oldFiles.has(path) ? await readFile3(join3(before, path)) : undefined;
619
706
  if (prior?.equals(next))
620
707
  continue;
621
708
  const current = await safeRead(directory, path);
@@ -629,31 +716,49 @@ async function reconfigureApp(template, directory, version, options) {
629
716
  continue;
630
717
  else if (current.equals(prior))
631
718
  changes.push({ path, content: next });
632
- else
633
- throw new Error(`Cannot reconfigure: ${path} conflicts with the starter changes. Reconcile this file and retry; no files were changed.`);
719
+ else {
720
+ const merged = basename2(path) === "package.json" ? mergePurchasesManifest(prior, next, current) : undefined;
721
+ if (merged)
722
+ changes.push({ path, content: merged });
723
+ else
724
+ throw new Error(`Cannot reconfigure: ${path} conflicts with the starter changes. Reconcile this file and retry; no files were changed.`);
725
+ }
726
+ }
727
+ for (const path of oldFiles) {
728
+ if (nextFiles.has(path) || !(path.startsWith(nativeBillingPath) || path === nativeBillingTest))
729
+ continue;
730
+ const current = await safeRead(directory, path);
731
+ if (!current)
732
+ continue;
733
+ if (!current.equals(await readFile3(join3(before, path))))
734
+ throw new Error(`Cannot disable payments: ${path} was customized. No files were changed.`);
735
+ changes.push({ path });
634
736
  }
635
737
  for (const { path } of changes)
636
738
  await safeRead(directory, path);
637
739
  for (const { path, content } of changes) {
638
- await mkdir2(dirname(join2(directory, path)), { recursive: true });
639
- await writeFile2(join2(directory, path), content);
740
+ if (content) {
741
+ await mkdir2(dirname(join3(directory, path)), { recursive: true });
742
+ await writeFile3(join3(directory, path), content);
743
+ } else
744
+ await rm3(join3(directory, path));
640
745
  }
641
- await writeFile2(join2(directory, configPath), JSON.stringify(config, null, 2) + `
746
+ await writeFile3(join3(directory, configPath), JSON.stringify(config, null, 2) + `
642
747
  `);
643
748
  return config;
644
749
  } finally {
645
- await rm2(temp, { recursive: true, force: true });
750
+ await rm3(temp, { recursive: true, force: true });
646
751
  }
647
752
  }
648
753
 
649
754
  // setup.ts
650
755
  import { execFileSync, spawn, spawnSync as spawnSync2 } from "node:child_process";
651
- import { readFile as readFile3, writeFile as writeFile3 } from "node:fs/promises";
652
- import { basename as basename3, join as join4 } from "node:path";
756
+ import { readFile as readFile4, writeFile as writeFile4 } from "node:fs/promises";
757
+ import { basename as basename4, join as join5 } from "node:path";
653
758
  import { fileURLToPath } from "node:url";
654
759
 
655
760
  // ../cli/preview.ts
656
- import { basename as basename2, join as join3, resolve as resolve2 } from "node:path";
761
+ import { basename as basename3, join as join4, resolve as resolve2 } from "node:path";
657
762
  import { spawnSync } from "node:child_process";
658
763
  function detectReference(directory = process.cwd()) {
659
764
  const git = (...args) => spawnSync("git", args, { cwd: directory, encoding: "utf8" }).stdout?.trim();
@@ -664,7 +769,7 @@ function detectReference(directory = process.cwd()) {
664
769
  const common = git("rev-parse", "--path-format=absolute", "--git-common-dir");
665
770
  const local = git("rev-parse", "--absolute-git-dir");
666
771
  if (root && common && local && common !== local)
667
- return basename2(root);
772
+ return basename3(root);
668
773
  throw new Error("Cannot detect a branch or worktree. Run inside the app's Git checkout or supply --reference.");
669
774
  }
670
775
 
@@ -708,8 +813,8 @@ var runDisposabl = (args, interactive = false, origin) => new Promise((resolve,
708
813
  });
709
814
  async function setupApp(directory, name, run = runDisposabl) {
710
815
  const reference = detectReference(directory);
711
- const path = join4(directory, "disposabl.json");
712
- const config = JSON.parse(await readFile3(path, "utf8"));
816
+ const path = join5(directory, "disposabl.json");
817
+ const config = JSON.parse(await readFile4(path, "utf8"));
713
818
  const origin = apiUrl(process.env.DISPOSABL_API_ORIGIN || config.serviceOrigin || SERVICE_ORIGIN);
714
819
  if (config.appId && config.serviceOrigin && apiUrl(config.serviceOrigin) !== origin)
715
820
  throw new Error("This app belongs to a different Disposabl service. Use its saved service origin.");
@@ -717,7 +822,7 @@ async function setupApp(directory, name, run = runDisposabl) {
717
822
  if (run === runDisposabl)
718
823
  run = (args, interactive) => runDisposabl(args, interactive, origin);
719
824
  config.features = resolveFeatures(config.features ?? []);
720
- await writeFile3(path, JSON.stringify(config, null, 2) + `
825
+ await writeFile4(path, JSON.stringify(config, null, 2) + `
721
826
  `);
722
827
  const status = await run(["login", "status"]);
723
828
  if (!status.currentUser) {
@@ -736,7 +841,7 @@ async function setupApp(directory, name, run = runDisposabl) {
736
841
  ...config.platforms.some((p) => p === "ios" || p === "android") ? ["--mobile"] : []
737
842
  ]);
738
843
  if (!connections.ready)
739
- throw new Error(`Finish connecting your app's accounts at ${connections.connectionsUrl ?? "https://www.disposabl.dev/dashboard/connections"}, then retry from the parent directory: bun create disposabl-app@latest ` + basename3(directory) + ". Your app files and login are saved.");
844
+ throw new Error(`Finish connecting your app's accounts at ${connections.connectionsUrl ?? "https://www.disposabl.dev/dashboard/connections"}, then retry from the parent directory: bun create disposabl-app@latest ` + basename4(directory) + ". Your app files and login are saved.");
740
845
  if (!config.appId) {
741
846
  const app = await run([
742
847
  "apps",
@@ -749,7 +854,7 @@ async function setupApp(directory, name, run = runDisposabl) {
749
854
  JSON.stringify(config.features)
750
855
  ]);
751
856
  config.appId = app.appId;
752
- await writeFile3(path, JSON.stringify(config, null, 2) + `
857
+ await writeFile4(path, JSON.stringify(config, null, 2) + `
753
858
  `);
754
859
  execFileSync("bun", ["fmt", "disposabl.json"], {
755
860
  cwd: directory,
@@ -906,9 +1011,9 @@ async function main() {
906
1011
  if (options.appId && !/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(options.appId))
907
1012
  throw new Error("--app-id must be a lowercase UUID v4.");
908
1013
  let directory = resolve3(name);
909
- if (pathExists(join5(directory, "disposabl.json"))) {
1014
+ if (pathExists(join6(directory, "disposabl.json"))) {
910
1015
  if (options.appId) {
911
- const existing = JSON.parse(readFileSync(join5(directory, "disposabl.json"), "utf8"));
1016
+ const existing = JSON.parse(readFileSync(join6(directory, "disposabl.json"), "utf8"));
912
1017
  if (existing.appId !== options.appId)
913
1018
  throw new Error("This directory belongs to a different app. Choose a new directory.");
914
1019
  }
@@ -1,6 +1,16 @@
1
1
  const { getDefaultConfig } = require("expo/metro-config");
2
2
  const { withNativewind } = require("nativewind/metro");
3
3
 
4
- module.exports = withNativewind(getDefaultConfig(__dirname), {
4
+ const config = getDefaultConfig(__dirname);
5
+ if (process.env.EXPO_NO_DOTENV === "1") {
6
+ // SDK 58's development env module otherwise reloads .env files after shell values.
7
+ const blocked = config.resolver.blockList ?? [];
8
+ config.resolver.blockList = [
9
+ ...(Array.isArray(blocked) ? blocked : [blocked]),
10
+ /[/\\]\.env(?:\.(?:local|development|production)(?:\.local)?)?$/,
11
+ ];
12
+ }
13
+
14
+ module.exports = withNativewind(config, {
5
15
  inlineVariables: false,
6
16
  });
@@ -8,7 +8,8 @@
8
8
  "build": "vite build",
9
9
  "lint": "eslint",
10
10
  "format": "prettier --write \"**/*.{ts,tsx}\"",
11
- "typecheck": "tsr generate && tsc --noEmit"
11
+ "typecheck": "tsr generate && tsc --noEmit",
12
+ "generate:routes": "tsr generate"
12
13
  },
13
14
  "dependencies": {
14
15
  "@disposabl/disposabl-kit": "workspace:*",
@@ -281,6 +281,7 @@
281
281
  },
282
282
  },
283
283
  "patchedDependencies": {
284
+ "expo-modules-core@58.0.30": "patches/expo-modules-core@58.0.30.patch",
284
285
  "react-native-css@3.1.0-rc.1": "patches/react-native-css@3.1.0-rc.1.patch",
285
286
  "@convex-dev/static-hosting@0.2.1": "patches/@convex-dev%2Fstatic-hosting@0.2.1.patch",
286
287
  },
@@ -39,7 +39,8 @@
39
39
  },
40
40
  "patchedDependencies": {
41
41
  "@convex-dev/static-hosting@0.2.1": "patches/@convex-dev%2Fstatic-hosting@0.2.1.patch",
42
- "react-native-css@3.1.0-rc.1": "patches/react-native-css@3.1.0-rc.1.patch"
42
+ "react-native-css@3.1.0-rc.1": "patches/react-native-css@3.1.0-rc.1.patch",
43
+ "expo-modules-core@58.0.30": "patches/expo-modules-core@58.0.30.patch"
43
44
  },
44
45
  "overrides": {
45
46
  "lightningcss": "1.30.1"
@@ -10,6 +10,8 @@ The app calls Autumn API 2.6.0 `customers.get_or_create`, `billing.attach`, and
10
10
 
11
11
  ## Native subscriptions and synchronization
12
12
 
13
+ Generated apps include RevenueCat and the native billing example only when payments is selected. Reconfiguring payments adds or removes that SDK and its unchanged example files; unrelated dependencies are preserved. Customized billing files must be reconciled before disabling payments. Run installation after reconfiguration and build a new native binary when the SDK selection changes.
14
+
13
15
  The account screen supports monthly subscriptions and restore through RevenueCat. Use Autumn's managed RevenueCat integration as the sole sync path, with the same authenticated user ID as RevenueCat `appUserID` and Autumn `customer_id`. Request beta access, connect a RevenueCat project and V2 read-only key in Autumn, map store-level subscription products to `credits_monthly`, and configure separate test and live webhooks using Autumn's provided URL and authorization. Block duplicate web/native subscriptions based on the provider customer state. Mobile purchases use RevenueCat, never Autumn attach. Await Autumn webhook synchronization before treating the Autumn balance as available.
14
16
 
15
17
  Set public build-time variables `EXPO_PUBLIC_REVENUECAT_IOS_API_KEY` and `EXPO_PUBLIC_REVENUECAT_ANDROID_API_KEY`, plus `EXPO_PUBLIC_REVENUECAT_IOS_MONTHLY_PRODUCT` and `EXPO_PUBLIC_REVENUECAT_ANDROID_MONTHLY_PRODUCT` to the exact store product identifiers. Configure each as a $5 monthly product with no unverified offers. The app displays the store's localized price. Build a new native binary after adding the SDK; Expo Go is insufficient. Android uses `singleTop` when payments is selected so external bank verification can return to the purchase.
@@ -1,5 +1,10 @@
1
+ import { appName } from "../../lib/app-name";
2
+
1
3
  export function Logo() {
2
- return (
4
+ if (!appName) return <span className="text-xl font-semibold">Home</span>;
5
+ return appName === "Disposabl" ? (
3
6
  <img src="/disposabl-logo.svg" alt="Disposabl" className="h-9 w-auto" />
7
+ ) : (
8
+ <span className="text-xl font-semibold">{appName}</span>
4
9
  );
5
10
  }
@@ -13,6 +13,7 @@ import { api } from "../../../backend/convex/_generated/api";
13
13
  import { authErrorMessage } from "../../lib/auth-errors";
14
14
  import { GoogleSignIn } from "./google-sign-in";
15
15
  import { PasswordPage } from "./password-page";
16
+ import { appName } from "../../lib/app-name";
16
17
  import { Button } from "./ui/button";
17
18
  import { Field, FieldGroup, FieldLabel } from "./ui/field";
18
19
  import { Input } from "./ui/input";
@@ -58,7 +59,7 @@ export function PasswordAuthForm({
58
59
  if (providers.googleOnly)
59
60
  return (
60
61
  <PasswordPage
61
- title="Welcome to Disposabl"
62
+ title={appName ? `Welcome to ${appName}` : "Welcome"}
62
63
  description="Sign in or create an account with Google."
63
64
  >
64
65
  <GoogleSignIn />
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { Logo } from "./logo";
3
+ import { appName } from "../../lib/app-name";
3
4
 
4
5
  export function PasswordPage({
5
6
  title,
@@ -13,15 +14,17 @@ export function PasswordPage({
13
14
  return (
14
15
  <main className="flex min-h-[calc(100svh-73px)] items-center justify-center bg-[#faf9f6] px-5 py-12 text-[#161b2e] sm:px-8">
15
16
  <div className="w-full max-w-md">
16
- <a
17
- href="/"
18
- className="mb-8 inline-block rounded-md focus-visible:outline-2 focus-visible:outline-offset-4"
19
- >
20
- <Logo />
21
- </a>
17
+ {appName && (
18
+ <a
19
+ href="/"
20
+ className="mb-8 inline-block rounded-md focus-visible:outline-2 focus-visible:outline-offset-4"
21
+ >
22
+ <Logo />
23
+ </a>
24
+ )}
22
25
  <section className="rounded-2xl border border-[#e0e4ed] bg-white p-6 shadow-[0_12px_40px_-24px_rgba(22,27,46,0.2)] sm:p-8">
23
26
  <p className="mb-3 text-xs font-bold tracking-[0.15em] text-[#687080] uppercase">
24
- Your Disposabl account
27
+ Your {appName ? `${appName} account` : "account"}
25
28
  </p>
26
29
  <h1 className="text-3xl font-semibold tracking-tight">{title}</h1>
27
30
  {description && (
@@ -1,4 +1,5 @@
1
1
  import { Logo } from "../components/logo";
2
+ import { appName } from "../../lib/app-name";
2
3
  import { LegalFooter } from "../components/legal-page";
3
4
  import { LogOut } from "../components/ui/log-out";
4
5
  import { useState } from "react";
@@ -76,7 +77,7 @@ function SiteHeader() {
76
77
  className="mx-auto flex max-w-5xl items-center justify-between px-6 py-4"
77
78
  aria-label="Main navigation"
78
79
  >
79
- <a href="/" aria-label="Disposabl home">
80
+ <a href="/" aria-label={appName ? `${appName} home` : "Home"}>
80
81
  <Logo />
81
82
  </a>
82
83
  <div className="flex items-center gap-5">
@@ -1,5 +1,5 @@
1
1
  import project from "../../../package.json";
2
- import settings from "../../../disposabl.json";
2
+ import { authenticationEnabled, analyticsEnabled } from "../features";
3
3
 
4
4
  // Public draft details. Each app publisher must review these before launch.
5
5
  export const legalConfig = {
@@ -18,7 +18,7 @@ export const legalConfig = {
18
18
  name: "Convex",
19
19
  purpose: "Application database, hosting, and account authentication",
20
20
  },
21
- ...(settings.features.includes("authentication")
21
+ ...(authenticationEnabled
22
22
  ? [
23
23
  {
24
24
  name: "Google",
@@ -27,7 +27,7 @@ export const legalConfig = {
27
27
  },
28
28
  ]
29
29
  : []),
30
- ...(settings.features.includes("analytics")
30
+ ...(analyticsEnabled
31
31
  ? [
32
32
  {
33
33
  name: "PostHog",
@@ -0,0 +1,10 @@
1
+ import { legalConfig } from "../legal/config";
2
+
3
+ // Remote app directories may use the app UUID as their package name.
4
+ export const displayAppName = (name: string) =>
5
+ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(
6
+ name,
7
+ )
8
+ ? null
9
+ : name;
10
+ export const appName = displayAppName(legalConfig.appName);
@@ -1,9 +1,50 @@
1
1
  import { router, Stack } from "expo-router";
2
2
  import type { ReactNode } from "react";
3
- import { ScrollView } from "react-native";
3
+ import { Pressable, ScrollView, Text } from "react-native";
4
4
  import { useSafeAreaInsets } from "react-native-safe-area-context";
5
5
  import { usePreferenceColors } from "../design/preferences";
6
6
 
7
+ export function ScreenCloseButton({
8
+ label,
9
+ onPress,
10
+ }: {
11
+ label: string;
12
+ onPress: () => void;
13
+ }) {
14
+ const colors = usePreferenceColors();
15
+ return process.env.EXPO_OS === "ios" ? (
16
+ <Stack.Toolbar placement="right">
17
+ <Stack.Toolbar.Button accessibilityLabel={label} onPress={onPress}>
18
+ Done
19
+ </Stack.Toolbar.Button>
20
+ </Stack.Toolbar>
21
+ ) : (
22
+ <Stack.Screen
23
+ options={{
24
+ headerRight: () => (
25
+ <Pressable
26
+ accessibilityRole="button"
27
+ accessibilityLabel={label}
28
+ hitSlop={12}
29
+ onPress={onPress}
30
+ >
31
+ <Text
32
+ style={{
33
+ color: colors.text,
34
+ fontSize: 16,
35
+ fontWeight: "600",
36
+ padding: 8,
37
+ }}
38
+ >
39
+ Done
40
+ </Text>
41
+ </Pressable>
42
+ ),
43
+ }}
44
+ />
45
+ );
46
+ }
47
+
7
48
  /** Native navigation owns the header and safe-area placement on every screen size. */
8
49
  export function SettingsPage({
9
50
  title = "Settings",
@@ -31,14 +72,7 @@ export function SettingsPage({
31
72
  contentStyle: { backgroundColor: colors.background },
32
73
  }}
33
74
  />
34
- <Stack.Toolbar placement="right">
35
- <Stack.Toolbar.Button
36
- accessibilityLabel="Close settings"
37
- onPress={onClose}
38
- >
39
- Done
40
- </Stack.Toolbar.Button>
41
- </Stack.Toolbar>
75
+ <ScreenCloseButton label="Close settings" onPress={onClose} />
42
76
  <ScrollView
43
77
  style={{ flex: 1, backgroundColor: colors.background }}
44
78
  contentInsetAdjustmentBehavior="automatic"
@@ -1,8 +1,24 @@
1
- import { Image } from "react-native";
1
+ import { Image, Text } from "react-native";
2
+ import { appName } from "../../lib/app-name";
2
3
  import { useResolvedColorScheme } from "./theme-provider";
3
4
 
4
5
  export function BrandMark() {
5
6
  const dark = useResolvedColorScheme() === "dark";
7
+ if (!appName) return null;
8
+ if (appName !== "Disposabl")
9
+ return (
10
+ <Text
11
+ style={{
12
+ color: dark ? "#fff" : "#161b2e",
13
+ fontSize: 22,
14
+ fontWeight: "600",
15
+ textAlign: "center",
16
+ marginBottom: 12,
17
+ }}
18
+ >
19
+ {appName}
20
+ </Text>
21
+ );
6
22
  return (
7
23
  <Image
8
24
  source={
@@ -6,6 +6,7 @@ export {
6
6
  } from "./layout";
7
7
  export { HomeScreen, PublicHomeScreen } from "./screens/home";
8
8
  export { AccountScreen } from "./screens/account";
9
+ export { SettingsPage, ScreenCloseButton } from "./components/settings-page";
9
10
  export { LoginScreen } from "./screens/login";
10
11
  export { SignupScreen } from "./screens/signup";
11
12
  export { ChangePasswordScreen } from "./screens/change-password";
@@ -17,9 +17,11 @@ import {
17
17
  } from "../design/preferences";
18
18
  import { ThemedText } from "../design/themed-text";
19
19
  import { api } from "../lib/convex";
20
- import { authenticationEnabled, paymentsEnabled } from "../../features";
20
+ import * as features from "../../features";
21
+ // payments:start
21
22
  import { AccountBilling } from "../billing/account-billing";
22
23
  import { billingSession } from "../billing/session";
24
+ // payments:end
23
25
 
24
26
  type AccountScreenProps = {
25
27
  accountRows?: ReactNode;
@@ -37,7 +39,7 @@ async function copyEmail(email: string) {
37
39
 
38
40
  /** Preferences are public. Only account content requires an authenticated provider. */
39
41
  export function AccountScreen(props: AccountScreenProps) {
40
- return authenticationEnabled ? (
42
+ return features.authenticationEnabled ? (
41
43
  <SessionSettings {...props} />
42
44
  ) : (
43
45
  <GuestSettings {...props} />
@@ -60,7 +62,7 @@ function GuestSettings({
60
62
  }: AccountScreenProps & { loading?: boolean }) {
61
63
  return (
62
64
  <SettingsPage>
63
- {authenticationEnabled && (
65
+ {features.authenticationEnabled && (
64
66
  <PreferenceSection title="Account">
65
67
  <PreferenceRow
66
68
  icon={{ ios: "person.crop.circle", android: "account_circle" }}
@@ -97,18 +99,24 @@ function SignedInSettings({
97
99
  const { signOut } = useAuthActions();
98
100
  const [pending, setPending] = useState(false);
99
101
  const [error, setError] = useState<string | null>(null);
102
+ // payments:start
100
103
  const [billingEpoch, setBillingEpoch] = useState(0);
104
+ // payments:end
101
105
 
102
106
  async function logOut() {
103
107
  if (pending) return;
108
+ // payments:start
104
109
  billingSession.select(null);
110
+ // payments:end
105
111
  setPending(true);
106
112
  setError(null);
107
113
  try {
108
114
  await signOut();
109
115
  router.dismissTo("/");
110
116
  } catch {
117
+ // payments:start
111
118
  setBillingEpoch((value) => value + 1);
119
+ // payments:end
112
120
  setError("Couldn't clear your session. Please try logging out again.");
113
121
  } finally {
114
122
  setPending(false);
@@ -146,7 +154,8 @@ function SignedInSettings({
146
154
  />
147
155
  </PreferenceSection>
148
156
  )}
149
- {isAuthenticated && user && paymentsEnabled && !pending && (
157
+ {/* payments:start */}
158
+ {isAuthenticated && user && features.paymentsEnabled && !pending && (
150
159
  <PreferenceSection title="Billing">
151
160
  <View style={{ padding: 20 }}>
152
161
  <AccountBilling
@@ -156,6 +165,7 @@ function SignedInSettings({
156
165
  </View>
157
166
  </PreferenceSection>
158
167
  )}
168
+ {/* payments:end */}
159
169
  <View className="mt-7">
160
170
  <PreferenceCard>
161
171
  <PreferenceRow
@@ -6,6 +6,7 @@ import { env } from "../../backend/convex/_generated/server";
6
6
  import modules from "../../backend/generated/platforms";
7
7
  import openapi from "../../backend/generated/openapi.json";
8
8
  import config from "../../../disposabl.json";
9
+ import { authenticationEnabled } from "../features";
9
10
  import { validatePlatforms } from "../platforms";
10
11
  // docs:start
11
12
  import { registerDocsRoutes } from "./lib/docs";
@@ -63,7 +64,7 @@ export const {
63
64
 
64
65
  export default function createHttpRouter(apiPolicy?: ApiPolicy) {
65
66
  const http = httpRouter();
66
- if (config.features.includes("authentication")) {
67
+ if (authenticationEnabled) {
67
68
  if (
68
69
  enabled.some((platform) => platform === "ios" || platform === "android")
69
70
  )
@@ -48,6 +48,8 @@ The config evaluates `apps/mobile/app.config.js` to use the same bundle IDs and
48
48
 
49
49
  For a development client with several Metro servers running, set `E2E_MOBILE_DEV_URL` to this app's Metro URL and `E2E_MOBILE_DEV_SCHEME` to its unique installed URL scheme. The mobile flows explicitly connect after launch and restart. This prevents accidentally testing another server or backend. Release builds omit both variables.
50
50
 
51
+ When supplying an isolated backend through Metro's shell environment, also set `EXPO_NO_DOTENV=1` and `EXPO_PUBLIC_E2E=true`. The Metro configuration excludes dotenv files in this mode: SDK 58's development environment module otherwise reloads `.env.local` after shell values. Set both `EXPO_PUBLIC_CONVEX_URL` and `EXPO_PUBLIC_CONVEX_SITE_URL` to the test backend, using the emulator's reachable host address. The test runner's `E2E_CONVEX_URL` and `E2E_CONVEX_SITE_URL` must address that same deployment from the host.
52
+
51
53
  ## CI
52
54
 
53
55
  The same commands work in CI without model credentials. On Linux, install Chromium's system dependencies with `bun run --cwd packages/tests setup:browser`. Provision an isolated backend and deploy the current functions before testing. Set its URLs, then run `bun run test --target web,backend` and include `,api` when `disposabl.json` enables it.
@@ -1,14 +1,14 @@
1
1
  import { openMobile } from "../helpers/mobile";
2
2
  import { test } from "@e2e-dev/mobile";
3
3
  import { expect } from "e2e";
4
- import config from "../../../disposabl.json";
4
+ import { project } from "../project";
5
5
 
6
6
  test(
7
7
  "disabled authentication blocks the retained password link",
8
8
  { platforms: ["ios", "android"] },
9
9
  async ({ app, device, screen }) => {
10
10
  test.skip(
11
- config.features.includes("authentication"),
11
+ project.features.includes("authentication"),
12
12
  "Requires authentication disabled",
13
13
  );
14
14
  await openMobile({ app, device, screen });
@@ -10,8 +10,6 @@ export async function openMobile(
10
10
  }: Pick<TestFixtures, "app" | "screen"> & { device: Device },
11
11
  restart = false,
12
12
  ) {
13
- if (restart) await app.restart();
14
- else await app.open();
15
13
  const origin = process.env.E2E_MOBILE_DEV_URL;
16
14
  if (origin) {
17
15
  const scheme = process.env.E2E_MOBILE_DEV_SCHEME;
@@ -23,8 +21,12 @@ export async function openMobile(
23
21
  url.searchParams.set("url", origin);
24
22
  url.searchParams.set("__expo_disable_fab", "1");
25
23
  url.searchParams.set("__expo_disable_onboarding", "1");
24
+ // Launch the selected project once. Opening the saved project first races
25
+ // native initialization against the development client's redirect/reload.
26
+ await device.closeApp();
26
27
  await device.openLink(url.href);
27
- }
28
+ } else if (restart) await app.restart();
29
+ else await app.open();
28
30
  const settings = screen.getByRole("button", "Settings", { exact: true });
29
31
  await expect(settings).toHaveCount(1, { timeout: 30_000 });
30
32
  await expect(settings).toBeVisible({ timeout: 30_000 });
@@ -143,7 +143,7 @@ test("page ingestion derives identity from the verified session, never the body"
143
143
  const { page } = await import("../backend/convex/telemetry");
144
144
  const { default: app } = await import("../../disposabl.json");
145
145
  const originalFeatures = [...app.features];
146
- app.features.push("analytics");
146
+ (app.features as string[]).push("analytics");
147
147
  process.env.DISPOSABL_ENVIRONMENT = "production";
148
148
  process.env.POSTHOG_PROJECT_TOKEN = "test-token";
149
149
  process.env.POSTHOG_HOST = "https://us.i.posthog.com";
@@ -244,115 +244,3 @@ test("deployment telemetry sends only approved platform, channel and elapsed tim
244
244
  );
245
245
  assert.notEqual(body.properties.app_id, appId);
246
246
  });
247
-
248
- test("release transitions measure from creation and ignore duplicate reports", async () => {
249
- const { report } = await import("../backend/convex/previews/internal");
250
- const { default: appConfig } = await import("../../disposabl.json");
251
- const features = [...appConfig.features];
252
- const original = Date.now;
253
- const scheduled: any[] = [];
254
- let release: any = null;
255
- const app = {
256
- _id: "row",
257
- _creationTime: 1000,
258
- appId: "11111111-1111-4111-8111-111111111111",
259
- userId: "owner",
260
- githubOwner: "owner",
261
- githubRepo: "repo",
262
- platforms: ["web"],
263
- };
264
- process.env.DISPOSABL_ENVIRONMENT = "production";
265
- process.env.POSTHOG_PROJECT_TOKEN = "token";
266
- process.env.POSTHOG_HOST = "https://us.i.posthog.com";
267
- delete process.env.E2E_TELEMETRY_DISABLED;
268
- delete process.env.POSTHOG_ENABLED;
269
- appConfig.features.push("analytics" as never);
270
- Date.now = () => 6000;
271
- const ctx = {
272
- scheduler: {
273
- runAfter: async (_delay: any, _fn: any, args: any) => {
274
- scheduled.push(args);
275
- },
276
- },
277
- db: {
278
- query: (table: string) => ({
279
- withIndex: () => ({
280
- unique: async () => (table === "apps" ? app : release),
281
- }),
282
- }),
283
- insert: async (_table: string, data: any) => {
284
- release = { _id: "release", ...data };
285
- },
286
- patch: async (_table: string, _id: string, data: any) => {
287
- release = { ...release, ...data };
288
- },
289
- },
290
- };
291
- const args = {
292
- userId: "owner",
293
- appId: "11111111-1111-4111-8111-111111111111",
294
- githubOwner: "owner",
295
- githubRepo: "repo",
296
- reference: "main",
297
- production: true,
298
- platform: "web",
299
- status: "ready",
300
- run: { id: 1, attempt: 1, number: 1, commitSha: "sha", url: "private" },
301
- };
302
- try {
303
- await (report as any)._handler(ctx, args);
304
- await (report as any)._handler(ctx, args);
305
- assert.equal(scheduled.length, 1);
306
- assert.deepEqual(scheduled[0].properties, {
307
- app_id: app.appId,
308
- platform: "web",
309
- channel: "production",
310
- outcome: "success",
311
- time_since_app_creation_ms: 5000,
312
- run_number: 1,
313
- run_attempt: 1,
314
- });
315
- Date.now = () => 604801000;
316
- const failed = {
317
- ...args,
318
- status: "failed",
319
- run: { ...args.run, id: 2, number: 2 },
320
- };
321
- await (report as any)._handler(ctx, failed);
322
- await (report as any)._handler(ctx, failed);
323
- assert.equal(scheduled.length, 2);
324
- assert.equal(scheduled[1].properties.outcome, "error");
325
- assert.equal(scheduled[1].properties.time_since_app_creation_ms, 604800000);
326
- assert.equal(
327
- scheduled[1].properties.app_id,
328
- scheduled[0].properties.app_id,
329
- );
330
- assert.equal(scheduled[1].properties.run_number, 2);
331
- // Older and duplicate reports cannot alter the latest attempt's observations.
332
- await (report as any)._handler(ctx, args);
333
- assert.equal(scheduled.length, 2);
334
- await (report as any)._handler(ctx, {
335
- ...failed,
336
- status: "ready",
337
- run: { ...failed.run, attempt: 2 },
338
- });
339
- assert.equal(scheduled[2].properties.run_attempt, 2);
340
- assert.equal(scheduled[2].properties.outcome, "success");
341
- // A same-attempt correction remains reconcilable by app/run/attempt/platform/channel.
342
- await (report as any)._handler(ctx, {
343
- ...failed,
344
- run: { ...failed.run, attempt: 2 },
345
- });
346
- assert.equal(scheduled[3].properties.run_attempt, 2);
347
- assert.equal(scheduled[3].properties.outcome, "error");
348
- process.env.E2E_TELEMETRY_DISABLED = "1";
349
- await (report as any)._handler(ctx, {
350
- ...args,
351
- run: { ...args.run, id: 3 },
352
- });
353
- assert.equal(scheduled.length, 4);
354
- } finally {
355
- Date.now = original;
356
- appConfig.features.splice(0, appConfig.features.length, ...features);
357
- }
358
- });
@@ -0,0 +1,23 @@
1
+ diff --git a/android/src/main/java/expo/modules/kotlin/jni/fabric/NativeStatePropsGetter.kt b/android/src/main/java/expo/modules/kotlin/jni/fabric/NativeStatePropsGetter.kt
2
+ index 1509bddac6ae6ee7e21857b27def28e8454fc33a..ed01ecde2f87404a42ea2899d5ab0016cd3a9df7 100644
3
+ --- a/android/src/main/java/expo/modules/kotlin/jni/fabric/NativeStatePropsGetter.kt
4
+ +++ b/android/src/main/java/expo/modules/kotlin/jni/fabric/NativeStatePropsGetter.kt
5
+ @@ -1,10 +1,18 @@
6
+ package expo.modules.kotlin.jni.fabric
7
+
8
+ import com.facebook.jni.HybridData
9
+ +import com.facebook.soloader.SoLoader
10
+ import com.facebook.yoga.annotations.DoNotStrip
11
+
12
+ @DoNotStrip
13
+ class NativeStatePropsGetter {
14
+ + companion object {
15
+ + init {
16
+ + // Expo UI can be destroyed before the JavaScript runtime installs JNI bindings.
17
+ + SoLoader.loadLibrary("expo-modules-core")
18
+ + }
19
+ + }
20
+ +
21
+ // We can't use StateWrapper directly, as this class is not exposed
22
+ external fun getStateProps(stateWrapper: Any): Map<String, Any?>?
23
+
@@ -71,7 +71,8 @@
71
71
  },
72
72
  "@disposabl/disposabl-kit#typecheck": {
73
73
  "dependsOn": [
74
- "^typecheck"
74
+ "^typecheck",
75
+ "@disposabl/web#generate:routes"
75
76
  ],
76
77
  "inputs": [
77
78
  "$TURBO_DEFAULT$",
@@ -104,6 +105,16 @@
104
105
  "^build"
105
106
  ],
106
107
  "cache": false
108
+ },
109
+ "@disposabl/web#generate:routes": {
110
+ "inputs": [
111
+ "$TURBO_DEFAULT$",
112
+ "!src/routeTree.gen.ts",
113
+ "$TURBO_ROOT$/packages/disposabl-kit/client/vite.config.ts"
114
+ ],
115
+ "outputs": [
116
+ "src/routeTree.gen.ts"
117
+ ]
107
118
  }
108
119
  },
109
120
  "globalDependencies": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -25,7 +25,8 @@
25
25
  "build": "bun build.ts",
26
26
  "typecheck": "bun check",
27
27
  "lint": "cd ../.. && eslint --config packages/create-disposabl-app/eslint.config.ts packages/create-disposabl-app reset.ts",
28
- "format": "bun fmt"
28
+ "format": "bun fmt",
29
+ "verify:starter": "bun ../tests/starter-ci.ts"
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public"
@@ -1,84 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { createFileRoute } from "@tanstack/react-router";
3
- import { useAuthActions } from "@convex-dev/auth/react";
4
- import { useMutation, useQuery } from "convex/react";
5
- import { api } from "../../../../packages/backend/convex/_generated/api";
6
- import { PasswordPage } from "../../../../packages/disposabl-kit/client/components/password-page";
7
- import { Button } from "@disposabl/disposabl-kit/client/components/ui/button";
8
-
9
- export const Route = createFileRoute("/_providers/mobile-login")({
10
- component: MobileLogin,
11
- });
12
-
13
- function MobileLogin() {
14
- const [framed] = useState(
15
- () => typeof window !== "undefined" && window.top !== window.self,
16
- );
17
- const [code] = useState(() =>
18
- typeof window === "undefined" ? "" : window.location.hash.slice(1),
19
- );
20
- const account = useQuery(
21
- api.browserHandoff.inspect,
22
- code && !framed ? { code } : "skip",
23
- );
24
- const redeem = useMutation(api.browserHandoff.redeem);
25
- const { setSession } = useAuthActions();
26
- const [pending, setPending] = useState(false);
27
- const [error, setError] = useState("");
28
- useEffect(() => {
29
- // Keep this single-use credential out of history, referrers and subsequent navigation.
30
- window.history.replaceState(
31
- window.history.state,
32
- "",
33
- window.location.pathname,
34
- );
35
- }, []);
36
- async function proceed() {
37
- if (pending || !account?.name) return;
38
- setPending(true);
39
- try {
40
- const session = await redeem({ code });
41
- await setSession(session);
42
- window.location.replace("/dashboard/connections?origin=mobile");
43
- } catch {
44
- setError(
45
- "This link could not sign you in. Open connections again from the app.",
46
- );
47
- setPending(false);
48
- }
49
- }
50
- return (
51
- <PasswordPage
52
- title="Continue from the app"
53
- description="Use your signed-in Disposabl account to connect your services."
54
- >
55
- {framed ? (
56
- <p role="alert">Open this link directly in your browser.</p>
57
- ) : code && account === undefined ? (
58
- <p>Checking your account…</p>
59
- ) : account?.name ? (
60
- <>
61
- <p className="break-words font-medium">{account.name}</p>
62
- <p>This signs this browser into the account shown above.</p>
63
- <Button
64
- className="min-h-12 w-full"
65
- disabled={pending}
66
- onClick={() => void proceed()}
67
- >
68
- {pending ? "Signing in…" : `Continue as ${account.name}`}
69
- </Button>
70
- </>
71
- ) : account ? (
72
- <p role="alert">
73
- Your account is signed in, but its email is missing. Reconnect Google
74
- in the app to confirm which account this browser should use.
75
- </p>
76
- ) : (
77
- <p role="alert">
78
- This link expired. Open connections again from the app.
79
- </p>
80
- )}
81
- {error && <p role="alert">{error}</p>}
82
- </PasswordPage>
83
- );
84
- }