create-disposabl-app 0.6.8 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/disposabl.js +32 -8
  2. package/dist/index.js +16 -6
  3. package/dist/templates/default/.github/scripts/mobile.sh +123 -0
  4. package/dist/templates/default/.github/scripts/release.sh +83 -0
  5. package/dist/templates/default/.github/workflows/pipeline.yml +22 -14
  6. package/dist/templates/default/AGENTS.md +2 -1
  7. package/dist/templates/default/apps/mobile/gitignore +43 -0
  8. package/dist/templates/default/apps/web/src/routeTree.gen.ts +23 -0
  9. package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.connections.tsx +354 -0
  10. package/dist/templates/default/apps/web/src/router/_authenticated/dashboard.tsx +1 -0
  11. package/dist/templates/default/dev.ts +2 -1
  12. package/dist/templates/default/packages/backend/AGENTS.md +2 -1
  13. package/dist/templates/default/packages/backend/README.md +4 -2
  14. package/dist/templates/default/packages/backend/convex/_generated/api.d.ts +14 -0
  15. package/dist/templates/default/packages/backend/convex/_generated/server.d.ts +5 -5
  16. package/dist/templates/default/packages/backend/convex/apps/actions/create.ts +11 -13
  17. package/dist/templates/default/packages/backend/convex/apps/actions/setup.ts +21 -7
  18. package/dist/templates/default/packages/backend/convex/apps/internal.ts +1 -6
  19. package/dist/templates/default/packages/backend/convex/connections/actions/credentials.ts +56 -0
  20. package/dist/templates/default/packages/backend/convex/connections/actions/expo.ts +79 -0
  21. package/dist/templates/default/packages/backend/convex/connections/actions/github.ts +120 -0
  22. package/dist/templates/default/packages/backend/convex/connections/actions/oauth.ts +128 -0
  23. package/dist/templates/default/packages/backend/convex/connections/index.ts +80 -0
  24. package/dist/templates/default/packages/backend/convex/connections/internal.ts +148 -0
  25. package/dist/templates/default/packages/backend/convex/connections/validator.ts +35 -0
  26. package/dist/templates/default/packages/backend/convex/convex.config.ts +5 -5
  27. package/dist/templates/default/packages/backend/convex/github/actions/provision.ts +2 -6
  28. package/dist/templates/default/packages/backend/convex/github/actions/secrets.ts +25 -11
  29. package/dist/templates/default/packages/backend/convex/github/actions/tokens.ts +19 -15
  30. package/dist/templates/default/packages/backend/convex/github/internal.ts +6 -8
  31. package/dist/templates/default/packages/backend/convex/previews/token/actions/create.ts +4 -3
  32. package/dist/templates/default/packages/backend/convex/previews/token/internal.ts +28 -1
  33. package/dist/templates/default/packages/backend/convex/schema.ts +17 -1
  34. package/dist/templates/default/packages/backend/generated/openapi.json +123 -1
  35. package/dist/templates/default/packages/backend/generated/pages.json +4 -0
  36. package/dist/templates/default/packages/backend/generated/platforms.ts +12 -10
  37. package/dist/templates/default/packages/backend/gitignore +16 -0
  38. package/dist/templates/default/packages/cli/auth.ts +15 -17
  39. package/dist/templates/default/packages/cli/commands.ts +31 -1
  40. package/dist/templates/default/packages/disposabl-kit/client/components/logo.tsx +5 -0
  41. package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/login.tsx +118 -84
  42. package/dist/templates/default/packages/disposabl-kit/client/routes/_auth-pages/signUp.tsx +127 -89
  43. package/dist/templates/default/packages/disposabl-kit/client/routes/route.tsx +2 -5
  44. package/dist/templates/default/packages/sdk/src/generated/index.ts +5 -0
  45. package/dist/templates/default/packages/sdk/src/generated/sdk.gen.ts +20 -0
  46. package/dist/templates/default/packages/sdk/src/generated/types.gen.ts +53 -0
  47. package/package.json +1 -1
  48. package/dist/templates/default/.github/scripts/android-build.sh +0 -27
  49. package/dist/templates/default/.github/scripts/expo-channel.sh +0 -10
  50. package/dist/templates/default/.github/scripts/expo-env.sh +0 -37
  51. package/dist/templates/default/.github/scripts/expo-fingerprint.sh +0 -31
  52. package/dist/templates/default/.github/scripts/expo-update.sh +0 -13
  53. package/dist/templates/default/.github/scripts/package-release.sh +0 -23
  54. package/dist/templates/default/.github/scripts/release-publish.sh +0 -28
  55. package/dist/templates/default/.github/scripts/release-source.sh +0 -14
  56. package/dist/templates/default/.github/scripts/verify-artifacts.sh +0 -13
  57. package/dist/templates/default/.github/scripts/web-deploy.sh +0 -10
  58. package/dist/templates/default/apps/mobile/.env.example +0 -2
  59. package/dist/templates/default/apps/web/.env.example +0 -3
