create-expo-updates-server 0.4.0 → 0.6.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 (175) hide show
  1. package/README.md +4 -2
  2. package/dist/template/Dockerfile +4 -6
  3. package/dist/template/README.md +4 -9
  4. package/dist/template/app/api/admin/device-favorites/route.test.ts +125 -0
  5. package/dist/template/app/api/admin/device-favorites/route.ts +91 -0
  6. package/dist/template/app/api/admin/distribution-history/restore/route.ts +39 -0
  7. package/dist/template/app/api/admin/distribution-history/route.test.ts +55 -0
  8. package/dist/template/app/api/admin/distribution-history/route.ts +24 -0
  9. package/dist/template/app/api/admin/updates/[encodedKey]/deactivate/route.ts +2 -1
  10. package/dist/template/app/api/admin/updates/[encodedKey]/promote/route.ts +2 -1
  11. package/dist/template/app/api/admin/updates/[encodedKey]/rollback/route.ts +2 -1
  12. package/dist/template/app/api/admin/updates/[encodedKey]/route.ts +2 -1
  13. package/dist/template/app/api/admin/updates/route.test.ts +21 -0
  14. package/dist/template/app/api/admin/updates/route.ts +12 -1
  15. package/dist/template/app/globals.css +65 -68
  16. package/dist/template/app/login/page.tsx +66 -42
  17. package/dist/template/app/updates/[encodedKey]/page.tsx +375 -263
  18. package/dist/template/app/updates/devices/page.tsx +188 -152
  19. package/dist/template/app/updates/embedded/page.tsx +63 -29
  20. package/dist/template/app/updates/emergency-redirects/page.tsx +93 -58
  21. package/dist/template/app/updates/layout.tsx +2 -1
  22. package/dist/template/app/updates/page.tsx +381 -283
  23. package/dist/template/app/updates/releases.test.tsx +156 -0
  24. package/dist/template/components/admin/admin-role.ts +5 -0
  25. package/dist/template/components/admin/admin-shell.tsx +166 -101
  26. package/dist/template/components/admin/confirm-action.tsx +123 -0
  27. package/dist/template/components/admin/language-switcher.tsx +25 -17
  28. package/dist/template/components/admin/release-badges.test.tsx +50 -0
  29. package/dist/template/components/admin/release-badges.tsx +101 -0
  30. package/dist/template/components/ui/alert.tsx +10 -3
  31. package/dist/template/components/ui/avatar.tsx +108 -0
  32. package/dist/template/components/ui/badge.tsx +2 -2
  33. package/dist/template/components/ui/breadcrumb.tsx +108 -0
  34. package/dist/template/components/ui/button.tsx +5 -5
  35. package/dist/template/components/ui/card.tsx +2 -2
  36. package/dist/template/components/ui/chart.tsx +1 -1
  37. package/dist/template/components/ui/collapsible.tsx +7 -0
  38. package/dist/template/components/ui/empty.tsx +103 -0
  39. package/dist/template/components/ui/field.tsx +248 -0
  40. package/dist/template/components/ui/input-group.tsx +170 -0
  41. package/dist/template/components/ui/input.tsx +1 -1
  42. package/dist/template/components/ui/native-select.tsx +1 -1
  43. package/dist/template/components/ui/radio-group.tsx +41 -0
  44. package/dist/template/components/ui/status-tones.ts +15 -0
  45. package/dist/template/components/ui/table.tsx +1 -1
  46. package/dist/template/components/ui/textarea.tsx +1 -1
  47. package/dist/template/docs/admin-ui.md +7 -3
  48. package/dist/template/docs/device-targeting.md +2 -7
  49. package/dist/template/docs/doctor.md +2 -2
  50. package/dist/template/docs/expo-app-setup.md +9 -27
  51. package/dist/template/docs/getting-started.md +3 -4
  52. package/dist/template/docs/installation-telemetry.md +2 -8
  53. package/dist/template/docs/migrations/2026-10-16-manifest-identity.sql +5 -0
  54. package/dist/template/docs/migrations/2026-11-25-device-favorites.sql +53 -0
  55. package/dist/template/docs/migrations/2026-11-25-download-on-postpone.sql +5 -0
  56. package/dist/template/docs/migrations/2026-11-25-public-distribution-history.sql +283 -0
  57. package/dist/template/docs/migrations/schema.sql +349 -0
  58. package/dist/template/docs/npm-installer.md +3 -3
  59. package/dist/template/docs/operations-guide.md +8 -6
  60. package/dist/template/docs/ota-client-lifecycle.md +30 -68
  61. package/dist/template/docs/ota-update-policy.md +9 -20
  62. package/dist/template/docs/ru/admin-ui.md +7 -3
  63. package/dist/template/docs/ru/device-targeting.md +2 -2
  64. package/dist/template/docs/ru/doctor.md +2 -2
  65. package/dist/template/docs/ru/expo-app-setup.md +9 -9
  66. package/dist/template/docs/ru/getting-started.md +3 -3
  67. package/dist/template/docs/ru/installation-telemetry.md +2 -2
  68. package/dist/template/docs/ru/npm-installer.md +3 -3
  69. package/dist/template/docs/ru/operations-guide.md +8 -3
  70. package/dist/template/docs/ru/ota-client-lifecycle.md +30 -35
  71. package/dist/template/docs/ru/ota-update-policy.md +9 -7
  72. package/dist/template/docs/ru/publishing-npm-installer.md +2 -2
  73. package/dist/template/docs/uk/admin-ui.md +7 -3
  74. package/dist/template/docs/uk/device-targeting.md +2 -2
  75. package/dist/template/docs/uk/doctor.md +2 -2
  76. package/dist/template/docs/uk/expo-app-setup.md +9 -9
  77. package/dist/template/docs/uk/getting-started.md +3 -3
  78. package/dist/template/docs/uk/installation-telemetry.md +2 -2
  79. package/dist/template/docs/uk/npm-installer.md +3 -3
  80. package/dist/template/docs/uk/operations-guide.md +8 -3
  81. package/dist/template/docs/uk/ota-client-lifecycle.md +30 -35
  82. package/dist/template/docs/uk/ota-update-policy.md +9 -7
  83. package/dist/template/docs/uk/publishing-npm-installer.md +2 -2
  84. package/dist/template/lib/audience-ids.ts +4 -0
  85. package/dist/template/package-lock.json +46 -0
  86. package/dist/template/package.json +3 -1
  87. package/dist/template/scripts/configure-expo-app.mjs +3 -3
  88. package/dist/template/scripts/create-access-token.mjs +1 -1
  89. package/dist/template/scripts/lib/doctor.mjs +10 -7
  90. package/dist/template/scripts/lib/doctor.test.mjs +7 -5
  91. package/dist/template/scripts/lib/embedded-update-registrar.test.ts +22 -7
  92. package/dist/template/scripts/lib/expo-app-configurator.mjs +25 -22
  93. package/dist/template/scripts/lib/expo-app-configurator.test.ts +37 -2
  94. package/dist/template/scripts/lib/ota-client-configurator.mjs +152 -55
  95. package/dist/template/scripts/lib/ota-client-configurator.test.ts +60 -20
  96. package/dist/template/scripts/lib/ota-client-package.mjs +25 -0
  97. package/dist/template/scripts/lib/ota-root-hook-patcher.mjs +90 -32
  98. package/dist/template/scripts/lib/ota-root-hook-patcher.test.ts +49 -6
  99. package/dist/template/scripts/tests/device-analytics-migrations.mjs +12 -1
  100. package/dist/template/scripts/tests/device-targeting-activation.mjs +2 -3
  101. package/dist/template/scripts/tests/e2e/client-lifecycle.mjs +161 -0
  102. package/dist/template/scripts/tests/e2e/client-lifecycle.scenario.jsx +465 -0
  103. package/dist/template/scripts/tests/e2e/client-vitest.mts +18 -0
  104. package/dist/template/scripts/tests/e2e/console.mjs +86 -0
  105. package/dist/template/scripts/tests/e2e/delivery.mjs +296 -0
  106. package/dist/template/scripts/tests/e2e/device-favorites.mjs +309 -0
  107. package/dist/template/scripts/tests/e2e/installations.mjs +132 -0
  108. package/dist/template/scripts/tests/e2e/policy.mjs +253 -0
  109. package/dist/template/scripts/tests/e2e/registrar-token.mjs +59 -0
  110. package/dist/template/scripts/tests/e2e/release-matrix.mjs +307 -0
  111. package/dist/template/scripts/tests/e2e/releases.mjs +162 -0
  112. package/dist/template/scripts/tests/e2e/run.mjs +224 -0
  113. package/dist/template/scripts/tests/manifest-identity.sql +7 -5
  114. package/dist/template/scripts/tests/public-distribution-history.mjs +102 -0
  115. package/dist/template/src/client/admin-api.ts +45 -10
  116. package/dist/template/src/client/admin-types.ts +35 -1
  117. package/dist/template/src/client/devices/analytics.tsx +168 -231
  118. package/dist/template/src/client/devices/cohorts.tsx +181 -0
  119. package/dist/template/src/client/devices/device-name.tsx +37 -23
  120. package/dist/template/src/client/devices/favorite-targets.tsx +381 -0
  121. package/dist/template/src/client/devices/registry.tsx +258 -245
  122. package/dist/template/src/client/devices/use-devices-report.test.tsx +98 -0
  123. package/dist/template/src/client/devices/use-devices-report.ts +53 -82
  124. package/dist/template/src/client/devices/version-adoption-chart.tsx +47 -49
  125. package/dist/template/src/client/distribution-control.tsx +89 -57
  126. package/dist/template/src/client/distribution-history.tsx +353 -0
  127. package/dist/template/src/client/guard-action-catalog.tsx +183 -0
  128. package/dist/template/src/client/guard-action-combobox.test.ts +16 -22
  129. package/dist/template/src/client/guard-action-combobox.tsx +133 -239
  130. package/dist/template/src/client/guard-action-options.ts +4 -6
  131. package/dist/template/src/client/i18n/en.json +133 -2
  132. package/dist/template/src/client/i18n/language-switching.test.tsx +12 -3
  133. package/dist/template/src/client/i18n/ru.json +133 -2
  134. package/dist/template/src/client/i18n/uk.json +133 -2
  135. package/dist/template/src/client/logout-button.tsx +3 -3
  136. package/dist/template/src/client/policy-draft.ts +138 -0
  137. package/dist/template/src/client/update-audience-editor.tsx +597 -206
  138. package/dist/template/src/client/update-policy-editor.test.ts +101 -29
  139. package/dist/template/src/client/update-policy-editor.tsx +454 -320
  140. package/dist/template/src/client/use-filtered-results.ts +55 -0
  141. package/dist/template/src/server/controllers/manifest.test.ts +23 -3
  142. package/dist/template/src/server/controllers/manifest.ts +15 -1
  143. package/dist/template/src/server/devices/audience.ts +9 -5
  144. package/dist/template/src/server/lib/admin-audience-activation.test.ts +37 -90
  145. package/dist/template/src/server/lib/admin-release-history.test.ts +138 -0
  146. package/dist/template/src/server/lib/admin-updates.ts +160 -534
  147. package/dist/template/src/server/lib/distribution-history.ts +97 -0
  148. package/dist/template/src/server/lib/supabase.js +24 -0
  149. package/dist/template/src/server/lib/supabase.test.ts +38 -1
  150. package/dist/template/src/server/lib/update-policy.test.ts +20 -0
  151. package/dist/template/src/server/lib/update-policy.ts +23 -10
  152. package/dist/template/src/server/manifest/manifest-repository.ts +11 -3
  153. package/dist/template/src/server/manifest/manifest-values.test.ts +2 -0
  154. package/dist/template/src/server/manifest/manifest-values.ts +21 -13
  155. package/dist/template/templates/expo-app/scripts/ota-publish/api/database-client.mjs +7 -30
  156. package/dist/template/templates/expo-app/scripts/ota-register-embedded/index.mjs +2 -1
  157. package/dist/template/tsconfig.json +2 -2
  158. package/dist/template-manifest.json +446 -301
  159. package/package.json +1 -1
  160. package/dist/template/scripts/lib/device-identity.test.ts +0 -29
  161. package/dist/template/scripts/lib/ota-client.test.ts +0 -55
  162. package/dist/template/scripts/lib/ota-update-controller.test.ts +0 -232
  163. package/dist/template/scripts/lib/ota-updates-ui.test.tsx +0 -154
  164. package/dist/template/scripts/tests/ota-client-types.mjs +0 -69
  165. package/dist/template/templates/expo-app/ota-client/README.md +0 -73
  166. package/dist/template/templates/expo-app/ota-client/controller.ts +0 -107
  167. package/dist/template/templates/expo-app/ota-client/device-identity.ts +0 -48
  168. package/dist/template/templates/expo-app/ota-client/docs/update-lifecycle.md +0 -61
  169. package/dist/template/templates/expo-app/ota-client/index.ts +0 -16
  170. package/dist/template/templates/expo-app/ota-client/model/hooks/useOtaUpdates.ts +0 -97
  171. package/dist/template/templates/expo-app/ota-client/model/update-controller.ts +0 -293
  172. package/dist/template/templates/expo-app/ota-client/runtime.ts +0 -153
  173. package/dist/template/templates/expo-app/ota-client/types.ts +0 -85
  174. package/dist/template/templates/expo-app/ota-client/ui/ota-update-gate.tsx +0 -25
  175. package/dist/template/templates/expo-app/ota-client/ui/ota-updates.tsx +0 -196
