@marktiderman/genesis-cli 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/README.md +156 -1
  2. package/dist/cli.js +2769 -567
  3. package/dist/cli.js.map +1 -1
  4. package/dist/{config-CUdwT-nY.d.ts → config-CrZbM3jD.d.ts} +45 -2
  5. package/dist/doctor.d.ts +2 -2
  6. package/dist/doctor.js +133 -5
  7. package/dist/doctor.js.map +1 -1
  8. package/dist/expo.d.ts +91 -8
  9. package/dist/expo.js +207 -14
  10. package/dist/expo.js.map +1 -1
  11. package/dist/genesis-catalog.json +502 -0
  12. package/dist/index.d.ts +1 -1
  13. package/dist/index.js +140 -9
  14. package/dist/index.js.map +1 -1
  15. package/dist/scaffolder.d.ts +1 -1
  16. package/dist/scaffolder.js +7 -4
  17. package/dist/scaffolder.js.map +1 -1
  18. package/dist/starter/.eas/scripts/rollout-health.mjs +85 -0
  19. package/dist/starter/.eas/workflows/deploy-production.yml +149 -0
  20. package/dist/starter/.eas/workflows/e2e.yml +77 -0
  21. package/dist/starter/.eas/workflows/pr-preview.yml +117 -0
  22. package/dist/starter/.eas/workflows/rollout.yml +120 -0
  23. package/dist/starter/.env.example +11 -0
  24. package/dist/starter/.fingerprintignore +7 -0
  25. package/dist/starter/.maestro/README.md +38 -0
  26. package/dist/starter/.maestro/config.yaml +5 -0
  27. package/dist/starter/.maestro/flows/deep-link.yaml +22 -0
  28. package/dist/starter/.maestro/flows/launch.yaml +17 -0
  29. package/dist/starter/.maestro/flows/settings-version.yaml +28 -0
  30. package/dist/starter/.maestro/flows/sign-in-screen.yaml +17 -0
  31. package/dist/starter/.maestro/subflows/sign-in.yaml +20 -0
  32. package/dist/starter/README.md +314 -0
  33. package/dist/starter/__tests__/app-config.test.ts +51 -0
  34. package/dist/starter/__tests__/check-in-photos.test.ts +57 -0
  35. package/dist/starter/__tests__/components/css-stub.js +2 -0
  36. package/dist/starter/__tests__/components/fake-supabase.ts +136 -0
  37. package/dist/starter/__tests__/components/links.test.ts +25 -0
  38. package/dist/starter/__tests__/components/render-app.ts +22 -0
  39. package/dist/starter/__tests__/components/reports.ts +10 -0
  40. package/dist/starter/__tests__/components/resolver.js +12 -0
  41. package/dist/starter/__tests__/components/root-layout.test.tsx +55 -0
  42. package/dist/starter/__tests__/components/session-storage.test.tsx +81 -0
  43. package/dist/starter/__tests__/components/settings.test.tsx +134 -0
  44. package/dist/starter/__tests__/components/setup.ts +69 -0
  45. package/dist/starter/__tests__/components/sign-in.test.tsx +90 -0
  46. package/dist/starter/__tests__/components/tabs-feature-off.test.tsx +19 -0
  47. package/dist/starter/__tests__/components/tabs.test.tsx +43 -0
  48. package/dist/starter/__tests__/components/tabs.ts +12 -0
  49. package/dist/starter/__tests__/entry.test.ts +28 -0
  50. package/dist/starter/__tests__/inline-copy.ts +59 -0
  51. package/dist/starter/__tests__/starter.test.ts +319 -0
  52. package/dist/starter/_gitignore +13 -0
  53. package/dist/starter/app.config.ts +44 -0
  54. package/dist/starter/babel.config.js +9 -0
  55. package/dist/starter/eas.json +47 -0
  56. package/dist/starter/eslint.config.js +5 -0
  57. package/dist/starter/genesis.config.json +12 -0
  58. package/dist/starter/global.css +3 -0
  59. package/dist/starter/index.ts +14 -0
  60. package/dist/starter/jest.config.js +36 -0
  61. package/dist/starter/metro.config.js +38 -0
  62. package/dist/starter/package.json +93 -0
  63. package/dist/starter/pnpm-workspace.yaml +73 -0
  64. package/dist/starter/src/app/(app)/(home)/_layout.tsx +6 -0
  65. package/dist/starter/src/app/(app)/(home)/check-in.tsx +41 -0
  66. package/dist/starter/src/app/(app)/(home)/index.tsx +34 -0
  67. package/dist/starter/src/app/(app)/_layout.tsx +27 -0
  68. package/dist/starter/src/app/(app)/notifications/_layout.tsx +6 -0
  69. package/dist/starter/src/app/(app)/notifications/index.tsx +36 -0
  70. package/dist/starter/src/app/(app)/settings/_layout.tsx +6 -0
  71. package/dist/starter/src/app/(app)/settings/index.tsx +96 -0
  72. package/dist/starter/src/app/(app)/settings/notifications.tsx +16 -0
  73. package/dist/starter/src/app/(app)/settings/support/[id].tsx +23 -0
  74. package/dist/starter/src/app/(app)/settings/support/ideas.tsx +20 -0
  75. package/dist/starter/src/app/(app)/settings/support/index.tsx +20 -0
  76. package/dist/starter/src/app/(app)/settings/support/new.tsx +35 -0
  77. package/dist/starter/src/app/(app)/settings/support/shipped.tsx +20 -0
  78. package/dist/starter/src/app/+native-intent.ts +11 -0
  79. package/dist/starter/src/app/_layout.tsx +20 -0
  80. package/dist/starter/src/app/sign-in.tsx +69 -0
  81. package/dist/starter/src/copy.ts +118 -0
  82. package/dist/starter/src/forms/check-in.json +121 -0
  83. package/dist/starter/src/lib/account.ts +42 -0
  84. package/dist/starter/src/lib/app.ts +52 -0
  85. package/dist/starter/src/lib/auth.ts +80 -0
  86. package/dist/starter/src/lib/check-in-photos.ts +66 -0
  87. package/dist/starter/src/lib/check-in.ts +85 -0
  88. package/dist/starter/src/lib/define-starter.ts +148 -0
  89. package/dist/starter/src/lib/devtools-overlay.ts +34 -0
  90. package/dist/starter/src/lib/devtools.ts +23 -0
  91. package/dist/starter/src/lib/env.ts +33 -0
  92. package/dist/starter/src/lib/google-signin.ts +23 -0
  93. package/dist/starter/src/lib/links.ts +40 -0
  94. package/dist/starter/src/lib/native-modules.ts +27 -0
  95. package/dist/starter/src/lib/notifications.ts +15 -0
  96. package/dist/starter/src/lib/observability.ts +45 -0
  97. package/dist/starter/src/lib/push.ts +49 -0
  98. package/dist/starter/src/lib/supabase.ts +65 -0
  99. package/dist/starter/src/lib/support.ts +44 -0
  100. package/dist/starter/src/lib/updates.ts +61 -0
  101. package/dist/starter/starter.config.ts +37 -0
  102. package/dist/starter/supabase/config.toml +26 -0
  103. package/dist/starter/supabase/functions/genesis-apple-revoke/apple.ts +237 -0
  104. package/dist/starter/supabase/functions/genesis-apple-revoke/handler.ts +227 -0
  105. package/dist/starter/supabase/functions/genesis-apple-revoke/index.ts +55 -0
  106. package/dist/starter/supabase/functions/genesis-push-send/expo.ts +117 -0
  107. package/dist/starter/supabase/functions/genesis-push-send/handler.ts +462 -0
  108. package/dist/starter/supabase/functions/genesis-push-send/index.ts +54 -0
  109. package/dist/starter/supabase/migrations/20261024000000_genesis_account_deletion.sql +133 -0
  110. package/dist/starter/supabase/migrations/20261024000100_genesis_app_release_policy.sql +82 -0
  111. package/dist/starter/supabase/migrations/20261024000200_genesis_apple_token_revocation.sql +205 -0
  112. package/dist/starter/supabase/migrations/20261024000400_genesis_push.sql +524 -0
  113. package/dist/starter/supabase/migrations/20261024000600_genesis_support.sql +846 -0
  114. package/dist/starter/supabase/tests/database/genesis_account_deletion.test.sql +138 -0
  115. package/dist/starter/supabase/tests/database/genesis_app_release_policy.test.sql +148 -0
  116. package/dist/starter/supabase/tests/database/genesis_apple_token_revocation.test.sql +230 -0
  117. package/dist/starter/supabase/tests/database/genesis_push.test.sql +407 -0
  118. package/dist/starter/supabase/tests/database/genesis_support.test.sql +552 -0
  119. package/dist/starter/tailwind.config.mjs +15 -0
  120. package/dist/starter/tsconfig.json +14 -0
  121. package/dist/starter/vitest.config.mts +7 -0
  122. package/dist/templates/ci/app-ci.yml +17 -0
  123. package/dist/templates/ci/genesis-upgrade.yml +21 -0
  124. package/dist/templates/ci/supabase-ci.yml +20 -0
  125. package/dist/templates/eas/eas.json +47 -0
  126. package/dist/templates/eas/scripts/rollout-health.mjs +85 -0
  127. package/dist/templates/eas/workflows/deploy-production.yml +149 -0
  128. package/dist/templates/eas/workflows/e2e.yml +77 -0
  129. package/dist/templates/eas/workflows/pr-preview.yml +117 -0
  130. package/dist/templates/eas/workflows/rollout.yml +120 -0
  131. package/dist/templates/maestro/config.yaml +5 -0
  132. package/dist/templates/maestro/flows/deep-link.yaml +22 -0
  133. package/dist/templates/maestro/flows/launch.yaml +17 -0
  134. package/dist/templates/maestro/flows/settings-version.yaml +28 -0
  135. package/dist/templates/maestro/flows/sign-in-screen.yaml +17 -0
  136. package/dist/templates/maestro/subflows/sign-in.yaml +20 -0
  137. package/dist/vite.js +133 -5
  138. package/dist/vite.js.map +1 -1
  139. package/package.json +4 -4