package/dist/disposabl.js CHANGED
@@ -66,6 +66,13 @@ import {
66
66
  import { homedir } from "node:os";
67
67
  import { join } from "node:path";
68
68
  import { spawn } from "node:child_process";
69
+ function openUrl(url) {
70
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32" : "xdg-open";
71
+ const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", url] : [url];
72
+ const child = spawn(command, args, { stdio: "ignore" });
73
+ child.on("error", () => console.error("Open the URL manually."));
74
+ child.unref();
75
+ }
69
76
 
70
77
  class NotAuthenticated extends Error {
71
78
  }
@@ -170,13 +177,8 @@ async function unlockedLogin(url, openBrowser = true) {
170
177
  throw new Error("Unexpected authorization server.");
171
178
  console.error(`Open this URL to sign in:
172
179
  ${authorizationUrl.href}`);
173
- if (openBrowser) {
174
- const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "rundll32" : "xdg-open";
175
- const args = process.platform === "win32" ? ["url.dll,FileProtocolHandler", authorizationUrl.href] : [authorizationUrl.href];
176
- const child = spawn(command, args, { stdio: "ignore" });
177
- child.on("error", () => console.error("Open the sign-in URL manually."));
178
- child.unref();
179
- }
180
+ if (openBrowser)
181
+ openUrl(authorizationUrl.href);
180
182
  }, state);
181
183
  let timer;