@@ -14,17 +14,19 @@
14
14
  }
15
15
  ```
16
16
 
17
+ **Завантажити після відкладення** передає в підписаному маніфесті `delivery: "manual"` та `onPostpone: "download"`. Оновлений клієнт спочатку пропонує OTA. Після «Відкласти» він завантажує його без перезапуску поточного сеансу. Старі клієнти зберігають звичайну ручну поведінку. Для наявної БД застосуйте `2026-11-25-download-on-postpone.sql`.
18
+
17
19
  Властивість `guard` відсутня, якщо Guard не налаштовано. Налаштований Guard безумовний: він включається для кожного клієнта, якому наявна логіка вибору за середовищем виконання, каналом, платформою, аудиторією та оновленням видає це OTA. Примусовий Guard ніколи не обходить аудиторію пристроїв. Наявність дії в каталозі рекомендаційна й не потрібна для її збереження або видачі.
18
20
 
19
21
  - `Updates.checkForUpdateAsync()` повертає політику в маніфесті **кандидата** в результаті перевірки.
20
22
  - `Updates.manifest` містить політику оновлення, **запущеного зараз**. Не використовуйте її як політику кандидата до завантаження.
21
23
  - `manual` використовується за замовчуванням і залишає завантаження та перезапуск застосунку.
22
- - `background` означає непомітне завантаження кандидата без негайного перезапуску та застосування під час наступного холодного старту.
24
+ - Фонова доставка (`background`) без Guard завантажує оновлення непомітно та застосовує його під час наступного холодного запуску.
23
25
  - Старі клієнти безпечно ігнорують додаткове значення `extra`.
24
26
 
25
27
  Неактивне завантаження є чернеткою, навіть якщо його початковий `disabled_at` дорівнює `created_at`. Режим доставки та простий Guard можна редагувати до активації. Сам по собі `disabled_at` не доводить, що оновлення публікувалося.
26
28
 
27
- `ota_update_channels.latest_update_id` позначає найновіше завантаження й тому може вказувати на неактивну чернетку. Цей вказівник не доводить публікацію; під час вибору маніфесту використовується останнє активне оновлення. Вказівник відкату `active_update_id` або запис у `ota_served_manifest_log` підтверджують публікацію.
29
+ Завантаження чернетки зберігає поточні вказівники роздачі. Вони оновлюються під час ручної активації, зупинки, просування, відкату чи відновлення. У старій БД збережений вказівник може посилатися на неактивне завантаження. Публікацію підтверджує активація або запис про виданий маніфест.
28
30
 
29
31
  Активація є подією публікації. Після активації, повернення до останньої версії, використання як цілі відкату або підтвердженої видачі політика залишається незмінною, навіть якщо потім оновлення вимкнули. Щоб змінити політику, опублікуйте новий ID оновлення.
30
32
 
@@ -46,20 +48,20 @@ psql "$DATABASE_URL" -f docs/migrations/2026-09-01-policy-publication-correction
46
48
 
47
49
  ## Каталог дій Guard {#guard-action-catalog}
48
50
 
49
- Редактор політики завантажує назви дій для повторного використання з `ota_guard_actions`. Нові встановлення отримують окремі дії `ota-force-update` та `ota-force-store-update`. Оператори можуть створити дію, ввівши її в поле вибору, або через окрему форму каталогу. Ця форма доступна й під час перегляду незмінної політики та ніколи її не змінює.
51
+ Виберіть профіль політики для чернетки, налаштуйте поля й збережіть зміни. Власну дію Guard можна вибрати з каталогу або створити в редакторі. Каталог також можна редагувати окремо під час перегляду зафіксованої політики.
50
52
 
51
53
  Збережені записи каталогу можна видалити кнопкою кошика. Видалення з каталогу не змінює наявну політику. Її дія залишається видимою як тимчасовий варіант до явної зміни; такі варіанти не мають кнопки видалення.
52
54
 
53
55
  Під час створення ключі дій обрізаються по краях, мають містити 1–100 символів і не можуть містити керувальних символів. Спостерігачі можуть переглядати каталог, але не створювати й не видаляти записи.
54
56
 
55
- ## Згенерований клієнтський хук {#generated-client-hook}
57
+ ## Клієнтський хук {#generated-client-hook}
56
58
 
57
- Конфігуратор встановлює `useOtaUpdates(options)` і автоматично підключає його в кореневому layout/App з `OtaUpdateGate` навколо вмісту застосунку. Налаштування та методи описані в [посібнику з життєвого циклу клієнта](./ota-client-lifecycle.md). Хук оцінює політику кандидата з `check()`, потім повторно перевіряє завантажений маніфест: вибраний реліз може змінитися між перевіркою та завантаженням.
59
+ Конфігуратор імпортує `OtaUpdates` з `expo-updates-server-client` і розміщує його поруч із навігацією. Компонент застосовує політику релізу через `useOtaUpdates(options)`. Налаштування та методи описані в [посібнику з життєвого циклу клієнта](./ota-client-lifecycle.md). Хук оцінює політику кандидата з `check()`, потім повторно перевіряє завантажений маніфест: вибраний реліз може змінитися між перевіркою та завантаженням.
58
60
 
59
- - `ota-force-update` вимагає сумісне **OTA**: блокувальний екран забороняє взаємодію, хук завантажує оновлення й показує дію перезапуску після готовності.
61
+ - У режимі `manual` дія `ota-force-update` завантажує сумісне OTA та пропонує обов’язковий перезапуск.
62
+ - У режимі `background` дія `ota-force-update` непомітно завантажує підписане оновлення й автоматично перезапускає активний застосунок навіть за `autoReload: false`. Якщо застосунок згорнутий, перезапуск відбудеться після повернення. У разі помилки завантаження або перезапуску з’явиться обов’язковий екран із повторною спробою.
60
63
  - `ota-force-store-update` вимагає **нову нативну збірку**: екран відкриває URL магазину для платформи й не завантажує цього OTA-кандидата. OTA не може змінити середовище виконання або додати нативні модулі. Додаткові дані підтримують `androidUrl`, `iosUrl` або спільний резервний `url`.
61
64
  - Невідомі та власні дії залишаються заблокованими, доки явний `guardHandlers[action]` не поверне `allow`. Сам запис у каталозі не реалізує поведінку Guard.
62
- - `delivery: background` завантажує непомітно й чекає холодного запуску або ручного перезапуску. Увімкнений `autoReload` не спричиняє негайного перезапуску.
63
65
  - Кандидат із ручною доставкою показується для явного завантаження й перезапуску, якщо кореневі налаштування не вмикають `autoUpdate`/`autoReload`. Згенерований корінь вмикає лише автоматичні перевірки.
64
66
 
65
67
  Блокувальний екран потрібен для блокування інтерфейсу застосунку; один хук лише надає стан. Поки обов’язкового кандидата не виявлено, помилка перевірки без мережі залишає запущений застосунок доступним. Expo може застосувати раніше завантажений пакет під час нативного запуску; JavaScript не може відкликати цей нативний кеш. Це політики доставки, а не автентифікація клієнта. Старі клієнти можуть ігнорувати поля політики, тому спочатку поширте налаштований нативний клієнт і лише потім покладайтеся на Guard.
@@ -1,6 +1,6 @@
1
1
  # Публікація `create-expo-updates-server` {#publishing-create-expo-updates-server}
2
2
 
3
- Кореневий пакет Next.js залишається закритим. Публікується лише робочий пакет `packages/create-expo-updates-server`.
3
+ Цей посібник описує випуск ініціалізатора `create-expo-updates-server`. Перед випуском ініціалізатора з новою версією `expo-updates-server-client` переконайтеся, що ця версія клієнта доступна в npm.
4
4
 
5
5
  ## Одноразове налаштування npm {#one-time-npm-configuration}
6
6
 
@@ -40,7 +40,7 @@
40
40
  create-expo-updates-server-v<version>
41
41
  ```