@@ -37,7 +37,7 @@ interface ScaffoldOptions {
37
37
  genesisVersion?: string;
38
38
  /** When true, even idempotent skips emit a write at `.genesis-next` for diffing. */
39
39
  emitConflicts?: boolean;
40
- /** An Expo app: the Tailwind config adds NativeWind's preset and scans genesis-ui-native. */
40
+ /** An Expo app: the Tailwind config adds NativeWind's preset and scans the Genesis React Native packages. */
41
41
  native?: boolean;
42
42
  /**
43
43
  * Logger. Defaults to a no-op when running in tests; CLI passes
@@ -228,9 +228,12 @@ export const brand: Brand = {
228
228
  }
229
229
  function tailwindConfig(consumer, native) {
230
230
  return `import type { Config } from "tailwindcss";
231
- import { genesisPreset } from "@marktiderman/genesis-design-system/presets/tailwind";${native ? `
232
- // NativeWind v4 needs its preset; Genesis's goes after it.
233
- import nativewindPreset from "nativewind/preset";` : ""}
231
+ ${native ? `// NativeWind v4 needs its preset; Genesis's goes after it. The NativeWind preset also declares
232
+ // the theme variables, which NativeWind can't import from genesis.css. genesisNativewindContent
233
+ // lists the Genesis React Native packages the app uses, wherever they are installed.
234
+ import { fileURLToPath } from "node:url";
235
+ import nativewindPreset from "nativewind/preset";
236
+ import { genesisNativewindContent, genesisNativewindPreset as genesisPreset } from "@marktiderman/genesis-design-system/presets/nativewind";` : `import { genesisPreset } from "@marktiderman/genesis-design-system/presets/tailwind";`}
234
237
  import { brand } from "@${consumer}/brand";
235
238
 
236
239
  /**
@@ -246,7 +249,7 @@ const config: Config = {
246
249
  content: [
247
250
  "./app/**/*.{ts,tsx}",
248
251
  "./components/**/*.{ts,tsx}",
249
- ${native ? ` "./node_modules/@marktiderman/genesis-ui-native/**/*.{js,ts,tsx}",
252
+ ${native ? ` ...genesisNativewindContent({ root: fileURLToPath(new URL(".", import.meta.url)) }),
250
253
  ` : ""} ],
251
254
  presets: [${native ? "nativewindPreset, " : ""}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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AA0CnB;AAEA,SAAS,cAAA,CAAe,UAAkB,MAAA,EAAyB;AACjE,EAAA,OAAO,CAAA;AAAA,qFAAA,EAC8E,MAAA,GAAS;AAAA;AAAA,iDAAA,CAAA,GAE3C,EAAE;AAAA,wBAAA,EAC7B,QAAQ,CAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAehC,MAAA,GAAS,CAAA;AAAA,CAAA,GAA6E,EAAE,CAAA;AAAA,YAAA,EAC5E,MAAA,GAAS,uBAAuB,EAAE,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA,CAAA;AAmBhD;AAEA,SAAS,SAAA,GAAoB;AAC3B,EAAA,OAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAUT;AAEA,SAAS,SAAS,QAAA,EAA0B;AAC1C,EAAA,OAAO,sBAAiB,QAAQ;;AAAA,qEAAA,EAEqC,QAAQ,CAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA,qCAAA,EAOxC,QAAQ,CAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA,aAAA,EAehC,QAAQ,CAAA;AAAA;AAAA;AAAA,CAAA;AAIvB","file":"scaffolder.js","sourcesContent":["/**\n * Genesis init scaffolder — pure-function core.\n *\n * `runScaffolder()` takes a plan (consumer name, target dir, options) +\n * a filesystem implementation, and writes the files needed to bootstrap\n * a new Genesis-based app:\n *\n * - `packages/<consumer>-brand/src/brand.ts` (canonical schema seed)\n * - `packages/<consumer>-brand/package.json`\n * - `tailwind.config.ts` (genesis preset import)\n * - `app/global.css` (genesis tokens import)\n * - `CLAUDE.md` (cross-link + workflow)\n *\n * Idempotent: existing files are NOT overwritten. The scaffolder reads\n * each target path first; if present, it appends a `.genesis-next` sibling\n * with the would-be content + emits a warning so the caller can diff. This\n * keeps the operation safe to re-run after upstream Genesis updates.\n *\n * The CLI wraps this with a real `node:fs` impl + commander argument\n * parsing; the test harness wraps it with an in-memory map for fast,\n * deterministic tests.\n *\n * @stability Beta\n */\n\nexport interface FileSystem {\n exists(path: string): Promise<boolean>;\n readFile(path: string): Promise<string>;\n writeFile(path: string, content: string): Promise<void>;\n mkdirp(dir: string): Promise<void>;\n}\n\nexport interface ScaffoldOptions {\n /** Slug used for `<consumer>-brand` package + tokens namespace. */\n consumerName: string;\n /** Target directory the scaffold writes into. Default `process.cwd()`. */\n targetDir: string;\n /** Pin Genesis package version. Default `\"workspace:^\"` if monorepo, else `\"^1.0.0\"`. */\n genesisVersion?: string;\n /** When true, even idempotent skips emit a write at `.genesis-next` for diffing. */\n emitConflicts?: boolean;\n /** An Expo app: the Tailwind config adds NativeWind's preset and scans genesis-ui-native. */\n native?: boolean;\n /**\n * Logger. Defaults to a no-op when running in tests; CLI passes\n * `console.log` etc.\n */\n logger?: ScaffoldLogger;\n}\n\nexport interface ScaffoldLogger {\n info(msg: string): void;\n warn(msg: string): void;\n error(msg: string): void;\n}\n\nexport interface ScaffoldResult {\n /** Paths the scaffolder wrote. */\n written: string[];\n /** Paths that already existed and were left alone (idempotent skip). */\n skipped: string[];\n /** Paths emitted as `.genesis-next` for consumer to diff. */\n conflicts: string[];\n}\n\nconst VALID_NAME_PATTERN = /^[a-z][a-z0-9-]{1,30}$/;\n\nconst NOOP_LOGGER: ScaffoldLogger = {\n info() {},\n warn() {},\n error() {},\n};\n\n/**\n * Validate a consumer slug. Throws if invalid.\n *\n * Rules: lowercase alphanumeric + hyphens, 2-31 chars, must start with letter.\n * Matches the npm package-name subset that's also a safe directory name.\n */\nexport function validateConsumerName(name: string): void {\n if (!VALID_NAME_PATTERN.test(name)) {\n throw new Error(\n `Invalid consumer name \"${name}\". Must be lowercase letters/digits/hyphens, ` +\n `2-31 chars, starting with a letter (e.g., \"acme\", \"arcade-mobile\").`,\n );\n }\n}\n\n/**\n * Compute which files the scaffolder would write for a given plan.\n * Pure function — no I/O. Tests use this directly.\n */\nexport function planScaffold(\n opts: Pick<ScaffoldOptions, \"consumerName\" | \"genesisVersion\" | \"native\">,\n): { path: string; content: string }[] {\n const consumer = opts.consumerName;\n const genesisVersion = opts.genesisVersion ?? \"workspace:^\";\n return [\n {\n path: `packages/${consumer}-brand/package.json`,\n content: brandPackageJson(consumer, genesisVersion),\n },\n {\n path: `packages/${consumer}-brand/src/brand.ts`,\n content: brandSchema(consumer),\n },\n {\n path: `packages/${consumer}-brand/src/index.ts`,\n content: `export { brand } from \"./brand\";\\nexport type { Brand } from \"./brand\";\\n`,\n },\n {\n path: `packages/${consumer}-brand/tsconfig.json`,\n content: brandTsconfig(),\n },\n {\n path: `tailwind.config.ts`,\n content: tailwindConfig(consumer, opts.native ?? false),\n },\n {\n path: `app/global.css`,\n content: globalCss(),\n },\n {\n path: `CLAUDE.md`,\n content: claudeMd(consumer),\n },\n ];\n}\n\n/**\n * Run the scaffolder against a FileSystem implementation. Returns a\n * record of what it did so the CLI / test harness can summarize.\n */\nexport async function runScaffold(\n opts: ScaffoldOptions,\n fs: FileSystem,\n): Promise<ScaffoldResult> {\n validateConsumerName(opts.consumerName);\n const log = opts.logger ?? NOOP_LOGGER;\n\n const plan = planScaffold(opts);\n\n const written: string[] = [];\n const skipped: string[] = [];\n const conflicts: string[] = [];\n\n for (const file of plan) {\n const fullPath = joinPath(opts.targetDir, file.path);\n const dir = dirname(fullPath);\n await fs.mkdirp(dir);\n\n const exists = await fs.exists(fullPath);\n if (!exists) {\n await fs.writeFile(fullPath, file.content);\n written.push(file.path);\n log.info(`✔ wrote ${file.path}`);\n continue;\n }\n\n // Idempotent skip — file exists. Optionally drop a `.genesis-next`\n // sibling so consumers can diff.\n const existing = await fs.readFile(fullPath);\n if (existing === file.content) {\n skipped.push(file.path);\n log.info(`= skipped ${file.path} (identical)`);\n continue;\n }\n\n if (opts.emitConflicts) {\n const nextPath = `${fullPath}.genesis-next`;\n await fs.writeFile(nextPath, file.content);\n conflicts.push(`${file.path}.genesis-next`);\n log.warn(\n `! diff ${file.path} — wrote .genesis-next sibling for review`,\n );\n } else {\n skipped.push(file.path);\n log.warn(\n `! skipped ${file.path} (exists; pass --emit-conflicts to diff)`,\n );\n }\n }\n\n return { written, skipped, conflicts };\n}\n\n// ---------------------------------------------------------------------------\n// Path helpers — kept inline so the scaffolder has zero non-commander deps\n// ---------------------------------------------------------------------------\n\nfunction joinPath(...parts: string[]): string {\n return parts\n .filter(Boolean)\n .join(\"/\")\n .replace(/\\/+/g, \"/\");\n}\n\nfunction dirname(path: string): string {\n const idx = path.lastIndexOf(\"/\");\n return idx === -1 ? \".\" : path.slice(0, idx);\n}\n\n// ---------------------------------------------------------------------------\n// Templates — readable string builders, NOT freeze-dried .tpl files. This\n// keeps the scaffolder a single .ts file and avoids __dirname juggling\n// when we publish to npm.\n// ---------------------------------------------------------------------------\n\nfunction brandPackageJson(consumer: string, genesisVersion: string): string {\n return JSON.stringify(\n {\n name: `@${consumer}/brand`,\n version: \"0.1.0\",\n private: true,\n type: \"module\",\n main: \"./src/index.ts\",\n types: \"./src/index.ts\",\n description: `Brand tokens + extensions for the ${consumer} app. Consumed by Genesis primitives via canonical schema.`,\n peerDependencies: {\n \"@marktiderman/genesis-design-system\": genesisVersion,\n },\n },\n null,\n 2,\n ) + \"\\n\";\n}\n\nfunction brandTsconfig(): string {\n return JSON.stringify(\n {\n extends: \"../../tsconfig.base.json\",\n compilerOptions: {\n outDir: \"dist\",\n rootDir: \"src\",\n },\n include: [\"src\"],\n },\n null,\n 2,\n ) + \"\\n\";\n}\n\nfunction brandSchema(consumer: string): string {\n return `/**\n * @${consumer}/brand — canonical brand tokens + extensions.\n *\n * Genesis primitives consume tokens from this file via the design-system\n * provider. Edit colors/spacing/typography here to retheme every screen\n * at once. Domain-specific tokens (e.g., \"mood\" for Acme, \"rarity\" for\n * a game app) go under \\`extensions\\` — Genesis primitives don't read these,\n * but consumer composites do via \\`useGenesisExtension(key)\\`.\n *\n * Schema is intentionally narrow at the top level. Add categories under\n * \\`extensions\\` rather than inventing new top-level slots.\n */\n\nexport interface BrandColorScale {\n 50: string;\n 100: string;\n 200: string;\n 300: string;\n 400: string;\n 500: string;\n 600: string;\n 700: string;\n 800: string;\n 900: string;\n}\n\nexport interface BrandColors {\n primary: BrandColorScale;\n destructive: BrandColorScale;\n /** Neutral / gray scale used for surfaces, text, borders. */\n neutral: BrandColorScale;\n}\n\nexport interface Brand {\n /** Slug used for namespacing (e.g., extensions key prefix). */\n name: string;\n colors: BrandColors;\n /**\n * Domain-specific token categories. Consumer composites read these\n * via \\`useGenesisExtension(\"<key>\")\\`. Genesis primitives do NOT read\n * extensions — only canonical \\`colors\\`.\n */\n extensions?: Record<string, Record<string | number, unknown>>;\n}\n\n// ---------------------------------------------------------------------------\n// Default brand — replace these placeholder values with your design's\n// actual hex values. The canonical schema is the only contract; how you\n// reach it is up to you (Figma export, hand-pick, generated from a base).\n// ---------------------------------------------------------------------------\n\nexport const brand: Brand = {\n name: \"${consumer}\",\n colors: {\n primary: {\n 50: \"#eff6ff\",\n 100: \"#dbeafe\",\n 200: \"#bfdbfe\",\n 300: \"#93c5fd\",\n 400: \"#60a5fa\",\n 500: \"#3b82f6\",\n 600: \"#2563eb\",\n 700: \"#1d4ed8\",\n 800: \"#1e40af\",\n 900: \"#1e3a8a\",\n },\n destructive: {\n 50: \"#fef2f2\",\n 100: \"#fee2e2\",\n 200: \"#fecaca\",\n 300: \"#fca5a5\",\n 400: \"#f87171\",\n 500: \"#ef4444\",\n 600: \"#dc2626\",\n 700: \"#b91c1c\",\n 800: \"#991b1b\",\n 900: \"#7f1d1d\",\n },\n neutral: {\n 50: \"#f9fafb\",\n 100: \"#f3f4f6\",\n 200: \"#e5e7eb\",\n 300: \"#d1d5db\",\n 400: \"#9ca3af\",\n 500: \"#6b7280\",\n 600: \"#4b5563\",\n 700: \"#374151\",\n 800: \"#1f2937\",\n 900: \"#111827\",\n },\n },\n // extensions: { mood: { ... }, rarity: { ... } },\n};\n`;\n}\n\nfunction tailwindConfig(consumer: string, native: boolean): string {\n return `import type { Config } from \"tailwindcss\";\nimport { genesisPreset } from \"@marktiderman/genesis-design-system/presets/tailwind\";${native ? `\n// NativeWind v4 needs its preset; Genesis's goes after it.\nimport nativewindPreset from \"nativewind/preset\";` : \"\"}\nimport { brand } from \"@${consumer}/brand\";\n\n/**\n * Tailwind config — wires Genesis canonical tokens to your brand values.\n *\n * Genesis ships a tailwind preset that maps semantic class names\n * (\\`bg-primary\\`, \\`text-foreground\\`, etc.) to CSS variables. This config\n * extends that preset with your consumer's hex values, so Genesis\n * primitives automatically pick up your brand once the global.css import\n * fires.\n */\nconst config: Config = {\n content: [\n \"./app/**/*.{ts,tsx}\",\n \"./components/**/*.{ts,tsx}\",\n${native ? ` \"./node_modules/@marktiderman/genesis-ui-native/**/*.{js,ts,tsx}\",\\n` : \"\"} ],\n presets: [${native ? \"nativewindPreset, \" : \"\"}genesisPreset],\n theme: {\n extend: {\n colors: {\n primary: {\n DEFAULT: brand.colors.primary[600],\n ...brand.colors.primary,\n },\n destructive: {\n DEFAULT: brand.colors.destructive[600],\n ...brand.colors.destructive,\n },\n },\n },\n },\n};\n\nexport default config;\n`;\n}\n\nfunction globalCss(): string {\n return `/**\n * Genesis global stylesheet entry. Imports the Genesis theme (the CSS\n * variables every Genesis primitive's classes read: --background,\n * --foreground, --primary, …) and the consumer's tailwind layers.\n */\n@import \"@marktiderman/genesis-design-system/themes/genesis.css\";\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n`;\n}\n\nfunction claudeMd(consumer: string): string {\n return `# CLAUDE.md — ${consumer}\n\nThis consumer was bootstrapped with \\`@marktiderman/genesis-cli init ${consumer}\\`.\n\n## Workflow\n\n- **Reuse before extend, extend before create.** Before building anything,\n run \\`npx @marktiderman/genesis-cli features find <term>\\` and read\n https://github.com/marktiderman/genesis/blob/main/docs/FRAMEWORK.md\n- **Brand changes live in \\`packages/${consumer}-brand\\`.** Don't fork Genesis\n primitives — edit your brand schema instead (Layer 1).\n- **Layout customization has 4 layers.** Default → named props →\n ScreenContainer → brand schema. Reach for the lowest layer first.\n\n## Critical rules\n\n- \\`genesis doctor\\` enforces the design-system rules. Don't bypass them with\n \\`StyleSheet.create()\\` or raw hex; use brand tokens and theme roles.\n- Run your test script before every commit.\n- Open RFCs in the genesis repo for missing primitives — don't fork\n locally and forget.\n\n## Quick reference\n\n- \\`packages/${consumer}-brand/src/brand.ts\\` — your brand tokens + extensions\n- \\`tailwind.config.ts\\` — Genesis preset + brand color overrides\n- \\`app/global.css\\` — Genesis token sheet + tailwind layers\n`;\n}\n"]}