182
184
  try {
@@ -465,6 +467,9 @@ async function runCli(argv = process.argv, serviceOrigin = SERVICE_ORIGIN) {
465
467
  for (const part of parts.slice(0, -1))
466
468
  parent = parent.commands.find((command) => command.name() === part) ?? parent.command(part);
467
469
  const command = parent.command(parts.at(-1));
470
+ const connectionStatus = path === "/api/connections/status";
471
+ if (connectionStatus)
472
+ command.option("--wait", "Open Connections and continue when GitHub and Convex are connected");
468
473
  const previewGet = path === "/api/previews/get";
469
474
  const tokenCreate = path === "/api/previews/token/create";
470
475
  if (previewGet)
@@ -522,7 +527,26 @@ async function runCli(argv = process.argv, serviceOrigin = SERVICE_ORIGIN) {
522
527
  result = await send(true);
523
528
  if (!result.ok)
524
529
  throw new Error(`API request failed (${result.status}): ${await result.text()}`);
525
- const value = await result.json();
530
+ let value = await result.json();
531
+ if (connectionStatus && options.wait && !value.ready) {
532
+ const url = `${base}/dashboard/connections`;
533
+ console.error(`Connect your GitHub and Convex accounts:
534
+ ${url}
535
+ Waiting for connections. Press Ctrl+C to keep your files and finish later.`);
536
+ openUrl(url);
537
+ const deadline = Date.now() + 15 * 60000;
538
+ while (!value.ready && Date.now() < deadline) {
539
+ await new Promise((resolve) => setTimeout(resolve, 3000));
540
+ result = await send();
541
+ if (result.status === 401 && !process.env.DISPOSABL_API_KEY)
542
+ result = await send(true);
543
+ if (!result.ok)
544
+ throw new Error(`Connection status failed (${result.status}). Your login and app files are saved.`);
545
+ value = await result.json();
546
+ }
547
+ if (!value.ready)
548
+ throw new Error(`Connections are still incomplete. Finish at ${url}, then retry setup.`);
549
+ }
526
550
  if (tokenCreate && options.configure) {
527
551
  await configureDevelopment(options.configure, value);
528
552
  const { deployKey: _secret, ...details } = value;
package/dist/index.js CHANGED
@@ -8,7 +8,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.6.8";
11
+ var version = "0.7.1";
12
12
 
13
13
  // ../disposabl-kit/platforms.ts
14
14
  var platforms = [
@@ -292,7 +292,7 @@ import {
292
292
  writeFile
293
293
  } from "node:fs/promises";
294
294
  import { existsSync } from "node:fs";
295
- import { join } from "node:path";
295
+ import { basename, join } from "node:path";
296
296
  async function createApp(template, destination, name, config, overwrite = false) {
297
297
  config = {
298
298
  ...config,
@@ -328,6 +328,7 @@ async function createApp(template, destination, name, config, overwrite = false)
328
328
  "packages/disposabl-kit/client/routes/_auth-pages",
329
329
  "packages/disposabl-kit/client/routes/consent.tsx",
330
330
  "apps/web/src/router/_authenticated/dashboard.api-keys.tsx",
331
+ "apps/web/src/router/_authenticated/dashboard.connections.tsx",
331
332
  "apps/mobile/src/app/(auth)",
332
333
  "apps/mobile/src/app/(authenticated)/account.tsx"
333
334
  ]) {
@@ -389,8 +390,10 @@ export const Route = createFileRoute("/_providers/_authenticated/dashboard")({
389
390
  if (existsSync(readme))
390
391
  await writeFile(readme, (await readFile(readme, "utf8")).replaceAll(`@disposabl/${kind}`, client.name));
391
392
  }
392
- if (existsSync(join(destination, "gitignore"))) {
393
- await rename(join(destination, "gitignore"), join(destination, ".gitignore"));
393
+ for (const path of await readdir(destination, { recursive: true })) {
394
+ if (basename(path) === "gitignore") {
395
+ await rename(join(destination, path), join(destination, path.replace(/gitignore$/, ".gitignore")));
396
+ }
394
397
  }
395
398
  const manifestPath = join(destination, "package.json");
396
399
  const manifest = JSON.parse(await readFile(manifestPath, "utf8"));
@@ -421,7 +424,7 @@ import { join as join3 } from "node:path";
421
424
  import { fileURLToPath } from "node:url";
422
425
 
423
426
  // ../cli/preview.ts
424
- import { basename, join as join2, resolve } from "node:path";
427
+ import { basename as basename2, join as join2, resolve } from "node:path";
425
428
  import { spawnSync } from "node:child_process";
426
429
  function detectReference(directory = process.cwd()) {
427
430
  const git = (...args) => spawnSync("git", args, { cwd: directory, encoding: "utf8" }).stdout?.trim();
@@ -432,7 +435,7 @@ function detectReference(directory = process.cwd()) {
432
435
  const common = git("rev-parse", "--path-format=absolute", "--git-common-dir");
433
436
  const local = git("rev-parse", "--absolute-git-dir");
434
437
  if (root && common && local && common !== local)
435
- return basename(root);
438
+ return basename2(root);
436
439
  throw new Error("Cannot detect a branch or worktree. Run inside the app's Git checkout or supply --reference.");
437
440
  }
438
441
 
@@ -468,6 +471,9 @@ async function setupApp(directory, name, run = runDisposabl) {
468
471
  if (!verified.currentUser)
469
472
  throw new Error("Login completed without a verified user.");
470
473
  }
474
+ const connections = await run(["connections", "status", "--wait"]);
475
+ if (!connections.ready)
476
+ throw new Error("Connect GitHub and Convex at https://www.disposabl.dev/dashboard/connections, then retry: bun create disposabl-app@latest " + directory + " --setup. Your app files and login are saved.");
471
477
  const path = join3(directory, "disposabl.json");
472
478
  const config = JSON.parse(await readFile2(path, "utf8"));
473
479
  if (config.appId) {
@@ -484,6 +490,10 @@ async function setupApp(directory, name, run = runDisposabl) {
484
490
  config.appId = app.appId;
485
491
  await writeFile2(path, JSON.stringify(config, null, 2) + `
486
492
  `);
493
+ execFileSync("bun", ["fmt", "disposabl.json"], {
494
+ cwd: directory,
495
+ stdio: "pipe"
496
+ });
487
497
  }
488
498
  await run([
489
499
  "previews",
@@ -0,0 +1,123 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ case "${1:?operation required}" in
4
+ expo-env)
5
+ if [[ -z "$EXPO_PROJECT_ID" ]]; then
6
+ # Initialize with static config; app.config.js reads the resulting environment.
7
+ mkdir -p "$RUNNER_TEMP/expo-project"
8
+ jq --slurpfile app ../../disposabl.json --arg owner "${EXPO_OWNER:-}" '
9
+ {expo: {name: .expo.name, slug: (if $app[0].appId then "app-" + $app[0].appId else .expo.slug end)}}
10
+ | if $owner != "" then .expo.owner = $owner else . end
11
+ ' app.json > "$RUNNER_TEMP/expo-project/app.json"
12
+ printf '{"name":"expo-project","private":true}\n' > "$RUNNER_TEMP/expo-project/package.json"
13
+ (
14
+ cd "$RUNNER_TEMP/expo-project"
15
+ set -- init --force --non-interactive --json --no-icon
16
+ [[ -z "${EXPO_OWNER:-}" ]] || set -- "$@" --account "$EXPO_OWNER"
17
+ bun x "$EAS_CLI" "$@"
18
+ ) > "$RUNNER_TEMP/expo-project.json"
19
+ EXPO_PROJECT_ID=$(jq -er .projectId "$RUNNER_TEMP/expo-project.json")
20
+ EXPO_OWNER=$(jq -er .owner "$RUNNER_TEMP/expo-project.json")
21
+ EXPO_SLUG=$(jq -er .slug "$RUNNER_TEMP/expo-project.json")
22
+ export EXPO_PROJECT_ID EXPO_OWNER EXPO_SLUG
23
+ printf 'EXPO_PROJECT_ID=%s\nEXPO_OWNER=%s\nEXPO_SLUG=%s\n' "$EXPO_PROJECT_ID" "$EXPO_OWNER" "$EXPO_SLUG" >> "$GITHUB_ENV"
24
+ fi
25
+ jq --arg channel "$CHANNEL" '.build["ios-" + env.EAS_ENVIRONMENT].channel = $channel' eas.json > "$RUNNER_TEMP/eas.json"
26
+ mv "$RUNNER_TEMP/eas.json" eas.json
27
+ bun x "$EAS_CLI" env:pull --environment "$EAS_ENVIRONMENT" --path "$RUNNER_TEMP/expo.env" --non-interactive
28
+ bun -e '
29
+ import {parseEnv} from "node:util";
30
+ import {appendFileSync, readFileSync} from "node:fs";
31
+ for (const [key, value] of Object.entries(parseEnv(readFileSync(`${process.env.RUNNER_TEMP}/expo.env`, "utf8")))) {
32
+ // Web and mobile use the same backend from this deployment.
33
+ if (/^CONVEX_(URL|SITE_URL)$/.test(key) && value !== process.env[key]) throw new Error(`EAS overrides the deployed backend: ${key}`);
34
+ if (/^(EXPO_PUBLIC_|VITE_)?CONVEX_(URL|SITE_URL)$/.test(key)) continue;
35
+ if (/^(GITHUB_|RUNNER_|GH_|DISPOSABL_|BUN_|CI$|NODE_OPTIONS$|PATH$|HOME$|SOURCE(_PATH)?$|CHANNEL$|PLATFORM$|RELEASE_PREFIX$|MACOS_|EAS_(ENVIRONMENT|CLI)$|EXPO_(TOKEN|PROJECT_ID|OWNER|SLUG|NO_DOTENV)$)/.test(key)) throw new Error(`Reserved EAS variable: ${key}`);
36
+ const delimiter = crypto.randomUUID();
37
+ appendFileSync(process.env.GITHUB_ENV, `${key}<<${delimiter}\n${value}\n${delimiter}\n`);
38
+ }
39
+ '
40
+ ;;
41
+ expo-channel)
42
+ for ((offset=0; ; offset+=25)); do
43
+ bun x "$EAS_CLI" channel:list --json --limit 25 --offset "$offset" > "$RUNNER_TEMP/channels.json"
44
+ if jq -e --arg channel "$CHANNEL" 'any(.currentPage[]; .name == $channel)' "$RUNNER_TEMP/channels.json" > /dev/null; then
45
+ jq -e --arg channel "$CHANNEL" '.currentPage[] | select(.name == $channel) | (.isPaused == false) and (.updateBranches | length == 1) and (.updateBranches[0].name == $channel) and ((.branchMapping | fromjson).data == [{branchId: .updateBranches[0].id, branchMappingLogic: "true"}])' "$RUNNER_TEMP/channels.json" > /dev/null || { echo 'Preview channel must point only to its same-named branch'; exit 1; }
46
+ break
47
+ fi
48
+ if [[ $(jq '.currentPage | length' "$RUNNER_TEMP/channels.json") -lt 25 ]]; then bun x "$EAS_CLI" channel:create "$CHANNEL" --non-interactive; break; fi
49
+ done
50
+ ;;
51
+ expo-fingerprint)
52
+ artifact=android.apk
53
+ [[ "$CHANNEL" != production ]] || artifact=android.aab
54
+ export artifact
55
+ for ((page=1; ; page++)); do
56
+ gh api "repos/$GH_REPO/releases?per_page=100&page=$page" > "$RUNNER_TEMP/releases.json"
57
+ jq --arg artifact "$artifact" --arg tag "$RELEASE_PREFIX-$CHANNEL-android" --arg legacy "$RELEASE_PREFIX-$CHANNEL" '[.[] | select(.draft | not) | select(.tag_name == $tag or .tag_name == $legacy or (.tag_name | startswith($legacy + "-"))) | select(any(.assets[]; .name == $artifact))] | sort_by(.tag_name != $tag, .tag_name != $legacy) | .[0] // {}' "$RUNNER_TEMP/releases.json" > "$RUNNER_TEMP/release.json"
58
+ if jq -e '.id' "$RUNNER_TEMP/release.json" > /dev/null || [[ $(jq length "$RUNNER_TEMP/releases.json") -lt 100 ]]; then break; fi
59
+ done
60
+ bun x --no-install expo config --json > "$RUNNER_TEMP/mobile.json"
61
+ RUNTIME=$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er 'select(.fingerprintSources != null) | .runtimeVersion | select(test("^[a-f0-9]{40,64}$"))')
62
+ export RUNTIME
63
+ bun -e '
64
+ const config = await Bun.file(`${process.env.RUNNER_TEMP}/mobile.json`).json();
65
+ if (!config.extra?.eas?.projectId) throw new Error("Link an Expo project first");
66
+ const wanted = {channel: process.env.CHANNEL, projectId: config.extra.eas.projectId, applicationId: config.android.package, runtimeVersion: process.env.RUNTIME};
67
+ const release = await Bun.file(`${process.env.RUNNER_TEMP}/release.json`).json();
68
+ const prior = JSON.parse(/<!-- android (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
69
+ 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}`);
70
+ const blocked = !reusable && process.env.CHANNEL === "production" && process.env.ANDROID_SIGNING_READY !== "true";
71
+ if (blocked) {
72
+ const reason = "Configure Android production signing credentials before building an AAB.";
73
+ console.error(`::notice::${reason}`);
74
+ const report = Bun.spawnSync(["node", ".github/scripts/disposabl.mjs", "report", "android", "blocked", reason], {
75
+ cwd: process.env.GITHUB_WORKSPACE, stdout: "inherit", stderr: "inherit",
76
+ });
77
+ if (report.exitCode) throw new Error("Cannot report Android prerequisites.");
78
+ }
79
+ console.log(`build=${blocked ? "blocked" : !reusable}\nruntime=${wanted.runtimeVersion}\nmanifest=${JSON.stringify(wanted)}\ntag=${reusable ? release.tag_name : ""}\nsha=${reusable ? prior.sha256 : ""}`);
80
+ ' >> "$GITHUB_OUTPUT"
81
+ ;;
82
+ expo-update)
83
+ artifact=android.apk
84
+ [[ "$CHANNEL" != production ]] || artifact=android.aab
85
+ mkdir -p dist/release
86
+ gh release download "$TAG" --pattern "$artifact" --dir dist/release
87
+ echo "$SHA dist/release/$artifact" | sha256sum --check
88
+ cd apps/mobile
89
+ bun x --no-install expo export --platform android --output-dir dist/update
90
+ test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
91
+ test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
92
+ bun x "$EAS_CLI" update --platform android --channel "$CHANNEL" --environment "$EAS_ENVIRONMENT" --skip-bundler --input-dir dist/update --message "$SOURCE" --non-interactive
93
+ jq --arg sha "$SHA" '. + {sha256: $sha, action: "update"}' <<< "$MANIFEST" > ../../dist/release/android.json
94
+ ;;
95
+ android-build)
96
+ test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
97
+ if [[ "$CHANNEL" == production ]]; then
98
+ : "${ANDROID_KEYSTORE_BASE64:?}" "${ANDROID_KEYSTORE_PASSWORD:?}" "${ANDROID_KEY_ALIAS:?}" "${ANDROID_KEY_PASSWORD:?}"
99
+ export ANDROID_KEYSTORE_PATH="$RUNNER_TEMP/android-release.jks"
100
+ trap 'rm -f "$ANDROID_KEYSTORE_PATH"' EXIT
101
+ (umask 077; printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$ANDROID_KEYSTORE_PATH")
102
+ fi
103
+ bun x --no-install expo prebuild --platform android --no-install
104
+ test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
105
+ task=assembleRelease
106
+ artifact=android.apk
107
+ binary=android/app/build/outputs/apk/release/app-release.apk
108
+ fingerprint=assets/fingerprint
109
+ if [[ "$CHANNEL" == production ]]; then
110
+ task=bundleRelease
111
+ artifact=android.aab
112
+ binary=android/app/build/outputs/bundle/release/app-release.aab
113
+ fingerprint=base/assets/fingerprint
114
+ fi
115
+ (cd android && ./gradlew ":app:$task" --no-daemon --build-cache)
116
+ test "$(unzip -p "$binary" "$fingerprint")" = "$RUNTIME"
117
+ test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
118
+ mkdir -p ../../dist/release
119
+ cp "$binary" "../../dist/release/$artifact"
120
+ jq --arg sha "$(sha256sum "$binary" | cut -d' ' -f1)" '. + {sha256: $sha, action: "build"}' <<< "$MANIFEST" > ../../dist/release/android.json
121
+ ;;
122
+ *) echo "Unknown operation: $1" >&2; exit 1 ;;
123
+ esac
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ case "${1:?operation required}" in
4
+ package-release)
5
+ [[ -f "packages/$PACKAGE/package.json" ]] || exit 0
6
+ platform=$PACKAGE
7
+ [[ "$PACKAGE" != sdk ]] || platform=typescript-sdk
8
+ bun run generate
9
+ bun run --cwd "packages/$PACKAGE" typecheck
10
+ name=$(node -p "require('./packages/$PACKAGE/package.json').name")
11
+ if ! previous=$(npm view "$name" version 2>/dev/null); then
12
+ node .github/scripts/disposabl.mjs report "$platform" blocked 'Publish the package once and configure npm trusted publishing.'
13
+ exit 0
14
+ fi
15
+ node .github/scripts/disposabl.mjs report "$platform" building
16
+ if GITHUB_TOKEN="$GH_TOKEN" npm_config_workspaces_update=false bun run --cwd "packages/$PACKAGE" release; then
17
+ version=$(node -p "require('./packages/$PACKAGE/package.json').version")
18
+ [[ "$version" != *development* ]] || version=$previous
19
+ PUBLISHED_VERSION=$(npm view "$name@$version" version)
20
+ export PUBLISHED_VERSION
21
+ node .github/scripts/disposabl.mjs report "$platform" ready
22
+ else
23
+ node .github/scripts/disposabl.mjs report "$platform" failed 'Package publication failed; check trusted publishing and the workflow log.'
24
+ exit 1
25
+ fi
26
+ ;;
27
+ release-source)
28
+ if [[ "$GITHUB_EVENT_NAME" == push ]]; then
29
+ echo 'current=true' >> "$GITHUB_OUTPUT"
30
+ echo 'CHANNEL=production' >> "$GITHUB_ENV"
31
+ echo 'PRERELEASE=false' >> "$GITHUB_ENV"
32
+ exit
33
+ fi
34
+ echo 'PRERELEASE=true' >> "$GITHUB_ENV"
35
+ pr=$(gh api "repos/$GH_REPO/commits/$SOURCE/pulls" --jq ".[] | select(.state == \"open\" and .head.sha == \"$SOURCE\" and .head.repo.full_name == \"$GH_REPO\") | .number" | head -1)
36
+ if [[ -z "$pr" ]]; then echo 'current=false' >> "$GITHUB_OUTPUT"; exit; fi
37
+ echo 'current=true' >> "$GITHUB_OUTPUT"
38
+ echo "CHANNEL=pr-$pr" >> "$GITHUB_ENV"
39
+ echo "PR=$pr" >> "$GITHUB_ENV"
40
+ ;;
41
+ release-publish)
42
+ check_source() {
43
+ if [[ "$CHANNEL" == production ]]; then test "$(gh api "repos/$GH_REPO/git/ref/heads/main" --jq .object.sha)" = "$SOURCE"
44
+ else test "$(gh api "repos/$GH_REPO/pulls/$PR" --jq 'if .state == "open" then .head.sha else "closed" end')" = "$SOURCE"; fi
45
+ }
46
+ # Apple publication remains disabled along with the build jobs.
47
+ for platform in android linux windows; do
48
+ directory="artifacts/release-$platform"
49
+ test -d "$directory" || continue
50
+ check_source
51
+ tag="app-$CHANNEL-$platform"
52
+ if [[ "$CHANNEL" == production ]]; then tag+="-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"; fi
53
+ printf 'Platform: %s\nSource: %s\n' "$platform" "$SOURCE" > "$RUNNER_TEMP/release-notes.md"
54
+ if [[ -f "$directory/android.json" ]]; then printf '<!-- android %s -->\n' "$(jq -c . "$directory/android.json")" >> "$RUNNER_TEMP/release-notes.md"; fi
55
+ if gh release view "$tag" --json assets > "$RUNNER_TEMP/previous-release.json"; then
56
+ gh release upload "$tag" "$directory/"* --clobber
57
+ while IFS= read -r asset; do
58
+ if [[ ! -f "$directory/$asset" ]]; then check_source; gh release delete-asset "$tag" "$asset" --yes; fi
59
+ done < <(jq -r '.assets[].name' "$RUNNER_TEMP/previous-release.json")
60
+ gh api --method PATCH "repos/$GH_REPO/git/refs/tags/$tag" -f sha="$SOURCE" -F force=true > /dev/null
61
+ else
62
+ gh release create "$tag" "$directory/"* --draft --target "$SOURCE" --title "$CHANNEL / $platform" --notes-file "$RUNNER_TEMP/release-notes.md" --prerelease="$PRERELEASE"
63
+ fi
64
+ check_source
65
+ gh release edit "$tag" --notes-file "$RUNNER_TEMP/release-notes.md" --draft=false --prerelease="$PRERELEASE" --latest=false
66
+ node .github/scripts/disposabl.mjs release "$platform" "$tag"
67
+ done
68
+ ;;
69
+ verify-artifacts)
70
+ check_source() { test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"; }
71
+ check_source
72
+ for file in dist/release/*; do test -f "$file"; test -s "$file"; done
73
+ case "$PLATFORM" in
74
+ android) artifact=android.apk; [[ "$CHANNEL" != production ]] || artifact=android.aab; test -s "dist/release/$artifact"; test -s dist/release/android.json ;;
75
+ ios) test -s dist/release/ios.ipa; test -s dist/release/ios.json ;;
76
+ linux) compgen -G 'dist/release/*.deb' > /dev/null; compgen -G 'dist/release/*.rpm' > /dev/null ;;
77
+ windows) compgen -G 'dist/release/*.exe' > /dev/null; compgen -G 'dist/release/*.nupkg' > /dev/null; test -s dist/release/RELEASES ;;
78
+ macos) compgen -G 'dist/release/*.dmg' > /dev/null ;;
79
+ *) exit 1 ;;
80
+ esac
81
+ ;;
82
+ *) echo "Unknown operation: $1" >&2; exit 1 ;;
83
+ esac
@@ -17,8 +17,8 @@ env:
17
17
  EAS_CLI: eas-cli@27.2.0
18
18
  BUN_VERSION: &bun-version "1.4.4"
19
19
  NODE_VERSION: &node-version "24"
20
- LINUX_RUNNER: &linux-runner blacksmith-4vcpu-ubuntu-2404
21
- WEB_RUNNER: &web-runner blacksmith-2vcpu-ubuntu-2404
20
+ LINUX_RUNNER: &linux-runner ubuntu-latest
21
+ WEB_RUNNER: &web-runner ubuntu-latest
22
22
  WINDOWS_RUNNER: blacksmith-2vcpu-windows-2025
23
23
  RELEASE_PREFIX: app
24
24
  DISPOSABL_ANDROID_VERSION_CODE: ${{ github.run_number }}
@@ -50,7 +50,7 @@ jobs:
50
50
  ANDROID_SIGNING_READY: ${{ secrets.ANDROID_KEYSTORE_BASE64 != '' && secrets.ANDROID_KEYSTORE_PASSWORD != '' && secrets.ANDROID_KEY_ALIAS != '' && secrets.ANDROID_KEY_PASSWORD != '' }}
51
51
  EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
52
52
  EXPO_PROJECT_ID: ${{ vars.EXPO_PROJECT_ID }}
53
- EXPO_OWNER: ${{ vars.EXPO_OWNER }}
53
+ EXPO_OWNER: ${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}
54
54
  EXPO_SLUG: ${{ vars.EXPO_SLUG }}
55
55
  EXPO_NO_DOTENV: "1"
56
56
  steps:
@@ -101,7 +101,15 @@ jobs:
101
101
  env:
102
102
  TRUSTED: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
103
103
  CONVEX_DEPLOY_KEY: ${{ secrets[github.event_name == 'push' && 'CONVEX_DEPLOY_KEY' || 'CONVEX_DEPLOY_KEY_PREVIEW'] }}
104
- run: bash "$GITHUB_WORKSPACE/.github/scripts/web-deploy.sh"
104
+ run: |
105
+ if [[ "$TRUSTED" != true ]]; then VITE_CONVEX_URL=https://ci.invalid VITE_CONVEX_SITE_URL=https://ci.invalid bun run build --filter=@disposabl/web; exit; fi
106
+ : "${CONVEX_DEPLOY_KEY:?Configure the Convex deployment secret for this repository}"
107
+ cd packages/backend
108
+ export AUTH_TARGET=--prod
109
+ target=()
110
+ if [[ "$CHANNEL" != production ]]; then export AUTH_TARGET="--preview-name $CHANNEL"; target=(--preview-name "$CHANNEL"); fi
111
+ bun x --no-install convex deploy --yes "${target[@]}" --cmd-url-env-var-name CONVEX_URL --cmd 'for name in CONVEX_URL CONVEX_SITE_URL; do value=$(printenv "$name"); test -n "$value" || exit 1; for prefix in "" VITE_ EXPO_PUBLIC_; do export "$prefix$name=$value"; printf "%s=%s\n" "$prefix$name" "$value" | tee -a "$GITHUB_ENV" >> "$GITHUB_OUTPUT"; done; done; bun x --no-install --package @convex-dev/auth auth --keys-only $AUTH_TARGET && bun run --cwd ../.. build --filter=@disposabl/web'
112
+ bun x --no-install static-hosting upload $AUTH_TARGET --no-spa --dist ../../apps/web/dist/client
105
113
  - name: Report web result
106
114
  if: always()
107
115
  run: node .github/scripts/disposabl.mjs report web,api,mcp ${{ steps.deploy.outcome == 'success' && 'ready' || 'failed' }}
@@ -109,16 +117,16 @@ jobs:
109
117
  name: Expo
110
118
  if: github.job == 'android' || steps.platforms.outputs.android == 'true'
111
119
  working-directory: apps/mobile
112
- run: bash "$GITHUB_WORKSPACE/.github/scripts/expo-env.sh"
120
+ run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-env
113
121
  - name: Channel
114
122
  if: steps.platforms.outputs.android == 'true'
115
123
  working-directory: apps/mobile
116
- run: bash "$GITHUB_WORKSPACE/.github/scripts/expo-channel.sh"
124
+ run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-channel
117
125
  - name: Fingerprint
118
126
  id: fingerprint
119
127
  if: steps.platforms.outputs.android == 'true'
120
128
  working-directory: apps/mobile
121
- run: bash "$GITHUB_WORKSPACE/.github/scripts/expo-fingerprint.sh"
129
+ run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-fingerprint
122
130
  - name: Update
123
131
  if: steps.fingerprint.outputs.build == 'false'
124
132
  env:
@@ -126,12 +134,12 @@ jobs:
126
134
  SHA: ${{ steps.fingerprint.outputs.sha }}
127
135
  RUNTIME: ${{ steps.fingerprint.outputs.runtime }}
128
136
  MANIFEST: ${{ steps.fingerprint.outputs.manifest }}
129
- run: bash "$GITHUB_WORKSPACE/.github/scripts/expo-update.sh"
137
+ run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" expo-update
130
138
  - &publish
131
139
  name: Publish
132
140
  if: github.job == 'android' || (github.job == 'web' && hashFiles('dist/release/android.json') != '') || github.job == 'desktop'
133
141
  shell: bash
134
- run: bash "$GITHUB_WORKSPACE/.github/scripts/verify-artifacts.sh"
142
+ run: bash "$GITHUB_WORKSPACE/.github/scripts/release.sh" verify-artifacts
135
143
  - &artifacts
136
144
  name: Upload release artifacts
137
145
  if: hashFiles('dist/release/*') != ''
@@ -152,7 +160,7 @@ jobs:
152
160
  PLATFORM: android
153
161
  EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
154
162
  EXPO_PROJECT_ID: ${{ vars.EXPO_PROJECT_ID }}
155
- EXPO_OWNER: ${{ vars.EXPO_OWNER }}
163
+ EXPO_OWNER: ${{ secrets.EXPO_OWNER || vars.EXPO_OWNER }}
156
164
  EXPO_SLUG: ${{ vars.EXPO_SLUG }}
157
165
  EXPO_NO_DOTENV: "1"
158
166
  CONVEX_URL: ${{ needs.web.outputs.convex_url }}
@@ -189,7 +197,7 @@ jobs:
189
197
  ANDROID_KEYSTORE_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_PASSWORD || '' }}
190
198
  ANDROID_KEY_ALIAS: ${{ github.event_name == 'push' && secrets.ANDROID_KEY_ALIAS || '' }}
191
199
  ANDROID_KEY_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEY_PASSWORD || '' }}
192
- run: bash "$GITHUB_WORKSPACE/.github/scripts/android-build.sh"
200
+ run: bash "$GITHUB_WORKSPACE/.github/scripts/mobile.sh" android-build
193
201
  - *publish
194
202
  - *artifacts
195
203
  - name: Report Android failure
@@ -263,7 +271,7 @@ jobs:
263
271
  - *install
264
272
  - *app-token
265
273
  - name: Publish package if configured
266
- run: bash .github/scripts/package-release.sh
274
+ run: bash .github/scripts/release.sh package-release
267
275
 
268
276
  # The publisher executes scripts from main only; the authorizer verifies workflow_sha.
269
277
  publish:
@@ -289,7 +297,7 @@ jobs:
289
297
  run: node .github/scripts/disposabl.mjs token
290
298
  - name: Select release source
291
299
  id: source
292
- run: bash .github/scripts/release-source.sh
300
+ run: bash .github/scripts/release.sh release-source
293
301
  - uses: actions/download-artifact@v4
294
302
  if: steps.source.outputs.current == 'true'
295
303
  with:
@@ -297,4 +305,4 @@ jobs:
297
305
  path: artifacts
298
306
  - name: Publish verified build artifacts
299
307
  if: steps.source.outputs.current == 'true'
300
- run: bash .github/scripts/release-publish.sh
308
+ run: bash .github/scripts/release.sh release-publish
@@ -2,4 +2,5 @@
2
2
 
3
3
  - Do not write automated tests or add test files.
4
4
  - Validate changes through real user behavior. Behavior-based test flows will be added later.
5
- - Keep code concise and source files under 300 lines. Simplify related code with each change.
5
+ - Keep code concise. Aim for roughly 300 lines per source file, but this is a guideline, not a hard limit. Keep related logic together; do not split files just to meet a line count.
6
+ - Simplify related code with each change.
@@ -0,0 +1,43 @@
1
+ # Learn more https://docs.github.com/en/get-started/getting-started-with-git/ignoring-files
2
+
3
+ # dependencies
4
+ node_modules/
5
+
6
+ # Expo
7
+ .expo/
8
+ dist/
9
+ web-build/
10
+ expo-env.d.ts
11
+
12
+ # Native
13
+ .kotlin/
14
+ *.orig.*
15
+ *.jks
16
+ *.p8
17
+ *.p12
18
+ *.key
19
+ *.mobileprovision
20
+
21
+ # Metro
22
+ .metro-health-check*
23
+
24
+ # debug
25
+ npm-debug.*
26
+ yarn-debug.*
27
+ yarn-error.*
28
+
29
+ # macOS
30
+ .DS_Store
31
+ *.pem
32
+
33
+ # local env files
34
+ .env*.local
35
+
36
+ # typescript
37
+ *.tsbuildinfo
38
+
39
+ example
40
+
41
+ # generated native folders
42
+ /ios
43
+ /android
@@ -17,6 +17,7 @@ import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPa
17
17
  import { Route as DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRouteImport } from './../../../packages/disposabl-kit/client/routes/_auth-pages/signUp'
18
18
  import { Route as AuthenticatedDashboardRouteImport } from './router/_authenticated/dashboard'
19
19
  import { Route as AuthenticatedDashboardDotapiKeysRouteImport } from './router/_authenticated/dashboard.api-keys'
20
+ import { Route as AuthenticatedDashboardDotconnectionsRouteImport } from './router/_authenticated/dashboard.connections'
20
21
 
21
22
  const DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRoute =
22
23
  DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesRouteRouteImport.update(
@@ -78,6 +79,12 @@ const AuthenticatedDashboardDotapiKeysRoute =
78
79
  path: '/api-keys',
79
80
  getParentRoute: () => AuthenticatedDashboardRoute,
80
81
  } as any)
82
+ const AuthenticatedDashboardDotconnectionsRoute =
83
+ AuthenticatedDashboardDotconnectionsRouteImport.update({
84
+ id: '/connections',
85
+ path: '/connections',
86
+ getParentRoute: () => AuthenticatedDashboardRoute,
87
+ } as any)
81
88
 
82
89
  export interface FileRoutesByFullPath {
83
90
  '/': typeof IndexRoute
@@ -86,6 +93,7 @@ export interface FileRoutesByFullPath {
86
93
  '/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
87
94
  '/dashboard': typeof AuthenticatedDashboardRouteWithChildren
88
95
  '/dashboard/api-keys': typeof AuthenticatedDashboardDotapiKeysRoute
96
+ '/dashboard/connections': typeof AuthenticatedDashboardDotconnectionsRoute
89
97
  }
90
98
  export interface FileRoutesByTo {
91
99
  '/': typeof IndexRoute
@@ -94,6 +102,7 @@ export interface FileRoutesByTo {
94
102
  '/signup': typeof DotDotDotDotDotDotDotDotPackagesDisposablKitClientRoutesAuthPagesSignUpRoute
95
103
  '/dashboard': typeof AuthenticatedDashboardRouteWithChildren
96
104
  '/dashboard/api-keys': typeof AuthenticatedDashboardDotapiKeysRoute
105
+ '/dashboard/connections': typeof AuthenticatedDashboardDotconnectionsRoute
97
106
  }
98
107
  export interface FileRoutesById {
99
108
  __root__: typeof rootRouteImport
@@ -105,6 +114,7 @@ export interface FileRoutesById {
105
114
  '/_providers/': typeof IndexRoute
106
115
  '/_providers/_authenticated/dashboard': typeof AuthenticatedDashboardRouteWithChildren
107
116
  '/_providers/_authenticated/dashboard/api-keys': typeof AuthenticatedDashboardDotapiKeysRoute
117
+ '/_providers/_authenticated/dashboard/connections': typeof AuthenticatedDashboardDotconnectionsRoute
108
118
  }
109
119
  export interface FileRouteTypes {
110
120
  fileRoutesByFullPath: FileRoutesByFullPath
@@ -115,6 +125,7 @@ export interface FileRouteTypes {
115
125
  | '/signup'
116
126
  | '/dashboard'
117
127
  | '/dashboard/api-keys'
128
+ | '/dashboard/connections'
118
129
  fileRoutesByTo: FileRoutesByTo
119
130
  to:
120
131
  | '/'
@@ -123,6 +134,7 @@ export interface FileRouteTypes {
123
134
  | '/signup'
124
135
  | '/dashboard'
125
136
  | '/dashboard/api-keys'
137
+ | '/dashboard/connections'
126
138
  id:
127
139
  | '__root__'
128
140
  | '/_providers'
@@ -133,6 +145,7 @@ export interface FileRouteTypes {
133
145
  | '/_providers/'
134
146
  | '/_providers/_authenticated/dashboard'
135
147
  | '/_providers/_authenticated/dashboard/api-keys'
148
+ | '/_providers/_authenticated/dashboard/connections'
136
149
  fileRoutesById: FileRoutesById
137
150
  }
138
151
  export interface RootRouteChildren {
@@ -197,17 +210,27 @@ declare module '@tanstack/react-router' {
197
210
  preLoaderRoute: typeof AuthenticatedDashboardDotapiKeysRouteImport
198
211
  parentRoute: typeof AuthenticatedDashboardRoute
199
212
  }
213
+ '/_providers/_authenticated/dashboard/connections': {
214
+ id: '/_providers/_authenticated/dashboard/connections'
215
+ path: '/connections'
216
+ fullPath: '/dashboard/connections'
217
+ preLoaderRoute: typeof AuthenticatedDashboardDotconnectionsRouteImport
218
+ parentRoute: typeof AuthenticatedDashboardRoute
219
+ }
200
220
  }
201
221
  }
202
222
 
203
223
  interface AuthenticatedDashboardRouteChildren {
204
224
  AuthenticatedDashboardDotapiKeysRoute: typeof AuthenticatedDashboardDotapiKeysRoute
225
+ AuthenticatedDashboardDotconnectionsRoute: typeof AuthenticatedDashboardDotconnectionsRoute
205
226
  }
206
227
 
207
228
  const AuthenticatedDashboardRouteChildren: AuthenticatedDashboardRouteChildren =
208
229
  {
209
230
  AuthenticatedDashboardDotapiKeysRoute:
210
231
  AuthenticatedDashboardDotapiKeysRoute,
232
+ AuthenticatedDashboardDotconnectionsRoute:
233
+ AuthenticatedDashboardDotconnectionsRoute,
211
234
  }
212
235
 
213
236
  const AuthenticatedDashboardRouteWithChildren =