42
42
 
43
- Наприклад, для версії пакета `0.2.0` потрібен тег `create-expo-updates-server-v0.2.0`.
43
+ Наприклад, для версії пакета `0.6.0` потрібен тег `create-expo-updates-server-v0.6.0`.
44
44
 
45
45
  Workflow, що запускається лише за тегом, звіряє тег із версією пакета, повторно збирає й тестує детермінований шаблон і перевіряє, що позначений коміт є предком `origin/main`. Перевірка виконується до входу в захищене оточення `npm-publish`. Створюється один архів релізу; саме цей артефакт передається завданню публікації із захистом оточенням і публікується з публічним доступом та npm provenance через OIDC. Невідповідність тега, не включений до main коміт або невідповідність SHA робочої копії та події блокують публікацію.
46
46
 
@@ -0,0 +1,4 @@
1
+ export const installationIdPattern =
2
+ /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
3
+ export const deviceIdPattern = /^[0-9a-f]{64}$/;
4
+ export const maxIdsPerKind = 100;
@@ -31,6 +31,7 @@
31
31
  "typescript": "^5"
32
32
  },
33
33
  "devDependencies": {
34
+ "@playwright/test": "^1.65.1",
34
35
  "@tailwindcss/postcss": "^4",
35
36
  "@types/node": "^20",
36
37
  "@types/react": "^19",
@@ -2720,6 +2721,22 @@
2720
2721
  "url": "https://github.com/sponsors/Boshen"
2721
2722
  }