1
+ {"version":3,"sources":["../src/scaffolder.ts"],"names":[],"mappings":";AAiEA,IAAM,kBAAA,GAAqB,wBAAA;AAE3B,IAAM,WAAA,GAA8B;AAAA,EAClC,IAAA,GAAO;AAAA,EAAC,CAAA;AAAA,EACR,IAAA,GAAO;AAAA,EAAC,CAAA;AAAA,EACR,KAAA,GAAQ;AAAA,EAAC;AACX,CAAA;AAQO,SAAS,qBAAqB,IAAA,EAAoB;AACvD,EAAA,IAAI,CAAC,kBAAA,CAAmB,IAAA,CAAK,IAAI,CAAA,EAAG;AAClC,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,0BAA0B,IAAI,CAAA,gHAAA;AAAA,KAEhC;AAAA,EACF;AACF;AAMO,SAAS,aACd,IAAA,EACqC;AACrC,EAAA,MAAM,WAAW,IAAA,CAAK,YAAA;AACtB,EAAA,MAAM,cAAA,GAAiB,KAAK,cAAA,IAAkB,aAAA;AAC9C,EAAA,OAAO;AAAA,IACL;AAAA,MACE,IAAA,EAAM,YAAY,QAAQ,CAAA,mBAAA,CAAA;AAAA,MAC1B,OAAA,EAAS,gBAAA,CAAiB,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SAAS,QAAA,EAA0B;AAC1C,EAAA,OAAO,sBAAiB,QAAQ;;AAAA,qEAAA,EAEqC,QAAQ,CAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA,qCAAA,EAOxC,QAAQ,CAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA,aAAA,EAehC,QAAQ,CAAA;AAAA;AAAA;AAAA,CAAA;AAIvB","file":"scaffolder.js","sourcesContent":["/**\n * Genesis init scaffolder — pure-function core.\n *\n * `runScaffolder()` takes a plan (consumer name, target dir, options) +\n * a filesystem implementation, and writes the files needed to bootstrap\n * a new Genesis-based app:\n *\n * - `packages/<consumer>-brand/src/brand.ts` (canonical schema seed)\n * - `packages/<consumer>-brand/package.json`\n * - `tailwind.config.ts` (genesis preset import)\n * - `app/global.css` (genesis tokens import)\n * - `CLAUDE.md` (cross-link + workflow)\n *\n * Idempotent: existing files are NOT overwritten. The scaffolder reads\n * each target path first; if present, it appends a `.genesis-next` sibling\n * with the would-be content + emits a warning so the caller can diff. This\n * keeps the operation safe to re-run after upstream Genesis updates.\n *\n * The CLI wraps this with a real `node:fs` impl + commander argument\n * parsing; the test harness wraps it with an in-memory map for fast,\n * deterministic tests.\n *\n * @stability Beta\n */\n\nexport interface FileSystem {\n exists(path: string): Promise<boolean>;\n readFile(path: string): Promise<string>;\n writeFile(path: string, content: string): Promise<void>;\n mkdirp(dir: string): Promise<void>;\n}\n\nexport interface ScaffoldOptions {\n /** Slug used for `<consumer>-brand` package + tokens namespace. */\n consumerName: string;\n /** Target directory the scaffold writes into. Default `process.cwd()`. */\n targetDir: string;\n /** Pin Genesis package version. Default `\"workspace:^\"` if monorepo, else `\"^1.0.0\"`. */\n genesisVersion?: string;\n /** When true, even idempotent skips emit a write at `.genesis-next` for diffing. */\n emitConflicts?: boolean;\n /** An Expo app: the Tailwind config adds NativeWind's preset and scans the Genesis React Native packages. */\n native?: boolean;\n /**\n * Logger. Defaults to a no-op when running in tests; CLI passes\n * `console.log` etc.\n */\n logger?: ScaffoldLogger;\n}\n\nexport interface ScaffoldLogger {\n info(msg: string): void;\n warn(msg: string): void;\n error(msg: string): void;\n}\n\nexport interface ScaffoldResult {\n /** Paths the scaffolder wrote. */\n written: string[];\n /** Paths that already existed and were left alone (idempotent skip). */\n skipped: string[];\n /** Paths emitted as `.genesis-next` for consumer to diff. */\n conflicts: string[];\n}\n\nconst VALID_NAME_PATTERN = /^[a-z][a-z0-9-]{1,30}$/;\n\nconst NOOP_LOGGER: ScaffoldLogger = {\n info() {},\n warn() {},\n error() {},\n};\n\n/**\n * Validate a consumer slug. Throws if invalid.\n *\n * Rules: lowercase alphanumeric + hyphens, 2-31 chars, must start with letter.\n * Matches the npm package-name subset that's also a safe directory name.\n */\nexport function validateConsumerName(name: string): void {\n if (!VALID_NAME_PATTERN.test(name)) {\n throw new Error(\n `Invalid consumer name \"${name}\". Must be lowercase letters/digits/hyphens, ` +\n `2-31 chars, starting with a letter (e.g., \"acme\", \"arcade-mobile\").`,\n );\n }\n}\n\n/**\n * Compute which files the scaffolder would write for a given plan.\n * Pure function — no I/O. Tests use this directly.\n */\nexport function planScaffold(\n opts: Pick<ScaffoldOptions, \"consumerName\" | \"genesisVersion\" | \"native\">,\n): { path: string; content: string }[] {\n const consumer = opts.consumerName;\n const genesisVersion = opts.genesisVersion ?? \"workspace:^\";\n return [\n {\n path: `packages/${consumer}-brand/package.json`,\n content: brandPackageJson(consumer, genesisVersion),\n },\n {\n path: `packages/${consumer}-brand/src/brand.ts`,\n content: brandSchema(consumer),\n },\n {\n path: `packages/${consumer}-brand/src/index.ts`,\n content: `export { brand } from \"./brand\";\\nexport type { Brand } from \"./brand\";\\n`,\n },\n {\n path: `packages/${consumer}-brand/tsconfig.json`,\n content: brandTsconfig(),\n },\n {\n path: `tailwind.config.ts`,\n content: tailwindConfig(consumer, opts.native ?? false),\n },\n {\n path: `app/global.css`,\n content: globalCss(),\n },\n {\n path: `CLAUDE.md`,\n content: claudeMd(consumer),\n },\n ];\n}\n\n/**\n * Run the scaffolder against a FileSystem implementation. Returns a\n * record of what it did so the CLI / test harness can summarize.\n */\nexport async function runScaffold(\n opts: ScaffoldOptions,\n fs: FileSystem,\n): Promise<ScaffoldResult> {\n validateConsumerName(opts.consumerName);\n const log = opts.logger ?? NOOP_LOGGER;\n\n const plan = planScaffold(opts);\n\n const written: string[] = [];\n const skipped: string[] = [];\n const conflicts: string[] = [];\n\n for (const file of plan) {\n const fullPath = joinPath(opts.targetDir, file.path);\n const dir = dirname(fullPath);\n await fs.mkdirp(dir);\n\n const exists = await fs.exists(fullPath);\n if (!exists) {\n await fs.writeFile(fullPath, file.content);\n written.push(file.path);\n log.info(`✔ wrote ${file.path}`);\n continue;\n }\n\n // Idempotent skip — file exists. Optionally drop a `.genesis-next`\n // sibling so consumers can diff.\n const existing = await fs.readFile(fullPath);\n if (existing === file.content) {\n skipped.push(file.path);\n log.info(`= skipped ${file.path} (identical)`);\n continue;\n }\n\n if (opts.emitConflicts) {\n const nextPath = `${fullPath}.genesis-next`;\n await fs.writeFile(nextPath, file.content);\n conflicts.push(`${file.path}.genesis-next`);\n log.warn(\n `! diff ${file.path} — wrote .genesis-next sibling for review`,\n );\n } else {\n skipped.push(file.path);\n log.warn(\n `! skipped ${file.path} (exists; pass --emit-conflicts to diff)`,\n );\n }\n }\n\n return { written, skipped, conflicts };\n}\n\n// ---------------------------------------------------------------------------\n// Path helpers — kept inline so the scaffolder has zero non-commander deps\n// ---------------------------------------------------------------------------\n\nfunction joinPath(...parts: string[]): string {\n return parts\n .filter(Boolean)\n .join(\"/\")\n .replace(/\\/+/g, \"/\");\n}\n\nfunction dirname(path: string): string {\n const idx = path.lastIndexOf(\"/\");\n return idx === -1 ? \".\" : path.slice(0, idx);\n}\n\n// ---------------------------------------------------------------------------\n// Templates — readable string builders, NOT freeze-dried .tpl files. This\n// keeps the scaffolder a single .ts file and avoids __dirname juggling\n// when we publish to npm.\n// ---------------------------------------------------------------------------\n\nfunction brandPackageJson(consumer: string, genesisVersion: string): string {\n return JSON.stringify(\n {\n name: `@${consumer}/brand`,\n version: \"0.1.0\",\n private: true,\n type: \"module\",\n main: \"./src/index.ts\",\n types: \"./src/index.ts\",\n description: `Brand tokens + extensions for the ${consumer} app. Consumed by Genesis primitives via canonical schema.`,\n peerDependencies: {\n \"@marktiderman/genesis-design-system\": genesisVersion,\n },\n },\n null,\n 2,\n ) + \"\\n\";\n}\n\nfunction brandTsconfig(): string {\n return JSON.stringify(\n {\n extends: \"../../tsconfig.base.json\",\n compilerOptions: {\n outDir: \"dist\",\n rootDir: \"src\",\n },\n include: [\"src\"],\n },\n null,\n 2,\n ) + \"\\n\";\n}\n\nfunction brandSchema(consumer: string): string {\n return `/**\n * @${consumer}/brand — canonical brand tokens + extensions.\n *\n * Genesis primitives consume tokens from this file via the design-system\n * provider. Edit colors/spacing/typography here to retheme every screen\n * at once. Domain-specific tokens (e.g., \"mood\" for Acme, \"rarity\" for\n * a game app) go under \\`extensions\\` — Genesis primitives don't read these,\n * but consumer composites do via \\`useGenesisExtension(key)\\`.\n *\n * Schema is intentionally narrow at the top level. Add categories under\n * \\`extensions\\` rather than inventing new top-level slots.\n */\n\nexport interface BrandColorScale {\n 50: string;\n 100: string;\n 200: string;\n 300: string;\n 400: string;\n 500: string;\n 600: string;\n 700: string;\n 800: string;\n 900: string;\n}\n\nexport interface BrandColors {\n primary: BrandColorScale;\n destructive: BrandColorScale;\n /** Neutral / gray scale used for surfaces, text, borders. */\n neutral: BrandColorScale;\n}\n\nexport interface Brand {\n /** Slug used for namespacing (e.g., extensions key prefix). */\n name: string;\n colors: BrandColors;\n /**\n * Domain-specific token categories. Consumer composites read these\n * via \\`useGenesisExtension(\"<key>\")\\`. Genesis primitives do NOT read\n * extensions — only canonical \\`colors\\`.\n */\n extensions?: Record<string, Record<string | number, unknown>>;\n}\n\n// ---------------------------------------------------------------------------\n// Default brand — replace these placeholder values with your design's\n// actual hex values. The canonical schema is the only contract; how you\n// reach it is up to you (Figma export, hand-pick, generated from a base).\n// ---------------------------------------------------------------------------\n\nexport const brand: Brand = {\n name: \"${consumer}\",\n colors: {\n primary: {\n 50: \"#eff6ff\",\n 100: \"#dbeafe\",\n 200: \"#bfdbfe\",\n 300: \"#93c5fd\",\n 400: \"#60a5fa\",\n 500: \"#3b82f6\",\n 600: \"#2563eb\",\n 700: \"#1d4ed8\",\n 800: \"#1e40af\",\n 900: \"#1e3a8a\",\n },\n destructive: {\n 50: \"#fef2f2\",\n 100: \"#fee2e2\",\n 200: \"#fecaca\",\n 300: \"#fca5a5\",\n 400: \"#f87171\",\n 500: \"#ef4444\",\n 600: \"#dc2626\",\n 700: \"#b91c1c\",\n 800: \"#991b1b\",\n 900: \"#7f1d1d\",\n },\n neutral: {\n 50: \"#f9fafb\",\n 100: \"#f3f4f6\",\n 200: \"#e5e7eb\",\n 300: \"#d1d5db\",\n 400: \"#9ca3af\",\n 500: \"#6b7280\",\n 600: \"#4b5563\",\n 700: \"#374151\",\n 800: \"#1f2937\",\n 900: \"#111827\",\n },\n },\n // extensions: { mood: { ... }, rarity: { ... } },\n};\n`;\n}\n\nfunction tailwindConfig(consumer: string, native: boolean): string {\n return `import type { Config } from \"tailwindcss\";\n${native ? `// NativeWind v4 needs its preset; Genesis's goes after it. The NativeWind preset also declares\n// the theme variables, which NativeWind can't import from genesis.css. genesisNativewindContent\n// lists the Genesis React Native packages the app uses, wherever they are installed.\nimport { fileURLToPath } from \"node:url\";\nimport nativewindPreset from \"nativewind/preset\";\nimport { genesisNativewindContent, genesisNativewindPreset as genesisPreset } from \"@marktiderman/genesis-design-system/presets/nativewind\";` : `import { genesisPreset } from \"@marktiderman/genesis-design-system/presets/tailwind\";`}\nimport { brand } from \"@${consumer}/brand\";\n\n/**\n * Tailwind config — wires Genesis canonical tokens to your brand values.\n *\n * Genesis ships a tailwind preset that maps semantic class names\n * (\\`bg-primary\\`, \\`text-foreground\\`, etc.) to CSS variables. This config\n * extends that preset with your consumer's hex values, so Genesis\n * primitives automatically pick up your brand once the global.css import\n * fires.\n */\nconst config: Config = {\n content: [\n \"./app/**/*.{ts,tsx}\",\n \"./components/**/*.{ts,tsx}\",\n${native ? ` ...genesisNativewindContent({ root: fileURLToPath(new URL(\".\", import.meta.url)) }),\\n` : \"\"} ],\n presets: [${native ? \"nativewindPreset, \" : \"\"}genesisPreset],\n theme: {\n extend: {\n colors: {\n primary: {\n DEFAULT: brand.colors.primary[600],\n ...brand.colors.primary,\n },\n destructive: {\n DEFAULT: brand.colors.destructive[600],\n ...brand.colors.destructive,\n },\n },\n },\n },\n};\n\nexport default config;\n`;\n}\n\nfunction globalCss(): string {\n return `/**\n * Genesis global stylesheet entry. Imports the Genesis theme (the CSS\n * variables every Genesis primitive's classes read: --background,\n * --foreground, --primary, …) and the consumer's tailwind layers.\n */\n@import \"@marktiderman/genesis-design-system/themes/genesis.css\";\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n`;\n}\n\nfunction claudeMd(consumer: string): string {\n return `# CLAUDE.md — ${consumer}\n\nThis consumer was bootstrapped with \\`@marktiderman/genesis-cli init ${consumer}\\`.\n\n## Workflow\n\n- **Reuse before extend, extend before create.** Before building anything,\n run \\`npx @marktiderman/genesis-cli features find <term>\\` and read\n https://github.com/marktiderman/genesis/blob/main/docs/FRAMEWORK.md\n- **Brand changes live in \\`packages/${consumer}-brand\\`.** Don't fork Genesis\n primitives — edit your brand schema instead (Layer 1).\n- **Layout customization has 4 layers.** Default → named props →\n ScreenContainer → brand schema. Reach for the lowest layer first.\n\n## Critical rules\n\n- \\`genesis doctor\\` enforces the design-system rules. Don't bypass them with\n \\`StyleSheet.create()\\` or raw hex; use brand tokens and theme roles.\n- Run your test script before every commit.\n- Open RFCs in the genesis repo for missing primitives — don't fork\n locally and forget.\n\n## Quick reference\n\n- \\`packages/${consumer}-brand/src/brand.ts\\` — your brand tokens + extensions\n- \\`tailwind.config.ts\\` — Genesis preset + brand color overrides\n- \\`app/global.css\\` — Genesis token sheet + tailwind layers\n`;\n}\n"]}
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * The health check rollout.yml runs before promoting a staged update.
4
+ *
5
+ * eas update:insights <group> --json > insights.json
6
+ * MAX_FAILED_LAUNCH_PERCENT=1 MIN_LAUNCHES=200 node .eas/scripts/rollout-health.mjs insights.json
7
+ *
8
+ * It exits 1, saying why, when the insights have no platform, when a platform counted fewer than
9
+ * MIN_LAUNCHES launches (too early to tell), or when more than MAX_FAILED_LAUNCH_PERCENT of a
10
+ * platform's launches failed. A threshold that isn't a number is an error, never a pass.
11
+ *
12
+ * "Failed launches" are what EAS counts: expo-updates couldn't start the update and fell back.
13
+ * A platform's launches are `installs + failedInstalls`, the denominator eas-cli's own crash rate
14
+ * uses (update/insights/formatInsights.js in eas-cli 25.3.0).
15
+ * Crash-free sessions are not in EAS's insights; read them in your crash reporter.
16
+ *
17
+ * Genesis template (templates/eas/scripts/rollout-health.mjs).
18
+ */
19
+ import { readFileSync } from "node:fs";
20
+ import { pathToFileURL } from "node:url";
21
+
22
+ /**
23
+ * @param {unknown} insights `eas update:insights --json` output.
24
+ * @param {{ maxFailedLaunchPercent: number; minLaunches: number }} limits
25
+ * @returns {{ ok: boolean; lines: string[] }}
26
+ */
27
+ export function checkRollout(insights, { maxFailedLaunchPercent, minLaunches }) {
28
+ if (!Number.isFinite(maxFailedLaunchPercent) || maxFailedLaunchPercent < 0 || maxFailedLaunchPercent > 100) {
29
+ return { ok: false, lines: [`MAX_FAILED_LAUNCH_PERCENT must be a number from 0 to 100, got ${maxFailedLaunchPercent}.`] };
30
+ }
31
+ if (!Number.isInteger(minLaunches) || minLaunches < 1) {
32
+ return { ok: false, lines: [`MIN_LAUNCHES must be a whole number above 0, got ${minLaunches}.`] };
33
+ }
34
+ const platforms = Array.isArray(insights?.platforms) ? insights.platforms : [];
35
+ if (platforms.length === 0) {
36
+ return { ok: false, lines: ["The insights list no platform: is the update group id right?"] };
37
+ }
38
+ let ok = true;
39
+ const lines = [];
40
+ for (const entry of platforms) {
41
+ const name = typeof entry?.platform === "string" ? entry.platform : "unknown platform";
42
+ const installs = Number(entry?.totals?.installs);
43
+ const failed = Number(entry?.totals?.failedInstalls);
44
+ if (!Number.isFinite(installs) || !Number.isFinite(failed)) {
45
+ ok = false;
46
+ lines.push(`${name}: the insights have no launch counts.`);
47
+ continue;
48
+ }
49
+ const launches = installs + failed;
50
+ const percent = launches === 0 ? 0 : (failed / launches) * 100;
51
+ const summary = `${name}: ${failed} of ${launches} launches failed (${percent.toFixed(2)}%)`;
52
+ if (launches < minLaunches) {
53
+ ok = false;
54
+ lines.push(`${summary}; fewer than ${minLaunches} launches, too early to promote.`);
55
+ } else if (percent > maxFailedLaunchPercent) {
56
+ ok = false;
57
+ lines.push(`${summary}; more than ${maxFailedLaunchPercent}%, don't promote (roll back instead?).`);
58
+ } else {
59
+ lines.push(`${summary}; within ${maxFailedLaunchPercent}%.`);
60
+ }
61
+ }
62
+ return { ok, lines };
63
+ }
64
+
65
+ /** Unset gives the default; an empty or non-numeric value gives NaN, which `checkRollout` refuses. */
66
+ function numberFrom(value, fallback) {
67
+ if (value === undefined) return fallback;
68
+ return value.trim() === "" ? Number.NaN : Number(value);
69
+ }
70
+
71
+ function main() {
72
+ const file = process.argv[2];
73
+ if (!file) {
74
+ console.error("Usage: node rollout-health.mjs <insights.json>");
75
+ process.exit(1);
76
+ }
77
+ const { ok, lines } = checkRollout(JSON.parse(readFileSync(file, "utf8")), {
78
+ maxFailedLaunchPercent: numberFrom(process.env.MAX_FAILED_LAUNCH_PERCENT, 1),
79
+ minLaunches: numberFrom(process.env.MIN_LAUNCHES, 200),
80
+ });
81
+ for (const line of lines) (ok ? console.log : console.error)(line);
82
+ if (!ok) process.exit(1);
83
+ }
84
+
85
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) main();
@@ -0,0 +1,149 @@
1
+ # Deploy to production, started by pushing a release tag (`git tag v1.4.0 && git push origin v1.4.0`).
2
+ # A release that changes native code is a new store version: bump `version` in app.config.ts in
3
+ # the same change. The version isn't part of the fingerprint, so a bump on its own starts no
4
+ # build, and a native change without one uploads the old version string again.
5
+ #
6
+ # 1. Fingerprint the native project as the production variant builds it.
7
+ # 2. Per platform, look for a production build with that fingerprint.
8
+ # - None (native code changed): build one. The store submission waits for a person to approve
9
+ # it in the run's page on expo.dev.
10
+ # - One exists (JavaScript only): publish an over-the-air update to the `production` channel,
11
+ # also after that approval, to 10% of installs. rollout.yml raises it or rolls it back.
12
+ #
13
+ # Safety:
14
+ # - A tag push is the only trigger, so a run always builds a commit in git, never a local folder.
15
+ # Don't add `workflow_dispatch` without `--ref` discipline: `eas workflow:run` without `--ref`
16
+ # uploads the working directory as it is on that machine.
17
+ # - Nothing is submitted or published before the `approve_release` job is approved, and it isn't
18
+ # offered when a build failed, so one approval never ships half a release. Check that the tag's
19
+ # commit is on main before approving.
20
+ # - Builds go to TestFlight and to the Play internal track as a draft (eas.json `submit`);
21
+ # releasing to the stores stays a person's step in App Store Connect and Play Console.
22
+ # - EAS refuses to start a second rollout on the same channel, platform and runtime while one is
23
+ # in progress, so a new update can't silently replace a staged one (finish it with rollout.yml).
24
+ # - Each platform's update is its own update group; promote or roll back each with rollout.yml.
25
+ # - A production build whose approval was rejected (or whose submit failed) still matches its
26
+ # fingerprint: a later JavaScript-only tag sends an update to a binary nobody has. Submit that
27
+ # build by hand first (`eas submit --platform ios --id <build id> --profile production`).
28
+ #
29
+ # Genesis template (templates/eas/workflows/deploy-production.yml). Edit the copy in your app; see
30
+ # docs/NATIVE-RELEASE.md in the Genesis repository.
31
+ name: Deploy production
32
+
33
+ on:
34
+ push:
35
+ tags: ["v*.*.*"]
36
+
37
+ jobs:
38
+ fingerprint:
39
+ name: Fingerprint
40
+ type: fingerprint
41
+ environment: production
42
+ env:
43
+ APP_VARIANT: production
44
+ EXPO_PUBLIC_APP_VARIANT: production
45
+
46
+ get_ios_build:
47
+ name: Find a production iOS build with this fingerprint
48
+ needs: [fingerprint]
49
+ type: get-build
50
+ params:
51
+ platform: ios
52
+ profile: production
53
+ fingerprint_hash: ${{ needs.fingerprint.outputs.ios_fingerprint_hash }}
54
+ wait_for_in_progress: true
55
+
56
+ get_android_build:
57
+ name: Find a production Android build with this fingerprint
58
+ needs: [fingerprint]
59
+ type: get-build
60
+ params:
61
+ platform: android
62
+ profile: production
63
+ fingerprint_hash: ${{ needs.fingerprint.outputs.android_fingerprint_hash }}
64
+ wait_for_in_progress: true
65
+
66
+ build_ios:
67
+ name: Build iOS (native code changed)
68
+ needs: [get_ios_build]
69
+ if: ${{ !needs.get_ios_build.outputs.build_id }}
70
+ type: build
71
+ environment: production
72
+ params:
73
+ platform: ios
74
+ profile: production
75
+
76
+ build_android:
77
+ name: Build Android (native code changed)
78
+ needs: [get_android_build]
79
+ if: ${{ !needs.get_android_build.outputs.build_id }}
80
+ type: build
81
+ environment: production
82
+ params:
83
+ platform: android
84
+ profile: production
85
+
86
+ approve_release:
87
+ name: Approve submitting the builds and publishing the updates
88
+ # Both lookups must have succeeded (needs) and neither build failed (after): a failure on one
89
+ # platform never leaves the other to ship alone.
90
+ needs: [get_ios_build, get_android_build]
91
+ after: [build_ios, build_android]
92
+ if: ${{ after.build_ios.status != 'failure' && after.build_android.status != 'failure' }}
93
+ type: require-approval
94
+
95
+ submit_ios:
96
+ name: Submit iOS to TestFlight
97
+ needs: [build_ios, approve_release]
98
+ if: ${{ needs.build_ios.outputs.build_id }}
99
+ type: submit
100
+ environment: production
101
+ params:
102
+ build_id: ${{ needs.build_ios.outputs.build_id }}
103
+ profile: production
104
+
105
+ submit_android:
106
+ name: Submit Android to the internal track (draft)
107
+ needs: [build_android, approve_release]
108
+ if: ${{ needs.build_android.outputs.build_id }}
109
+ type: submit
110
+ environment: production
111
+ params:
112
+ build_id: ${{ needs.build_android.outputs.build_id }}
113
+ profile: production
114
+
115
+ update_ios:
116
+ name: Update iOS (10% of production installs)
117
+ needs: [get_ios_build, approve_release]
118
+ if: ${{ needs.get_ios_build.outputs.build_id }}
119
+ type: update
120
+ environment: production
121
+ env:
122
+ APP_VARIANT: production
123
+ EXPO_PUBLIC_APP_VARIANT: production
124
+ params:
125
+ channel: production
126
+ platform: ios
127
+ rollout_percentage: 10
128
+ # Explicit: unset, EAS tries a Sentry source map upload whenever @sentry/react-native is
129
+ # installed and only logs a failure. Set true once the Sentry plugin is on in app.config.ts
130
+ # (with SENTRY_AUTH_TOKEN), so a failed upload fails the job.
131
+ upload_sentry_sourcemaps: false
132
+
133
+ update_android:
134
+ name: Update Android (10% of production installs)
135
+ needs: [get_android_build, approve_release]
136
+ if: ${{ needs.get_android_build.outputs.build_id }}
137
+ type: update
138
+ environment: production
139
+ env:
140
+ APP_VARIANT: production
141
+ EXPO_PUBLIC_APP_VARIANT: production
142
+ params:
143
+ channel: production
144
+ platform: android
145
+ rollout_percentage: 10
146
+ # Explicit: unset, EAS tries a Sentry source map upload whenever @sentry/react-native is
147
+ # installed and only logs a failure. Set true once the Sentry plugin is on in app.config.ts
148
+ # (with SENTRY_AUTH_TOKEN), so a failed upload fails the job.
149
+ upload_sentry_sourcemaps: false
@@ -0,0 +1,77 @@
1
+ # E2E: the Maestro smoke flows in .maestro/flows on an iOS simulator build.
2
+ #
3
+ # 1. Fingerprint the native project as the development variant builds it (the flows name the
4
+ # development bundle id).
5
+ # 2. An `e2e` simulator build with that fingerprint exists: repack it with this commit's
6
+ # JavaScript. None exists: build one.
7
+ # 3. Run every flow in .maestro/flows on it.
8
+ #
9
+ # The `account` flows sign in, so they are left out (`exclude_tags: account`) until the
10
+ # development EAS environment has MAESTRO_TEST_EMAIL and MAESTRO_TEST_PASSWORD (a test account on
11
+ # the development Supabase project) as secret variables; then delete that line. Maestro reads
12
+ # MAESTRO_* variables from the environment. This runs the pull request's code with that
13
+ # environment's variables: keep nothing there that production depends on.
14
+ #
15
+ # Genesis template (templates/eas/workflows/e2e.yml). Edit the copy in your app; see
16
+ # docs/NATIVE-RELEASE.md in the Genesis repository.
17
+ name: E2E
18
+
19
+ on:
20
+ pull_request:
21
+ types: [opened, reopened, synchronize]
22
+ workflow_dispatch: {}
23
+
24
+ jobs:
25
+ fingerprint:
26
+ name: Fingerprint
27
+ type: fingerprint
28
+ environment: development
29
+ env:
30
+ APP_VARIANT: development
31
+ EXPO_PUBLIC_APP_VARIANT: development
32
+
33
+ get_ios_build:
34
+ name: Find an iOS simulator build with this fingerprint
35
+ needs: [fingerprint]
36
+ type: get-build
37
+ params:
38
+ platform: ios
39
+ profile: e2e
40
+ simulator: true
41
+ fingerprint_hash: ${{ needs.fingerprint.outputs.ios_fingerprint_hash }}
42
+ wait_for_in_progress: true
43
+
44
+ repack_ios:
45
+ name: Repack the simulator build with this JavaScript
46
+ needs: [get_ios_build]
47
+ if: ${{ needs.get_ios_build.outputs.build_id }}
48
+ type: repack
49
+ environment: development
50
+ env:
51
+ APP_VARIANT: development
52
+ EXPO_PUBLIC_APP_VARIANT: development
53
+ params:
54
+ build_id: ${{ needs.get_ios_build.outputs.build_id }}
55
+ profile: e2e
56
+
57
+ build_ios:
58
+ name: Build for the iOS simulator (native code changed)
59
+ needs: [get_ios_build]
60
+ if: ${{ !needs.get_ios_build.outputs.build_id }}
61
+ type: build
62
+ environment: development
63
+ params:
64
+ platform: ios
65
+ profile: e2e
66
+
67
+ maestro_ios:
68
+ name: Maestro smoke flows
69
+ after: [repack_ios, build_ios]
70
+ if: ${{ after.repack_ios.outputs.build_id || after.build_ios.outputs.build_id }}
71
+ type: maestro
72
+ environment: development
73
+ params:
74
+ build_id: ${{ after.repack_ios.outputs.build_id || after.build_ios.outputs.build_id }}
75
+ flow_path: [".maestro/flows"]
76
+ exclude_tags: account
77
+ retries: 1
@@ -0,0 +1,117 @@
1
+ # PR preview: an installable build of each pull request, and an update on its own channel.
2
+ #
3
+ # 1. Fingerprint the native project as the preview variant builds it.
4
+ # 2. A preview build with that fingerprint exists: repack it with this pull request's JavaScript
5
+ # (no native compile). None exists (the pull request changed native code): build one.
6
+ # 3. Publish the pull request's JavaScript as an update to the channel `pr-<number>`.
7
+ # 4. Comment on the pull request: the build's install link and QR code, and the update.
8
+ #
9
+ # Nothing here can reach production: the preview profile and EAS environment, internal
10
+ # distribution, a pr-<number> channel, and no submit job. It does build the pull request's code
11
+ # with the preview environment's variables, so keep nothing there that production depends on.
12
+ # EAS doesn't run pull_request workflows for pull requests from forks.
13
+ #
14
+ # Genesis template (templates/eas/workflows/pr-preview.yml). Edit the copy in your app; see
15
+ # docs/NATIVE-RELEASE.md in the Genesis repository.
16
+ name: PR preview
17
+
18
+ on:
19
+ pull_request:
20
+ types: [opened, reopened, synchronize]
21
+
22
+ jobs:
23
+ fingerprint:
24
+ name: Fingerprint
25
+ type: fingerprint
26
+ environment: preview
27
+ env:
28
+ APP_VARIANT: preview
29
+ EXPO_PUBLIC_APP_VARIANT: preview
30
+
31
+ get_ios_build:
32
+ name: Find a preview iOS build with this fingerprint
33
+ needs: [fingerprint]
34
+ type: get-build
35
+ params:
36
+ platform: ios
37
+ profile: preview
38
+ fingerprint_hash: ${{ needs.fingerprint.outputs.ios_fingerprint_hash }}
39
+ wait_for_in_progress: true
40
+
41
+ get_android_build:
42
+ name: Find a preview Android build with this fingerprint
43
+ needs: [fingerprint]
44
+ type: get-build
45
+ params:
46
+ platform: android
47
+ profile: preview
48
+ fingerprint_hash: ${{ needs.fingerprint.outputs.android_fingerprint_hash }}
49
+ wait_for_in_progress: true
50
+
51
+ repack_ios:
52
+ name: Repack iOS with this JavaScript
53
+ needs: [get_ios_build]
54
+ if: ${{ needs.get_ios_build.outputs.build_id }}
55
+ type: repack
56
+ environment: preview
57
+ env:
58
+ APP_VARIANT: preview
59
+ EXPO_PUBLIC_APP_VARIANT: preview
60
+ params:
61
+ build_id: ${{ needs.get_ios_build.outputs.build_id }}
62
+ profile: preview
63
+
64
+ repack_android:
65
+ name: Repack Android with this JavaScript
66
+ needs: [get_android_build]
67
+ if: ${{ needs.get_android_build.outputs.build_id }}
68
+ type: repack
69
+ environment: preview
70
+ env:
71
+ APP_VARIANT: preview
72
+ EXPO_PUBLIC_APP_VARIANT: preview
73
+ params:
74
+ build_id: ${{ needs.get_android_build.outputs.build_id }}
75
+ profile: preview
76
+
77
+ build_ios:
78
+ name: Build iOS (native code changed)
79
+ needs: [get_ios_build]
80
+ if: ${{ !needs.get_ios_build.outputs.build_id }}
81
+ type: build
82
+ environment: preview
83
+ params:
84
+ platform: ios
85
+ profile: preview
86
+
87
+ build_android:
88
+ name: Build Android (native code changed)
89
+ needs: [get_android_build]
90
+ if: ${{ !needs.get_android_build.outputs.build_id }}
91
+ type: build
92
+ environment: preview
93
+ params:
94
+ platform: android
95
+ profile: preview
96
+
97
+ publish_update:
98
+ name: Publish to channel pr-<number>
99
+ needs: [fingerprint]
100
+ type: update
101
+ environment: preview
102
+ env:
103
+ APP_VARIANT: preview
104
+ EXPO_PUBLIC_APP_VARIANT: preview
105
+ params:
106
+ channel: pr-${{ github.event.pull_request.number }}
107
+ # Explicit: unset, EAS tries a Sentry source map upload whenever @sentry/react-native is
108
+ # installed and only logs a failure. Set true once the Sentry plugin is on in app.config.ts
109
+ # (with SENTRY_AUTH_TOKEN), so a failed upload fails the job.
110
+ upload_sentry_sourcemaps: false
111
+
112
+ comment:
113
+ name: Comment on the pull request
114
+ after: [repack_ios, repack_android, build_ios, build_android, publish_update]
115
+ type: github-comment
116
+ params:
117
+ message: "Preview of this pull request: install a build from its link or QR code. A preview build already installed can switch to the channel pr-${{ github.event.pull_request.number }} instead."