2722
2723
  },
2724
+ "node_modules/@playwright/test": {
2725
+ "version": "1.65.1",
2726
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.1.tgz",
2727
+ "integrity": "sha512-y+NCIRm2LvY4slUVWvGh1nujJ8RF/hEisIsq2mtUPgdQC4L701bq5hZGMhrpeXjACvwvO9tj5dJqhvM6TP9lbw==",
2728
+ "devOptional": true,
2729
+ "license": "Apache-2.0",
2730
+ "dependencies": {
2731
+ "playwright": "1.65.1"
2732
+ },
2733
+ "bin": {
2734
+ "playwright": "cli.js"
2735
+ },
2736
+ "engines": {
2737
+ "node": ">=20"
2738
+ }
2739
+ },
2723
2740
  "node_modules/@radix-ui/number": {
2724
2741
  "version": "1.1.3",
2725
2742
  "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.3.tgz",
@@ -11630,6 +11647,35 @@
11630
11647
  "url": "https://github.com/sponsors/jonschlinkert"
11631
11648
  }
11632
11649
  },
11650
+ "node_modules/playwright": {
11651
+ "version": "1.65.1",
11652
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz",
11653
+ "integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==",
11654
+ "devOptional": true,
11655
+ "license": "Apache-2.0",
11656
+ "dependencies": {
11657
+ "playwright-core": "1.65.1"
11658
+ },
11659
+ "bin": {
11660
+ "playwright": "cli.js"
11661
+ },
11662
+ "engines": {
11663
+ "node": ">=20"
11664
+ }
11665
+ },
11666
+ "node_modules/playwright-core": {
11667
+ "version": "1.65.1",
11668
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz",
11669
+ "integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==",
11670
+ "devOptional": true,
11671
+ "license": "Apache-2.0",
11672
+ "bin": {
11673
+ "playwright-core": "cli.js"
11674
+ },
11675
+ "engines": {
11676
+ "node": ">=20"
11677
+ }
11678
+ },
11633
11679
  "node_modules/possible-typed-array-names": {
11634
11680
  "version": "1.1.0",
11635
11681
  "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
@@ -23,7 +23,8 @@
23
23
  "create-admin": "node scripts/create-admin.mjs",
24
24
  "create-access-token": "node scripts/create-access-token.mjs",
25
25
  "restart-docker": "docker compose up -d --force-recreate app",
26
- "doctor": "node scripts/doctor.mjs"
26
+ "doctor": "node scripts/doctor.mjs",
27
+ "test:e2e": "node scripts/tests/e2e/run.mjs"
27
28
  },
28
29
  "dependencies": {
29
30
  "@aws-sdk/client-s3": "^3.888.0",
@@ -48,6 +49,7 @@
48
49
  "typescript": "^5"
49
50
  },
50
51
  "devDependencies": {
52
+ "@playwright/test": "^1.65.1",
51
53
  "@tailwindcss/postcss": "^4",
52
54
  "@types/node": "^20",
53
55
  "@types/react": "^19",
@@ -29,7 +29,7 @@ Required:
29
29
  Optional:
30
30
  --platform all, ios or android (default: all)
31
31
  --server-env Local Docker env file (default: server .env)
32
- --force Replace generated client, publisher and certificate files
32
+ --force Replace generated files and back up customized legacy client code
33
33
  --help Show this message
34
34
  `);
35
35
  }
@@ -137,8 +137,8 @@ try {
137
137
  if (!result.publisherEnvConfigured) {
138
138
  console.log(`${step++}. Keep any existing .env.ota; create it from .env.ota.example only if missing, then verify publisher/registration credentials.`);
139
139
  }
140
- console.log(`${step++}. In the app, add manual check/download/reload controls or enable hook automation before building. The generated root only auto-checks by default.`);
141
- console.log(`${step++}. Build and install a native binary with telemetry dependencies: npm run ota:build:android:apk or Xcode for iOS. Do this before delivering ota-client via OTA.`);
140
+ console.log(`${step++}. The mounted OtaUpdates component checks for updates automatically by default. Background delivery downloads silently. The immediate required policy also reloads the active app when ready, including with autoReload disabled.`);
141
+ console.log(`${step++}. For a first native integration, build with npm run ota:build:android:apk or Xcode for iOS. Apps already running a compatible native runtime and dependencies can receive this client patch via OTA.`);
142
142
  console.log(`${step++}. Publish with: npm run ota:publish -- --message "Update description"`);
143
143
  console.log(`${step++}. Activate the update in the OTA admin panel.`);
144
144
  } catch (error) {
@@ -78,7 +78,7 @@ async function insertToken(row) {
78
78
  row.name,
79
79
  row.token_prefix,
80
80
  row.token_hash,
81
- JSON.stringify(row.scopes),
81
+ row.scopes,
82
82
  row.expires_at,
83
83
  ],
84
84
  );
@@ -5,6 +5,7 @@ import { createRequire } from 'node:module';
5
5
  import { execFile } from 'node:child_process';
6
6
  import { createHash, X509Certificate } from 'node:crypto';
7
7
  import { probeServer } from './doctor-probes.mjs';
8
+ import { bootstrapCode, clientPackage, nativeClientDependencies } from './ota-client-package.mjs';
8
9
 
9
10
  const exec = util.promisify(execFile);
10
11
  const present = (value) => typeof value === 'string' && Boolean(value.trim()) && !/(?:<[^>]+>|replace-with|YOUR_|choose-a-|:\/\/USER:PASSWORD@HOST|:\/\/user:password@host|updates\.example\.com|storage\.example\.com)/.test(value);
@@ -58,15 +59,15 @@ async function inspectApplication(appRoot, serverUrl, add) {
58
59
  return {};
59
60
  }
60
61
  const require = createRequire(path.join(appRoot, 'package.json'));
61
- const dependencies = ['expo', 'expo-updates', 'expo-application', 'expo-crypto', 'expo-secure-store', '@react-native-async-storage/async-storage'];
62
+ const dependencies = ['expo', ...nativeClientDependencies];
62
63
  const missing = dependencies.filter((name) => {
63
64
  if (!pkg.dependencies?.[name]) return true;
64
65
  try { require.resolve(name); return false; } catch { return true; }
65
66
  });
66
67
  add('app.dependencies', missing.length ? 'fail' : 'pass', missing.length ? `Missing client dependencies: ${missing.join(', ')}.` : 'Client dependencies are declared and resolvable.', missing.length ? 'Run configure-app or install the documented Expo-compatible client dependencies in the app.' : undefined);
67
- const clientFiles = ['index.ts', 'types.ts', 'runtime.ts', 'controller.ts', 'device-identity.ts', 'model/update-controller.ts', 'model/hooks/useOtaUpdates.ts', 'ui/ota-updates.tsx', 'ui/ota-update-gate.tsx'];
68
- const clientFilesPresent = (await Promise.all(clientFiles.map((file) => exists(path.join(appRoot, 'ota-client', file))))).every(Boolean);
69
- add('app.client', clientFilesPresent ? 'pass' : 'fail', clientFilesPresent ? 'Generated client implementation files are present.' : 'Generated client implementation files are incomplete.', clientFilesPresent ? undefined : 'Run configure-app or copy the complete ota-client directory using the manual integration guide.');
68
+ let sdkInstalled = false;
69
+ try { sdkInstalled = Boolean(pkg.dependencies?.[clientPackage] && await exists(require.resolve(clientPackage))); } catch { /* Report unresolved SDK below. */ }
70
+ add('app.client', sdkInstalled ? 'pass' : 'fail', sdkInstalled ? 'Client SDK is declared and resolvable.' : `Missing client SDK: ${clientPackage}.`, sdkInstalled ? undefined : 'Run configure-app to install the client SDK and migrate generated files.');
70
71
  const updates = expo.updates || {};
71
72
  const channel = updates.requestHeaders?.['expo-channel-name'];
72
73
  const runtime = expo.runtimeVersion?.policy === 'appVersion' ? expo.version : expo.runtimeVersion;
@@ -93,16 +94,18 @@ async function inspectApplication(appRoot, serverUrl, add) {
93
94
  let originalEntry = pkg.main || '__platform_default__';
94
95
  if (['ota-entry.js', './ota-entry.js'].includes(originalEntry)) {
95
96
  originalEntry = (await readJson(path.join(appRoot, 'ota-client-entry.json'))).originalEntry;
96
- if (!(await fs.readFile(path.join(appRoot, 'ota-entry.js'), 'utf8')).includes('.start()')) throw new Error('entry');
97
+ const entrySource = (await fs.readFile(path.join(appRoot, 'ota-entry.js'), 'utf8')).replace(/\r\n/g, '\n');
98
+ if (typeof originalEntry !== 'string' || !entrySource.includes(bootstrapCode(originalEntry))) throw new Error('entry');
97
99
  }
98
100
  const { planOtaRootHook } = await import('./ota-root-hook-patcher.mjs');
99
101
  const plan = planOtaRootHook({ appRoot, originalEntry });
100
102
  if (!plan.files.length) {
101
- add('app.root', 'warn', 'Custom entry/root cannot be verified automatically.', 'Verify one unconditional useOtaUpdates call and a mounted OtaUpdateGate in the actual root.');
103
+ add('app.root', 'warn', 'Custom entry/root cannot be verified automatically.', 'Verify SDK initialization before the original entry and a mounted OtaUpdates in your root.');
102
104
  } else {
103
105
  const changes = await Promise.all(plan.files.map(async ([file, content]) => content !== await fs.readFile(path.join(appRoot, file), 'utf8')));
104
106
  if (changes.some(Boolean)) throw new Error('root');
105
- add('app.root', 'pass', 'Recognized root OTA component wiring is present (source inspection only).');
107
+ if (['ota-entry.js', './ota-entry.js'].includes(pkg.main)) add('app.root', 'pass', 'SDK bootstrap and root OTA component wiring are present (source inspection only).');
108
+ else add('app.root', 'warn', 'Root OTA component wiring is present but the manual SDK bootstrap needs verification.', 'Verify initializeOtaClient and start run before loading your root.');
106
109
  }
107
110
  } catch {
108
111
  add('app.root', 'fail', 'Root OTA component or bootstrap metadata is missing or unsupported.', 'Run configure-app or review manual component integration. Doctor never applies the patch.');
@@ -188,9 +188,9 @@ describe('doctor read-only contract', () => {
188
188
  expect(statements.at(-1)).toContain('trg_ota_updates_activate_audience');
189
189
  } finally { vi.doUnmock('pg'); }
190
190
  });
191
- it('validates a complete generated app, then detects missing client files and noncanonical scope', async () => {
191
+ it('validates an SDK-configured app, then detects a stale bootstrap, missing SDK and noncanonical scope', async () => {
192
192
  const cwd = await fixture(); const app = path.join(cwd, 'app'); await fs.mkdir(app);
193
- const deps = ['expo', 'expo-updates', 'expo-application', 'expo-crypto', 'expo-secure-store', '@react-native-async-storage/async-storage'];
193
+ const deps = ['expo', 'expo-updates', 'expo-application', 'expo-crypto', 'expo-secure-store', '@react-native-async-storage/async-storage', 'expo-updates-server-client'];
194
194
  for (const name of deps) {
195
195
  const dir = path.join(app, 'node_modules', name); await fs.mkdir(dir, { recursive: true });
196
196
  await fs.writeFile(path.join(dir, 'index.js'), '');
@@ -198,9 +198,9 @@ describe('doctor read-only contract', () => {
198
198
  await fs.writeFile(path.join(app, 'package.json'), JSON.stringify({ main: 'ota-entry.js', dependencies: Object.fromEntries(deps.map((name) => [name, '1'])), scripts: { 'ota:publish': 'node scripts/ota-publish/index.mjs' } }));
199
199
  const config = { expo: { runtimeVersion: 'v1', updates: { url: 'https://ota.test/api/manifest', checkAutomatically: 'NEVER', requestHeaders: { 'expo-channel-name': 'test' }, codeSigningCertificate: certificate, codeSigningMetadata: { keyid: 'main', alg: 'rsa-v1_5-sha256' } } } };
200
200
  await fs.writeFile(path.join(app, 'app.json'), JSON.stringify(config));
201
- await fs.cp(path.resolve('templates/expo-app/ota-client'), path.join(app, 'ota-client'), { recursive: true });
201
+ await fs.mkdir(path.join(app, 'ota-client'));
202
202
  await fs.writeFile(path.join(app, 'ota-client/config.json'), JSON.stringify({ channel: 'test', heartbeatUrl: 'https://ota.test/api/device-heartbeat', identityNamespace: 'stable-test' }));
203
- await fs.writeFile(path.join(app, 'ota-entry.js'), "require('./ota-client').start(); require('expo/AppEntry');");
203
+ await fs.writeFile(path.join(app, 'ota-entry.js'), `const otaClient = require('expo-updates-server-client');\notaClient.initializeOtaClient(require('./ota-client/config.json'));\notaClient.start();\nrequire("expo/AppEntry");\n`);
204
204
  await fs.writeFile(path.join(app, 'ota-client-entry.json'), JSON.stringify({ originalEntry: 'expo/AppEntry' }));
205
205
  const { patchOtaRootHook } = await import('./ota-root-hook-patcher.mjs');
206
206
  const source = patchOtaRootHook('export default function App() { return null; }', path.join(app, 'App.tsx'), app);
@@ -210,7 +210,9 @@ describe('doctor read-only contract', () => {
210
210
  expect(valid.checks.filter((item) => item.status === 'fail')).toEqual([]);
211
211
  expect(check(valid, 'app.root').status).toBe('pass');
212
212
  expect(await fs.readFile(path.join(app, 'App.tsx'), 'utf8')).toBe(source);
213
- await fs.unlink(path.join(app, 'ota-client/runtime.ts'));
213
+ await fs.writeFile(path.join(app, 'ota-entry.js'), "require('./ota-client').start(); require('expo/AppEntry');");
214
+ expect(check(await offline(cwd, { app }), 'app.root').status).toBe('fail');
215
+ await fs.unlink(path.join(app, 'node_modules/expo-updates-server-client/index.js'));
214
216
  expect(check(await offline(cwd, { app }), 'app.client').status).toBe('fail');
215
217
  config.expo.updates.requestHeaders['expo-channel-name'] = 'Test'; config.expo.runtimeVersion = ' v1 ';
216
218
  await fs.writeFile(path.join(app, 'app.json'), JSON.stringify(config));
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
2
2
  import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
- import { pathToFileURL } from "node:url";
5
+ import { fileURLToPath, pathToFileURL } from "node:url";
6
6
  import vm from "node:vm";
7
7
  import { afterEach, describe, expect, it } from "vitest";
8
8
 
@@ -27,12 +27,15 @@ function createIosRegistrarFixture() {
27
27
  const iosRegistrar = path.join(registrarDirectory, "register-ios.sh");
28
28
  const jsRegistrar = path.join(registrarDirectory, "index.mjs");
29
29
  fs.mkdirSync(registrarDirectory, { recursive: true });
30
- fs.copyFileSync(
31
- path.resolve(
32
- "templates/expo-app/scripts/ota-register-embedded/register-ios.sh",
33
- ),
34
- iosRegistrar,
30
+ // Confine the Xcode/Homebrew fallback paths to this simulated build host.
31
+ const registrar = fs.readFileSync(
32
+ path.resolve("templates/expo-app/scripts/ota-register-embedded/register-ios.sh"),
33
+ "utf8",
35
34
  );
35
+ fs.writeFileSync(iosRegistrar, registrar.replace(
36
+ /"(\/(?:opt\/homebrew|usr\/local)\/bin\/node)"/g,
37
+ (_, absolutePath) => JSON.stringify(projectRoot + absolutePath),
38
+ ));
36
39
  fs.writeFileSync(jsRegistrar, "// Fake registrar; fake Node must run this.\n");
37
40
 
38
41
  const targetBuildDirectory = path.join(projectRoot, "build");
@@ -61,7 +64,9 @@ fi
61
64
  );
62
65
  fs.chmodSync(fakeNode, 0o755);
63
66
 
64
- const pathWithoutNode = "/usr/bin:/bin";
67
+ const pathWithoutNode = path.join(projectRoot, "bin");
68
+ fs.mkdirSync(pathWithoutNode);
69
+ fs.symlinkSync("/usr/bin/dirname", path.join(pathWithoutNode, "dirname"));
65
70
  const env = {
66
71
  ...process.env,
67
72
  PATH: pathWithoutNode,
@@ -442,3 +447,13 @@ describe("embedded update registrar", () => {
442
447
  );
443
448
  });
444
449
  });
450
+
451
+ it("executes the embedded registrar when Xcode invokes a symlinked path", () => {
452
+ const scratch = fs.mkdtempSync(path.join(os.tmpdir(), "ota-cli-link-"));
453
+ temporaryDirectories.push(scratch);
454
+ const entry = path.join(scratch, "register.mjs");
455
+ fs.symlinkSync(fileURLToPath(registrarUrl), entry);
456
+ const result = spawnSync(process.execPath, [entry, "--platform", "ios"], { encoding: "utf8" });
457
+ expect(result.status).toBe(1);
458
+ expect(result.stderr).toContain("Embedded update registration failed");
459
+ });
@@ -1,4 +1,5 @@
1
- import { planOtaClient } from './ota-client-configurator.mjs';
1
+ import { planOtaClient } from "./ota-client-configurator.mjs";
2
+ import { clientPackage, clientVersion, nativeClientDependencies } from "./ota-client-package.mjs";
2
3
  import { execFileSync } from "node:child_process";
3
4
  import crypto from "node:crypto";
4
5
  import fs from "node:fs";
@@ -7,7 +8,9 @@ import { fileURLToPath } from "node:url";
7
8
 
8
9
  const CHANNEL_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
9
10
  const LEGACY_GENERATED_FILE_SHA256 = {
11
+ publisherDatabaseClient: "79fd8aea1fa626485f83c1b3bf5b234317c5bcadd64dac7c6c9faddc490cbe62",
10
12
  embeddedRegistrars: [
13
+ "6d2201f51851d9af41449f8da3653a4792cddb30d411d59e3c161adbc5cf76ff",
11
14
  "29c48288d4804c072129da0ef60a12ad0892809eb8d57a14be94d039d990d6d7",
12
15
  "89997ef11a939ce00e65159bd8e04845f16b184d5192f8fb56b1bc4204b07bca",
13
16
  ],
@@ -137,6 +140,7 @@ function detectPackageManager(appRoot) {
137
140
  }
138
141
 
139
142
  function getPackageCommands(packageManager, platform) {
143
+ const clientInstallArgs = ["expo", "install", ...nativeClientDependencies, `${clientPackage}@${clientVersion}`];
140
144
  const prebuildArgs = ["expo", "prebuild"];
141
145
  if (platform !== "all") {
142
146
  prebuildArgs.push("--platform", platform);
@@ -144,7 +148,7 @@ function getPackageCommands(packageManager, platform) {
144
148
 
145
149
  if (packageManager === "pnpm") {
146
150
  return {
147
- installExpoUpdates: ["pnpm", ["exec", "expo", "install", "expo-updates", "expo-application", "expo-crypto", "expo-secure-store", "@react-native-async-storage/async-storage"]],
151
+ installExpoUpdates: ["pnpm", ["exec", ...clientInstallArgs]],
148
152
  installPublisherDependencies: [
149
153
  "pnpm",
150
154
  ["add", "--save-dev", ...PUBLISHER_DEPENDENCIES],
@@ -155,7 +159,7 @@ function getPackageCommands(packageManager, platform) {
155
159
 
156
160
  if (packageManager === "yarn") {
157
161
  return {
158
- installExpoUpdates: ["yarn", ["expo", "install", "expo-updates", "expo-application", "expo-crypto", "expo-secure-store", "@react-native-async-storage/async-storage"]],
162
+ installExpoUpdates: ["yarn", clientInstallArgs],
159
163
  installPublisherDependencies: [
160
164
  "yarn",
161
165
  ["add", "--dev", ...PUBLISHER_DEPENDENCIES],
@@ -166,7 +170,7 @@ function getPackageCommands(packageManager, platform) {
166
170
 
167
171
  if (packageManager === "bun") {
168
172
  return {
169
- installExpoUpdates: ["bunx", ["expo", "install", "expo-updates", "expo-application", "expo-crypto", "expo-secure-store", "@react-native-async-storage/async-storage"]],
173
+ installExpoUpdates: ["bunx", clientInstallArgs],
170
174
  installPublisherDependencies: [
171
175
  "bun",
172
176
  ["add", "--dev", ...PUBLISHER_DEPENDENCIES],
@@ -176,7 +180,7 @@ function getPackageCommands(packageManager, platform) {
176
180
  }
177
181
 
178
182
  return {
179
- installExpoUpdates: ["npx", ["expo", "install", "expo-updates", "expo-application", "expo-crypto", "expo-secure-store", "@react-native-async-storage/async-storage"]],
183
+ installExpoUpdates: ["npx", clientInstallArgs],
180
184
  installPublisherDependencies: [
181
185
  "npm",
182
186
  ["install", "--save-dev", ...PUBLISHER_DEPENDENCIES],
@@ -461,15 +465,6 @@ function patchPackageJson(packageJson, platform) {
461
465
  return packageJson;
462
466
  }
463
467
 
464
- function patchPublisherEnvExample(filePath, channel) {
465
- const current = fs.readFileSync(filePath, "utf8");
466
- const next = current.replace(
467
- /^EXPO_UPDATE_CHANNEL=.*$/m,
468
- `EXPO_UPDATE_CHANNEL=${channel}`,
469
- );
470
- fs.writeFileSync(filePath, next, "utf8");
471
- }
472
-
473
468
  function validateProject(appRoot) {
474
469
  const packagePath = path.join(appRoot, "package.json");
475
470
  const appJsonPath = path.join(appRoot, "app.json");
@@ -561,7 +556,7 @@ export function configureExpoApp(
561
556
  validateCertificate(certificatePath);
562
557
  const manifestUrl = resolveManifestUrl(rawOptions.serverUrl);
563
558
  const project = validateProject(appRoot);
564
- const clientPlan = planOtaClient({ appRoot, templateRoot, packageJson: project.packageJson, manifestUrl, channel, force });
559
+ const clientPlan = planOtaClient({ appRoot, packageJson: project.packageJson, manifestUrl, channel, force });
565
560
  const packageManager = detectPackageManager(appRoot);
566
561
  const commands = getPackageCommands(packageManager, platform);
567
562
  const certificateDestination = path.join(
@@ -714,9 +709,18 @@ export function configureExpoApp(
714
709
  exportCommandDestination,
715
710
  force,
716
711
  );
717
- assertCopyAllowed(envExampleSource, envExampleDestination, force);
712
+ const envExample = fs.readFileSync(envExampleSource, "utf8").replace(
713
+ /^EXPO_UPDATE_CHANNEL=.*$/m,
714
+ `EXPO_UPDATE_CHANNEL=${channel}`,
715
+ );
716
+ if (fs.existsSync(envExampleDestination) && fs.readFileSync(envExampleDestination, "utf8") !== envExample) {
717
+ assertCopyAllowed(envExampleSource, envExampleDestination, force);
718
+ }
718
719
  for (const file of publisherFiles) {
719
- assertCopyAllowed(file.source, file.destination, force);
720
+ const knownVersions = file.source === path.join(publisherTemplateRoot, "api", "database-client.mjs")
721
+ ? [LEGACY_GENERATED_FILE_SHA256.publisherDatabaseClient]
722
+ : [];
723
+ assertGeneratedCopyAllowed(file.source, file.destination, force, knownVersions);
720
724
  }
721
725
  assertGeneratedCopyAllowed(
722
726
  registrarSource,
@@ -760,9 +764,11 @@ export function configureExpoApp(
760
764
  );
761
765
  }
762
766
 
767
+ commandRunner(...commands.installExpoUpdates, appRoot);
768
+
763
769
  writeJson(
764
770
  project.appJsonPath,
765
- patchAppJson(project.appJson, {
771
+ patchAppJson(readJson(project.appJsonPath), {
766
772
  channel,
767
773
  runtimeVersion,
768
774
  manifestUrl,
@@ -774,7 +780,7 @@ export function configureExpoApp(
774
780
  copyFile(certificatePath, certificateDestination);
775
781
  copyFile(publisherSource, publisherDestination);
776
782
  copyFile(exportCommandSource, exportCommandDestination);
777
- copyFile(envExampleSource, envExampleDestination);
783
+ fs.writeFileSync(envExampleDestination, envExample);
778
784
  for (const file of publisherFiles) {
779
785
  copyFile(file.source, file.destination);
780
786
  }
@@ -782,7 +788,6 @@ export function configureExpoApp(
782
788
  copyFile(androidRegistrarSource, androidRegistrarDestination);
783
789
  fs.chmodSync(androidRegistrarDestination, 0o755);
784
790
  copyFile(iosPluginSource, iosPluginDestination);
785
- patchPublisherEnvExample(envExampleDestination, channel);
786
791
  if (localPublisherEnv) {
787
792
  fs.writeFileSync(
788
793
  publisherEnvDestination,
@@ -792,8 +797,6 @@ export function configureExpoApp(
792
797
  }
793
798
  appendGitignore(appRoot);
794
799
 
795
- commandRunner(...commands.installExpoUpdates, appRoot);
796
-
797
800
  const installedPackageJson = readJson(project.packagePath);
798
801
  writeJson(
799
802
  project.packagePath,
@@ -193,6 +193,10 @@ function readCurrentRegistrar() {
193
193
 
194
194
  function createManifestOnlyRegistrar() {
195
195
  const manifestOnly = readCurrentRegistrar()
196
+ .replace(
197
+ /if \(process\.argv\[1\] && fs\.existsSync[\s\S]*?fileURLToPath\(import\.meta\.url\)\)\) \{/,
198
+ "if (process.argv[1] === fileURLToPath(import.meta.url)) {",
199
+ )
196
200
  .replace(
197
201
  `
198
202
  export function readExpoAppVersion(appRoot, readFile = fs.readFileSync) {
@@ -408,6 +412,7 @@ function createRunner() {
408
412
  const packagePath = path.join(cwd, "package.json");
409
413
  const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
410
414
  packageJson.dependencies["expo-updates"] = "~56.0.0";
415
+ packageJson.dependencies["expo-updates-server-client"] = "^0.1.0";
411
416
  fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2));
412
417
  }
413
418
  };
@@ -476,6 +481,7 @@ describe("configureExpoApp", () => {
476
481
  "./plugins/with-ota-embedded-registration",
477
482
  );
478
483
  expect(packageJson.dependencies["expo-updates"]).toBe("~56.0.0");
484
+ expect(packageJson.dependencies["expo-updates-server-client"]).toBe("0.1.0");
479
485
  expect(packageJson.scripts["ota:publish"]).toBe(
480
486
  "node scripts/ota-publish/index.mjs",
481
487
  );
@@ -587,7 +593,7 @@ describe("configureExpoApp", () => {
587
593
  expect(calls).toEqual([
588
594
  {
589
595
  command: "npx",
590
- args: ["expo", "install", "expo-updates", "expo-application", "expo-crypto", "expo-secure-store", "@react-native-async-storage/async-storage"],
596
+ args: ["expo", "install", "expo-updates", "expo-application", "expo-crypto", "expo-secure-store", "@react-native-async-storage/async-storage", "expo-updates-server-client@0.1.0"],
591
597
  cwd: appRoot,
592
598
  },
593
599
  {
@@ -609,6 +615,35 @@ describe("configureExpoApp", () => {
609
615
  ]);
610
616
  });
611
617
 
618
+ it.each([
619
+ ["pnpm-lock.yaml", "pnpm", ["exec", "expo", "install"]],
620
+ ["yarn.lock", "yarn", ["expo", "install"]],
621
+ ["bun.lock", "bunx", ["expo", "install"]],
622
+ ])("installs the SDK and Expo-compatible peers with %s", (lockfile, command, prefix) => {
623
+ const { appRoot, certificatePath, templateRoot } = createFixture();
624
+ fs.writeFileSync(path.join(appRoot, lockfile as string), "");
625
+ const { calls, commandRunner } = createRunner();
626
+ configureExpoApp({
627
+ app: appRoot, certificate: certificatePath, serverUrl: "https://updates.example.com",
628
+ channel: "production", runtimeVersion: "1.0", platform: "android",
629
+ }, { commandRunner, templateRoot });
630
+ expect(calls[0]).toEqual({ command, cwd: appRoot, args: [
631
+ ...prefix, "expo-updates", "expo-application", "expo-crypto", "expo-secure-store",
632
+ "@react-native-async-storage/async-storage", "expo-updates-server-client@0.1.0",
633
+ ] });
634
+ });
635
+
636
+ it("keeps app wiring intact when installing the SDK fails", () => {
637
+ const { appRoot, certificatePath, templateRoot } = createFixture();
638
+ const original = fs.readFileSync(path.join(appRoot, "App.tsx"), "utf8");
639
+ expect(() => configureExpoApp({
640
+ app: appRoot, certificate: certificatePath, serverUrl: "https://updates.example.com",
641
+ channel: "production", runtimeVersion: "1.0", platform: "android",
642
+ }, { commandRunner: () => { throw new Error("registry unavailable"); }, templateRoot })).toThrow("registry unavailable");
643
+ expect(fs.readFileSync(path.join(appRoot, "App.tsx"), "utf8")).toBe(original);
644
+ expect(fs.existsSync(path.join(appRoot, "ota-entry.js"))).toBe(false);
645
+ });
646
+
612
647
  it("creates publisher credentials from local Docker settings", () => {
613
648
  const { appRoot, certificatePath, templateRoot } = createFixture();
614
649
  const serverRoot = path.dirname(appRoot);
@@ -882,7 +917,7 @@ describe("configureExpoApp", () => {
882
917
  app: appRoot,
883
918
  certificate: certificatePath,
884
919
  serverUrl: "https://updates.example.com",
885
- channel: "production",
920
+ channel: "qa-preview",
886
921
  runtimeVersion: "1.0.0",
887
922
  };
888
923
  fs.mkdirSync(path.dirname(registrarPath), { recursive: true });