@joiner-platform/cli 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. package/README.md +30 -2
  2. package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
  3. package/bundled-resources/poe-tile-templates/base/README.md +7 -0
  4. package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
  5. package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
  6. package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
  7. package/bundled-resources/poe-tile-templates/base/package.json +36 -0
  8. package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
  9. package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
  10. package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
  11. package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
  12. package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
  13. package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
  14. package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
  15. package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
  16. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
  17. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
  18. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
  19. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
  20. package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
  21. package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
  22. package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
  23. package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
  24. package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
  25. package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
  26. package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
  27. package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
  28. package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
  29. package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
  30. package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
  31. package/bundled-resources/poe-tile-templates/index.ts +27 -0
  32. package/bundled-resources/poe-tile-templates/package.json +31 -0
  33. package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
  34. package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
  35. package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
  36. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
  37. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
  38. package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
  39. package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
  40. package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
  41. package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
  42. package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
  43. package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
  44. package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
  45. package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
  46. package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
  47. package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
  48. package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
  49. package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
  50. package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
  51. package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
  52. package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
  53. package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
  54. package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
  55. package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
  56. package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
  57. package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
  58. package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
  59. package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
  60. package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
  61. package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
  62. package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
  63. package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
  64. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
  65. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
  66. package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
  67. package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
  68. package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
  69. package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
  70. package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
  71. package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
  72. package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
  73. package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
  74. package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
  75. package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
  76. package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
  77. package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
  78. package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
  79. package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
  80. package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
  81. package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
  82. package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
  83. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
  84. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
  85. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
  86. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
  87. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
  88. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
  89. package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
  90. package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
  91. package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
  92. package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
  93. package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
  94. package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
  95. package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
  96. package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
  97. package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
  98. package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
  99. package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
  100. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
  101. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
  102. package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
  103. package/cli.ts +134 -0
  104. package/index.ts +96 -0
  105. package/package.json +48 -5
  106. package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
  107. package/skills/audio-generation/SKILL.md +125 -0
  108. package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
  109. package/skills/finish-prototype/SKILL.md +22 -0
  110. package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
  111. package/skills/help-me-build/SKILL.md +56 -0
  112. package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
  113. package/skills/image-generation/SKILL.md +128 -0
  114. package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
  115. package/skills/one-shot/SKILL.md +22 -0
  116. package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
  117. package/skills/platform-prototype/SKILL.md +60 -0
  118. package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
  119. package/skills/platform-subagent/SKILL.md +16 -0
  120. package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
  121. package/skills/poe-tiles-cli/SKILL.md +609 -0
  122. package/skills/poe-tiles-cli/references/device-motion.md +40 -0
  123. package/skills/poe-tiles-cli/references/player-updates.md +41 -0
  124. package/skills/prototype/.generated-by-poe-templated-docs +0 -0
  125. package/skills/prototype/SKILL.md +149 -0
  126. package/skills/publish/.generated-by-poe-templated-docs +0 -0
  127. package/skills/publish/SKILL.md +73 -0
  128. package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
  129. package/skills/synced-store/SKILL.md +583 -0
  130. package/skills/synced-store/references/actions.md +85 -0
  131. package/skills/synced-store/references/api-patterns.md +245 -0
  132. package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
  133. package/skills/synced-store/references/client-api-reference.md +263 -0
  134. package/skills/synced-store/references/data-visibility.md +95 -0
  135. package/skills/synced-store/references/external-stores.md +162 -0
  136. package/skills/synced-store/references/file-uploads.md +216 -0
  137. package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
  138. package/skills/synced-store/references/limitations.md +72 -0
  139. package/skills/synced-store/references/live-data-limit-hook.md +131 -0
  140. package/skills/synced-store/references/mutator-rules.md +169 -0
  141. package/skills/synced-store/references/platform.md +49 -0
  142. package/skills/synced-store/references/schema-and-bindings.md +85 -0
  143. package/skills/synced-store/references/schema-libraries.md +57 -0
  144. package/skills/synced-store/references/schema-migrations.md +119 -0
  145. package/skills/synced-store/references/searchable-tables.md +27 -0
  146. package/skills/synced-store/references/server-forking.md +115 -0
  147. package/skills/synced-store/references/singleton-tables.md +61 -0
  148. package/skills/synced-store/references/sort-keys.md +253 -0
  149. package/skills/synced-store/references/ui-patterns.md +95 -0
  150. package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
  151. package/skills/tile-creator/SKILL.md +197 -0
  152. package/skills/tile-creator/references/assets.md +124 -0
  153. package/skills/tile-creator/references/backend-api.md +354 -0
  154. package/skills/tile-creator/references/cli-limitations.md +64 -0
  155. package/skills/tile-creator/references/cli.md +604 -0
  156. package/skills/tile-creator/references/client-api.md +2407 -0
  157. package/skills/tile-creator/references/composing-apps.md +166 -0
  158. package/skills/tile-creator/references/e2e-tests.md +55 -0
  159. package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
  160. package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
  161. package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
  162. package/skills/tile-creator/references/native-results.md +100 -0
  163. package/skills/tile-creator/references/platform-integration.md +201 -0
  164. package/skills/tile-creator/references/power-report.md +199 -0
  165. package/skills/tile-creator/references/publish-rollout.md +166 -0
  166. package/skills/tile-creator/references/publishing.md +33 -0
  167. package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
  168. package/skills/tile-creator/references/render-check.md +266 -0
  169. package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
  170. package/skills/tile-creator/references/safe-area-insets.md +79 -0
  171. package/skills/tile-creator/references/sandbox-limitations.md +32 -0
  172. package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
  173. package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
  174. package/skills/tile-creator/references/simulations.md +125 -0
  175. package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
  176. package/skills/tile-creator/references/troubleshooting.md +22 -0
  177. package/skills/tile-creator/references/turn-based-mutator.md +43 -0
  178. package/skills/tile-creator/references/user-erasure.md +14 -0
  179. package/skills/tile-creator/references/vite-plugin.md +166 -0
  180. package/skills/tile-creator/references/workspace-retention.md +72 -0
  181. package/src/admin-conversions-client.ts +28 -0
  182. package/src/admin-reviews-client.ts +36 -0
  183. package/src/api.generated.ts +1527 -0
  184. package/src/auth-token.ts +198 -0
  185. package/src/bounded-read.ts +35 -0
  186. package/src/bun-version.ts +33 -0
  187. package/src/checkout-base.ts +207 -0
  188. package/src/cli-bun-version.ts +16 -0
  189. package/src/cli-env.ts +28 -0
  190. package/src/cli-name.ts +23 -0
  191. package/src/client.ts +2474 -0
  192. package/src/collect-files.ts +226 -0
  193. package/src/commands/accounts.ts +55 -0
  194. package/src/commands/admin-abandon-conversion.ts +60 -0
  195. package/src/commands/admin-reviews.ts +66 -0
  196. package/src/commands/admin.ts +219 -0
  197. package/src/commands/auth.ts +89 -0
  198. package/src/commands/checkout-prototype.ts +67 -0
  199. package/src/commands/creator-source-capability.ts +11 -0
  200. package/src/commands/doctor-bun.ts +145 -0
  201. package/src/commands/doctor-command.ts +64 -0
  202. package/src/commands/doctor-package-json.ts +47 -0
  203. package/src/commands/doctor-sdk-pin.ts +156 -0
  204. package/src/commands/doctor-store-keys-lexer.ts +213 -0
  205. package/src/commands/doctor-store-keys-scan.ts +262 -0
  206. package/src/commands/doctor-store-keys.ts +196 -0
  207. package/src/commands/doctor.ts +371 -0
  208. package/src/commands/init/blank-scaffold-templates.ts +397 -0
  209. package/src/commands/init/index.ts +170 -0
  210. package/src/commands/init/internal-toolchain.ts +49 -0
  211. package/src/commands/init/manager-test-template.ts +107 -0
  212. package/src/commands/init/multiplayer-test-template.ts +217 -0
  213. package/src/commands/init/name-input.tsx +167 -0
  214. package/src/commands/init/no-store-scaffold-templates.ts +281 -0
  215. package/src/commands/init/no-store-scaffold.ts +134 -0
  216. package/src/commands/init/package-json-scripts.ts +72 -0
  217. package/src/commands/init/scaffold.ts +960 -0
  218. package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
  219. package/src/commands/init/sdk-tarball-url.ts +31 -0
  220. package/src/commands/init/template-picker.tsx +147 -0
  221. package/src/commands/inspect-child-entry.ts +107 -0
  222. package/src/commands/inspect-contract.ts +87 -0
  223. package/src/commands/inspect-freshness.ts +217 -0
  224. package/src/commands/inspect-lock.ts +201 -0
  225. package/src/commands/inspect-options.ts +360 -0
  226. package/src/commands/inspect-orchestrate.ts +375 -0
  227. package/src/commands/inspect-process.ts +172 -0
  228. package/src/commands/inspect-ready.ts +65 -0
  229. package/src/commands/inspect-report.ts +235 -0
  230. package/src/commands/inspect-run-state.ts +296 -0
  231. package/src/commands/inspect-run.ts +157 -0
  232. package/src/commands/inspect-watchdog.ts +74 -0
  233. package/src/commands/install-joiner.ts +208 -0
  234. package/src/commands/login.ts +308 -0
  235. package/src/commands/models.ts +40 -0
  236. package/src/commands/parse-options.ts +36 -0
  237. package/src/commands/remix-package-json.ts +64 -0
  238. package/src/commands/remix.ts +379 -0
  239. package/src/commands/sdk-url.ts +141 -0
  240. package/src/commands/simulations.ts +133 -0
  241. package/src/commands/skills.ts +108 -0
  242. package/src/commands/store-files.ts +92 -0
  243. package/src/commands/stores.ts +703 -0
  244. package/src/commands/tiles-channel-commands.ts +115 -0
  245. package/src/commands/tiles-checkout.ts +351 -0
  246. package/src/commands/tiles-gallery-command.ts +95 -0
  247. package/src/commands/tiles-get-helpers.ts +27 -0
  248. package/src/commands/tiles-inspect.ts +276 -0
  249. package/src/commands/tiles-power-command.ts +308 -0
  250. package/src/commands/tiles-power-format.ts +396 -0
  251. package/src/commands/tiles-power-versions.ts +299 -0
  252. package/src/commands/tiles-publish-helpers.ts +145 -0
  253. package/src/commands/tiles-upload-command.ts +277 -0
  254. package/src/commands/tiles-version-commands.ts +201 -0
  255. package/src/commands/tiles-visibility-command.ts +103 -0
  256. package/src/commands/tiles.ts +257 -0
  257. package/src/commands/upgrade.ts +307 -0
  258. package/src/commit-in-progress.ts +42 -0
  259. package/src/creator-source-context.ts +97 -0
  260. package/src/creator-source-publish.ts +52 -0
  261. package/src/deferred-assets.ts +125 -0
  262. package/src/distribution.ts +28 -0
  263. package/src/errors.ts +61 -0
  264. package/src/install-command.ts +43 -0
  265. package/src/output.ts +62 -0
  266. package/src/poe-tile-config-files.ts +100 -0
  267. package/src/poe-tile-config-players.ts +168 -0
  268. package/src/poe-tile-config-remix.ts +166 -0
  269. package/src/poe-tile-config.ts +831 -0
  270. package/src/power-report-client.ts +55 -0
  271. package/src/prototype-startup.ts +21 -0
  272. package/src/publish-change-summary.ts +55 -0
  273. package/src/publish-overrides-validation.ts +49 -0
  274. package/src/publish-pack.ts +167 -0
  275. package/src/publish-phases.ts +57 -0
  276. package/src/publish-retry.ts +51 -0
  277. package/src/publish-tile-from-config.ts +434 -0
  278. package/src/recorder-stream.ts +169 -0
  279. package/src/remix-provenance.ts +156 -0
  280. package/src/resolve-client-credential.ts +71 -0
  281. package/src/resolve-media-uploads.ts +147 -0
  282. package/src/sdk-dependency.ts +54 -0
  283. package/src/sdk-skills.ts +85 -0
  284. package/src/should-skip-client-setup.ts +20 -0
  285. package/src/simulation-snapshot.ts +123 -0
  286. package/src/simulation-types.ts +74 -0
  287. package/src/simulations-client.ts +112 -0
  288. package/src/source-bundle.ts +466 -0
  289. package/src/staged-publish-cleanup.ts +44 -0
  290. package/src/staged-publish-deferred.ts +160 -0
  291. package/src/staged-publish.ts +401 -0
  292. package/src/store-file-upload.ts +268 -0
  293. package/src/store-request.ts +168 -0
  294. package/src/tar-canonical.ts +41 -0
  295. package/src/tar-extensions.ts +159 -0
  296. package/src/tar-extract.ts +193 -0
  297. package/src/tar-parse.ts +224 -0
  298. package/src/tar.ts +231 -0
  299. package/src/template-check-scripts.ts +18 -0
  300. package/src/tile-gallery-client.ts +82 -0
  301. package/src/types.ts +258 -0
  302. package/src/upload-concurrency.ts +54 -0
  303. package/src/whole-tile.ts +52 -0
@@ -0,0 +1,397 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Verify standalone builds and the creator journey with the locally packed SDK.
4
+ * `--dependency-key` and `--tarball-name` are described in sdk-dependency-key.ts;
5
+ * the creator journey (its own CLI scaffold) runs only with the defaults.
6
+ */
7
+
8
+ import assert from "node:assert/strict";
9
+ import {
10
+ copyFileSync,
11
+ existsSync,
12
+ lstatSync,
13
+ mkdirSync,
14
+ mkdtempSync,
15
+ readFileSync,
16
+ rmSync,
17
+ writeFileSync,
18
+ } from "node:fs";
19
+ import { tmpdir } from "node:os";
20
+ import { join } from "node:path";
21
+ import { pathToFileURL } from "node:url";
22
+ import { scaffoldApp } from "../../../projects/poe-tiles-cli/src/commands/init/scaffold.ts";
23
+ import { writeCustomizedManagerFixture } from "../tests/fixtures/customized-manager";
24
+ import { saveInstallDiagnostics } from "./install-diagnostics";
25
+ import { MONOREPO_ROOT } from "./paths.ts";
26
+ import {
27
+ installWithSdkKey,
28
+ parseVerifyOptions,
29
+ stageSdkTarball,
30
+ } from "./sdk-dependency-key";
31
+ import {
32
+ getPublishEnvironment as publishEnv,
33
+ runVerificationCommand as run,
34
+ } from "./verify-local-sdk-command";
35
+
36
+ const TEMPLATE = "react";
37
+ const APP_NAME = "template-react-packaged-sdk";
38
+ const PACKAGED_APP_ROOT = mkdtempSync(join(tmpdir(), "poe-packaged-app-"));
39
+ const APP_DIR = join(PACKAGED_APP_ROOT, APP_NAME);
40
+ const SOLID_APP_NAME = "template-solidjs-packaged-sdk";
41
+ const INSTALL_DIAGNOSTICS_DIR = join(
42
+ MONOREPO_ROOT,
43
+ "packages/poe-tile-templates/test-results/packaged-sdk-install",
44
+ );
45
+ const SDK_TARBALL_PATH = join(
46
+ MONOREPO_ROOT,
47
+ "packages/poe-tiles-sdk/dist/publish/poe-tiles-sdk.tgz",
48
+ );
49
+
50
+ const options = parseVerifyOptions(process.argv.slice(2));
51
+ const { dependencyKey: SDK_KEY, tarballName } = options;
52
+ const runsDefaults = SDK_KEY === "joiner-sdk" && tarballName === undefined;
53
+
54
+ let tempTarballDir: string | undefined;
55
+ try {
56
+ rmSync(INSTALL_DIAGNOSTICS_DIR, { recursive: true, force: true });
57
+ rmSync(APP_DIR, { recursive: true, force: true });
58
+
59
+ run(
60
+ ["bunx", "turbo", "build", "--filter", "joiner-sdk"],
61
+ MONOREPO_ROOT,
62
+ "turbo build joiner-sdk",
63
+ );
64
+ run(
65
+ ["bun", "run", "--filter", "joiner-sdk", "publish-tar"],
66
+ MONOREPO_ROOT,
67
+ "pack local SDK tarball",
68
+ publishEnv(),
69
+ );
70
+
71
+ if (!existsSync(SDK_TARBALL_PATH)) {
72
+ throw new Error(`Local SDK tarball not found: ${SDK_TARBALL_PATH}`);
73
+ }
74
+
75
+ tempTarballDir = mkdtempSync(join(tmpdir(), "poe-tiles-sdk-tarball-"));
76
+ const tempTarballPath = join(
77
+ tempTarballDir,
78
+ `poe-tiles-sdk-${Date.now()}.tgz`,
79
+ );
80
+ stageSdkTarball(SDK_TARBALL_PATH, tempTarballPath, tarballName);
81
+
82
+ mkdirSync(PACKAGED_APP_ROOT, { recursive: true });
83
+ scaffoldApp({
84
+ appName: APP_NAME,
85
+ template: TEMPLATE,
86
+ outputDir: APP_DIR,
87
+ sdkVersion: pathToFileURL(tempTarballPath).href,
88
+ includeSkill: true,
89
+ blank: true,
90
+ });
91
+ copyFileSync(
92
+ join(import.meta.dir, "../tests/fixtures/extended-mutators.ts.txt"),
93
+ join(APP_DIR, "tests/extended-mutators.test.ts"),
94
+ );
95
+ writeCustomizedManagerFixture({
96
+ dir: join(APP_DIR, "tests/customized-manager"),
97
+ managerExample: readFileSync(
98
+ join(APP_DIR, "synced-store/manager.test.ts"),
99
+ "utf8",
100
+ ),
101
+ });
102
+ copyFileSync(
103
+ join(
104
+ import.meta.dir,
105
+ "../tests/fixtures/multiplayer-verification.test.playwright.ts.txt",
106
+ ),
107
+ join(APP_DIR, "tests/multiplayer-verification.test.playwright.ts"),
108
+ );
109
+
110
+ // This runs against the isolated tarball dependency graph. Monorepo type
111
+ // checks cannot catch undeclared packages that happen to be hoisted at root.
112
+ writeFileSync(
113
+ join(APP_DIR, "tests/sdk-schema-types.ts"),
114
+ [
115
+ 'import { z } from "zod";',
116
+ `import { defineSchema, table } from "${SDK_KEY}/v1/backend.js";`,
117
+ `import type { InferSchemaTableTypes } from "${SDK_KEY}/v1/client.js";`,
118
+ "",
119
+ "const probeSchema = defineSchema({",
120
+ "\tschemaVersion: 1,",
121
+ "\ttables: {",
122
+ '\t\tround: { schema: table(z.object({ cells: z.array(z.enum(["X", "O"]).nullable()) })) },',
123
+ "\t},",
124
+ "\tmutators: {},",
125
+ "});",
126
+ "",
127
+ "type ProbeTables = InferSchemaTableTypes<typeof probeSchema>;",
128
+ 'declare const cells: ProbeTables["round"]["cells"];',
129
+ "cells.map((cell, index) => {",
130
+ '\tconst typedCell: "X" | "O" | null = cell;',
131
+ "\tconst typedIndex: number = index;",
132
+ "\treturn [typedCell, typedIndex];",
133
+ "});",
134
+ "",
135
+ ].join("\n"),
136
+ );
137
+
138
+ installWithSdkKey(APP_DIR, options, "bun install (local SDK tarball)");
139
+ // Check the installed SDK, not the scaffold's separately copied skills.
140
+ // A symlink back to the build checkout cannot work for external creators.
141
+ for (const skill of ["tile-creator", "synced-store"]) {
142
+ const skillDir = join(APP_DIR, "node_modules", SDK_KEY, "skills", skill);
143
+ assert(
144
+ lstatSync(skillDir).isDirectory(),
145
+ `${skill} must be a real directory`,
146
+ );
147
+ const skillFile = join(skillDir, "SKILL.md");
148
+ assert(
149
+ lstatSync(skillFile).isFile(),
150
+ `${skill}/SKILL.md must be a real file`,
151
+ );
152
+ assert(readFileSync(skillFile, "utf-8").includes(`name: ${skill}`));
153
+ }
154
+ run(["bun", "run", "type-check"], APP_DIR, "generated app type-check");
155
+ run(["bun", "run", "test"], APP_DIR, "generated app Happy DOM tests");
156
+ run(
157
+ [
158
+ "bun",
159
+ "test",
160
+ "--conditions",
161
+ "browser",
162
+ "tests/extended-mutators.test.ts",
163
+ ],
164
+ APP_DIR,
165
+ "extended scaffold mutator regression",
166
+ );
167
+ run(
168
+ ["bun", "test", "tests/customized-manager/manager.test.ts"],
169
+ APP_DIR,
170
+ "customized manager example regression",
171
+ );
172
+ const schemaProbePath = join(APP_DIR, "tests/packaged-schema-probe.ts");
173
+ writeFileSync(
174
+ schemaProbePath,
175
+ [
176
+ 'import { z } from "zod";',
177
+ `import { defineSchema, table } from "${SDK_KEY}/v1/backend.js";`,
178
+ "",
179
+ 'const markSchema = z.enum(["X", "O"]);',
180
+ 'const matchStatusSchema = z.enum(["waiting", "x-turn", "o-turn", "x-won", "o-won", "draw"]);',
181
+ "export const schema = defineSchema({",
182
+ "\tschemaVersion: 1,",
183
+ "\ttables: {",
184
+ "\t\tplayers: {",
185
+ "\t\t\tschema: table(z.object({ userId: z.string(), mark: markSchema.nullable() })),",
186
+ "\t\t},",
187
+ "\t\tgame: {",
188
+ "\t\t\tschema: table(z.object({",
189
+ "\t\t\t\tboard: z.array(markSchema.nullable()).length(9),",
190
+ "\t\t\t\tstatus: matchStatusSchema,",
191
+ "\t\t\t\twinningLine: z.array(z.number()).nullable(),",
192
+ "\t\t\t})),",
193
+ "\t\t},",
194
+ "\t},",
195
+ "\tmutators: {",
196
+ '\t\tmakeMove: { description: "Place the current player mark", input: z.object({ cellIndex: z.number().int().min(0).max(8) }) },',
197
+ '\t\tstartNewRound: { description: "Reset the board", input: z.object({}) },',
198
+ "\t},",
199
+ "});",
200
+ "export type AppSchema = typeof schema;",
201
+ "",
202
+ ].join("\n"),
203
+ );
204
+ const dataProbePath = join(APP_DIR, "tests/packaged-data-probe.ts");
205
+ writeFileSync(
206
+ dataProbePath,
207
+ [
208
+ `import type { InferReadContext, InferSchemaTableTypes } from "${SDK_KEY}/v1/client.js";`,
209
+ 'import type { AppSchema } from "./packaged-schema-probe";',
210
+ "export type AppTableTypes = InferSchemaTableTypes<AppSchema>;",
211
+ "export type AppReadContext = InferReadContext<AppSchema>;",
212
+ 'export type Player = AppTableTypes["players"];',
213
+ 'export type Game = AppTableTypes["game"];',
214
+ "",
215
+ ].join("\n"),
216
+ );
217
+ const clientProbePath = join(APP_DIR, "tests/packaged-client-probe.ts");
218
+ writeFileSync(
219
+ clientProbePath,
220
+ [
221
+ `import type { InferSyncedStoreClient } from "${SDK_KEY}/v1/client.js";`,
222
+ 'import type { AppSchema } from "./packaged-schema-probe";',
223
+ "export type AppStoreClient = InferSyncedStoreClient<AppSchema>;",
224
+ 'export type { AppReadContext, Game, Player } from "./packaged-data-probe";',
225
+ "",
226
+ ].join("\n"),
227
+ );
228
+ const typeProbePath = join(APP_DIR, "tests/packaged-types-probe.ts");
229
+ writeFileSync(
230
+ typeProbePath,
231
+ [
232
+ `import { useLiveQuery } from "${SDK_KEY}/v1/react";`,
233
+ `import type { InferMutatorHandlers } from "${SDK_KEY}/v1/client.js";`,
234
+ 'import type { AppSchema } from "./packaged-schema-probe";',
235
+ 'import type { AppReadContext, AppStoreClient, Game, Player } from "./packaged-client-probe";',
236
+ "",
237
+ 'type MakeMoveInput = Parameters<InferMutatorHandlers<AppSchema>["makeMove"]>[1];',
238
+ "type IsAny<T> = 0 extends 1 & T ? true : false;",
239
+ "type Equal<A, B> =",
240
+ "\t(<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2",
241
+ "\t\t? true",
242
+ "\t\t: false;",
243
+ 'const packagedGameIsExact: Equal<Game, { board: ("X" | "O" | null)[]; status: "waiting" | "x-turn" | "o-turn" | "x-won" | "o-won" | "draw"; winningLine: number[] | null }> = true;',
244
+ 'const packagedPlayerIsExact: Equal<Player, { userId: string; mark: "X" | "O" | null }> = true;',
245
+ "const packagedMoveInputIsExact: Equal<MakeMoveInput, { cellIndex: number }> = true;",
246
+ "const packagedGameTypeIsNotAny: IsAny<Game> = false;",
247
+ "const packagedPlayerTypeIsNotAny: IsAny<Player> = false;",
248
+ "const packagedMutatorInputIsNotAny: IsAny<MakeMoveInput> = false;",
249
+ 'const packagedBoardCellIsNotAny: IsAny<Game["board"][number]> = false;',
250
+ 'const packagedStatusIsNotAny: IsAny<Game["status"]> = false;',
251
+ 'const packagedPlayerMarkIsNotAny: IsAny<Player["mark"]> = false;',
252
+ 'const packagedMoveIndexIsNotAny: IsAny<MakeMoveInput["cellIndex"]> = false;',
253
+ "declare const game: Game;",
254
+ "declare const player: Player;",
255
+ "declare const moveInput: MakeMoveInput;",
256
+ 'const packagedBoardCell: "X" | "O" | null = game.board[0];',
257
+ 'const packagedStatus: "waiting" | "x-turn" | "o-turn" | "x-won" | "o-won" | "draw" = game.status;',
258
+ 'const packagedPlayerMark: "X" | "O" | null = player.mark;',
259
+ "const packagedMoveIndex: number = moveInput.cellIndex;",
260
+ "async function readMatch(ctx: AppReadContext) {",
261
+ '\tconst players = await ctx.table("players").scan().values().toArray();',
262
+ '\tconst game = await ctx.table("game").get("state");',
263
+ '\tconst profiles = await ctx.table("$userInfo").scan().values().toArray();',
264
+ "\treturn { players, game, profiles };",
265
+ "}",
266
+ "declare const store: AppStoreClient;",
267
+ "const { data } = useLiveQuery(store, readMatch);",
268
+ 'const currentPlayer = data?.players.find((player) => player.mark === "X");',
269
+ "async function queryStore() {",
270
+ "\tconst result = await store.query(readMatch);",
271
+ '\treturn result.players.find((player) => player.mark === "X");',
272
+ "}",
273
+ "void currentPlayer;",
274
+ "void queryStore;",
275
+ "void packagedGameTypeIsNotAny;",
276
+ "void packagedGameIsExact;",
277
+ "void packagedPlayerIsExact;",
278
+ "void packagedMoveInputIsExact;",
279
+ "void packagedPlayerTypeIsNotAny;",
280
+ "void packagedMutatorInputIsNotAny;",
281
+ "void packagedBoardCellIsNotAny;",
282
+ "void packagedStatusIsNotAny;",
283
+ "void packagedPlayerMarkIsNotAny;",
284
+ "void packagedMoveIndexIsNotAny;",
285
+ "void packagedBoardCell;",
286
+ "void packagedStatus;",
287
+ "void packagedPlayerMark;",
288
+ "void packagedMoveIndex;",
289
+ "",
290
+ ].join("\n"),
291
+ );
292
+ run(["bun", "run", "type-check"], APP_DIR, "packaged SDK type probe");
293
+ run(["bun", "run", "build"], APP_DIR, "generated app build");
294
+ run(
295
+ ["bun", "run", "test:playwright"],
296
+ APP_DIR,
297
+ "packaged multiplayer browser helpers",
298
+ );
299
+ // Exercise the render-check entry from the tarball.
300
+ run(["bun", "run", "render-check"], APP_DIR, "packaged render check");
301
+
302
+ // Probe published exports that the templates do not otherwise exercise.
303
+ const probePath = join(APP_DIR, "sdk-surface-probe.ts");
304
+ writeFileSync(
305
+ probePath,
306
+ [
307
+ `const backend = await import("${SDK_KEY}/v1/backend.js");`,
308
+ 'for (const name of ["createModelStream", "collectModelText", "createImageGenerator"] as const) {',
309
+ ' if (typeof backend[name] !== "function") {',
310
+ ' throw new Error("missing v1/backend.js export: " + name);',
311
+ " }",
312
+ "}",
313
+ `const testUtils = await import("${SDK_KEY}/v1/test-utils.js");`,
314
+ 'if (typeof testUtils.createClientInfo !== "function") {',
315
+ ' throw new Error("missing v1/test-utils.js export: createClientInfo");',
316
+ "}",
317
+ `const devServer = await import("${SDK_KEY}/v1/test-utils/dev-server.js");`,
318
+ 'if (typeof devServer.runPoeTileDevServer !== "function") {',
319
+ '\tthrow new Error("missing v1/test-utils/dev-server.js export: runPoeTileDevServer");',
320
+ "}",
321
+ // The CLI's stale-pin check reads this export.
322
+ `const names = await import("${SDK_KEY}/sdk-package-names");`,
323
+ 'if (names.SDK_PACKAGE_NAME !== "joiner-sdk" || names.SDK_WIRE_CLIENT_SPECIFIER !== "poe-tiles-sdk/v1/client.js") {',
324
+ '\tthrow new Error("unexpected sdk-package-names export");',
325
+ "}",
326
+ 'console.log("OK: SDK surface probe passed");',
327
+ "",
328
+ ].join("\n"),
329
+ );
330
+ run(["bun", probePath], APP_DIR, "SDK surface probe");
331
+
332
+ const quickjsBytecodePath = join(
333
+ APP_DIR,
334
+ "dist/synced-store-backend-config.quickjs",
335
+ );
336
+ if (!existsSync(quickjsBytecodePath)) {
337
+ throw new Error(`QuickJS bytecode not emitted: ${quickjsBytecodePath}`);
338
+ }
339
+
340
+ const solidDir = join(PACKAGED_APP_ROOT, SOLID_APP_NAME);
341
+ scaffoldApp({
342
+ appName: SOLID_APP_NAME,
343
+ template: "solidjs",
344
+ outputDir: solidDir,
345
+ sdkVersion: pathToFileURL(tempTarballPath).href,
346
+ includeSkill: true,
347
+ blank: true,
348
+ });
349
+ installWithSdkKey(solidDir, options, "install standalone SolidJS scaffold");
350
+ run(["bun", "run", "type-check"], solidDir, "standalone SolidJS type-check");
351
+ run(["bun", "run", "test"], solidDir, "standalone SolidJS tests");
352
+ run(["bun", "run", "build"], solidDir, "standalone SolidJS build");
353
+
354
+ if (runsDefaults) {
355
+ const cliDir = join(MONOREPO_ROOT, "projects/poe-tiles-cli");
356
+ // The workspace runner can use a different Playwright revision from the
357
+ // standalone app. Install its browser too instead of relying on local caches.
358
+ run(
359
+ ["bunx", "playwright", "install", "chromium"],
360
+ cliDir,
361
+ "creator journey browser",
362
+ );
363
+ run(
364
+ [
365
+ "bun",
366
+ "test",
367
+ "--config=./bunfig.slow.toml",
368
+ "./src/creator-journey.test.slow.ts",
369
+ ],
370
+ cliDir,
371
+ "packaged creator journey",
372
+ );
373
+ }
374
+
375
+ console.log(
376
+ `\nOK: Generated apps build with the ${SDK_KEY} key against the locally packed SDK tarball (name ${tarballName ?? "as packed"}).`,
377
+ );
378
+ } catch (error) {
379
+ // A successful install can omit an optional native package. Keep the exact
380
+ // resolved graph before finally removes it; never retry or mask the failure.
381
+ for (const appName of [APP_NAME, SOLID_APP_NAME]) {
382
+ const appDir = join(PACKAGED_APP_ROOT, appName);
383
+ if (!existsSync(join(appDir, "package.json"))) continue;
384
+ try {
385
+ saveInstallDiagnostics(appDir, join(INSTALL_DIAGNOSTICS_DIR, appName));
386
+ } catch (diagnosticError) {
387
+ console.error("Could not save install diagnostics:", diagnosticError);
388
+ }
389
+ }
390
+ console.error(`Packaged SDK install diagnostics: ${INSTALL_DIAGNOSTICS_DIR}`);
391
+ throw error;
392
+ } finally {
393
+ rmSync(PACKAGED_APP_ROOT, { recursive: true, force: true });
394
+ if (tempTarballDir !== undefined) {
395
+ rmSync(tempTarballDir, { recursive: true, force: true });
396
+ }
397
+ }
@@ -0,0 +1,14 @@
1
+ [test]
2
+ preload = ["fake-indexeddb/auto", "./tests/solid-plugin.ts", "./tests/setup-dom.ts"]
3
+ coverage = true
4
+ coverageDir = "coverage"
5
+ coverageReporter = ["lcov"]
6
+
7
+ [test.reporter]
8
+ junit = "junit.xml"
9
+
10
+ # SolidJS exports "browser" condition for client-side rendering.
11
+ # Without this, bun resolves to the "node" condition which gives
12
+ # the server build (SSR-only, no DOM rendering).
13
+ [install]
14
+ conditions = ["browser"]
@@ -0,0 +1,13 @@
1
+ {
2
+ "devDependencies": {
3
+ "@babel/core": "7.29.0",
4
+ "@babel/preset-typescript": "7.28.5",
5
+ "@solidjs/testing-library": "0.8.10",
6
+ "@tailwindcss/postcss": "4.2.2",
7
+ "@types/babel__core": "7.20.5",
8
+ "babel-preset-solid": "1.9.12",
9
+ "solid-js": "1.9.12",
10
+ "tailwindcss": "4.2.2",
11
+ "vite-plugin-solid": "2.11.12"
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ export default {
2
+ plugins: {
3
+ "@tailwindcss/postcss": {},
4
+ },
5
+ };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Bun plugin that compiles SolidJS JSX using babel-preset-solid.
3
+ *
4
+ * Bun's built-in JSX transpiler converts JSX to React.createElement() calls,
5
+ * which doesn't work for SolidJS. SolidJS requires its own babel transform
6
+ * that compiles JSX into fine-grained DOM operations.
7
+ *
8
+ * This plugin intercepts .tsx files within this package and transforms
9
+ * them using babel with babel-preset-solid. (The filter below is `.tsx`
10
+ * only; SolidJS tests in this package don't use `.jsx`.)
11
+ */
12
+
13
+ import { readFileSync } from "node:fs";
14
+ import { createRequire } from "node:module";
15
+ import { dirname, resolve } from "node:path";
16
+ import { transformSync } from "@babel/core";
17
+ import { plugin } from "bun";
18
+
19
+ // The two presets ship no type declarations. Loading them with `createRequire`
20
+ // types them as opaque values, with no type-check suppression.
21
+ const requirePreset = createRequire(import.meta.url);
22
+ const tsPreset: object = requirePreset("@babel/preset-typescript");
23
+ const solidPreset: object = requirePreset("babel-preset-solid");
24
+
25
+ const PACKAGE_ROOT = resolve(dirname(import.meta.dir));
26
+
27
+ plugin({
28
+ name: "solid-jsx",
29
+ setup(build) {
30
+ build.onLoad({ filter: /\.tsx$/ }, (args) => {
31
+ if (!args.path.startsWith(PACKAGE_ROOT)) return undefined;
32
+
33
+ const source = readFileSync(args.path, "utf8");
34
+ const result = transformSync(source, {
35
+ filename: args.path,
36
+ presets: [
37
+ [solidPreset, { generate: "dom", hydratable: false }],
38
+ [tsPreset, { isTSX: true, allExtensions: true }],
39
+ ],
40
+ });
41
+
42
+ if (!result?.code) {
43
+ throw new Error(`Failed to transform ${args.path}`);
44
+ }
45
+
46
+ return { contents: result.code, loader: "js" };
47
+ });
48
+ },
49
+ });
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
6
+ <meta name="color-scheme" content="light dark">
7
+ <title>{{APP_NAME}}</title>
8
+ <link rel="stylesheet" href="styles.css">
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ <script type="module" src="src/entry.tsx"></script>
13
+ </body>
14
+ </html>
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Entry point — the only file that imports joiner-sdk.
3
+ */
4
+ import {
5
+ applyNativeAppGestureOverrides,
6
+ createPoe,
7
+ createVerticalScrollBounceMount,
8
+ PostMessageEnvironment,
9
+ } from "joiner-sdk/v1/client.js";
10
+ import { render } from "solid-js/web";
11
+ import { todoClientConfig } from "../../client";
12
+ import { App } from "../../ui/App";
13
+
14
+ applyNativeAppGestureOverrides();
15
+
16
+ const environment = new PostMessageEnvironment();
17
+ const Poe = createPoe({ environment });
18
+ const store = Poe.setupStore(todoClientConfig);
19
+
20
+ const root = document.getElementById("root");
21
+ if (root) {
22
+ // Wait for authoritative data (cached locally OR first server pull —
23
+ // whichever wins) before mounting so the UI never paints with empty
24
+ // state on revisit. Resolves immediately when the host sets
25
+ // `is-new` on the parent <poe-tile>, since a fresh instance has no
26
+ // data to load.
27
+ void store.waitForBootstrap().then(
28
+ () => {
29
+ const appRoot = createVerticalScrollBounceMount(root);
30
+ render(() => <App store={store} />, appRoot);
31
+ },
32
+ () => {
33
+ // Client termination before bootstrap is handled by the host.
34
+ },
35
+ );
36
+ }
@@ -0,0 +1,51 @@
1
+ @import "tailwindcss";
2
+
3
+ @layer base {
4
+ *,
5
+ *::before,
6
+ *::after {
7
+ box-sizing: border-box;
8
+ }
9
+
10
+ :root {
11
+ color-scheme: light dark;
12
+ --app-bg-base: #f8f9fa;
13
+ --app-fg-base: #1f2937;
14
+ }
15
+
16
+ @media (prefers-color-scheme: dark) {
17
+ :root {
18
+ --app-bg-base: #101012;
19
+ --app-fg-base: #f8fafc;
20
+ }
21
+ }
22
+
23
+ html,
24
+ body {
25
+ height: 100dvh;
26
+ margin: 0;
27
+ padding: 0;
28
+ overflow: hidden;
29
+ }
30
+
31
+ body {
32
+ font-family: system-ui, -apple-system, sans-serif;
33
+ background-color: var(--app-bg-base);
34
+ color: var(--app-fg-base);
35
+ -webkit-tap-highlight-color: transparent;
36
+ }
37
+
38
+ #root {
39
+ height: 100dvh;
40
+ display: flex;
41
+ flex-direction: column;
42
+ overflow-y: auto;
43
+ padding-top: var(--poe-safe-area-inset-top, env(safe-area-inset-top));
44
+ padding-left: var(--poe-safe-area-inset-left, env(safe-area-inset-left));
45
+ padding-right: var(--poe-safe-area-inset-right, env(safe-area-inset-right));
46
+ padding-bottom: var(
47
+ --poe-safe-area-inset-bottom,
48
+ env(safe-area-inset-bottom)
49
+ );
50
+ }
51
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "jsx": "preserve",
7
+ "jsxImportSource": "solid-js",
8
+ "strict": true,
9
+ "skipLibCheck": true,
10
+ "noEmit": true,
11
+ "allowImportingTsExtensions": true,
12
+ "types": ["bun-types", "vite/client", "joiner-sdk/vite-client"]
13
+ },
14
+ "include": ["tile/src", "synced-store", "ui", "tests", "client.ts"]
15
+ }
@@ -0,0 +1,70 @@
1
+ /** @jsxImportSource solid-js */
2
+ /**
3
+ * Happy-dom UI tests for the SolidJS todo app.
4
+ *
5
+ * Renders the App with a real SyncedStoreClient via `createPoeTileTestHarness`.
6
+ * Two clients share the same in-memory backend, which lets us verify that a
7
+ * mutation made by user-2 flows through the sync protocol and appears in
8
+ * user-1's DOM — the core multi-user guarantee of synced-store.
9
+ */
10
+ import { afterEach, describe, expect, test } from "bun:test";
11
+ import { cleanup, render, waitFor } from "@solidjs/testing-library";
12
+ import { createPoeTileTestHarness } from "joiner-sdk/v1/test-utils.js";
13
+ import { todoBackendConfig } from "../synced-store/backend-config";
14
+ import type { TodoSchema } from "../synced-store/schema";
15
+ import { App } from "./App";
16
+
17
+ describe("Todo App UI", () => {
18
+ afterEach(() => {
19
+ cleanup();
20
+ });
21
+
22
+ test("user-1 can add a todo from the UI", async () => {
23
+ const harness = createPoeTileTestHarness<TodoSchema>({
24
+ store: { backendConfig: todoBackendConfig },
25
+ });
26
+ const { store } = await harness.createClient({ userId: "user-1" });
27
+
28
+ const { container } = render(() => <App store={store} />);
29
+
30
+ await waitFor(() => {
31
+ expect(container.querySelector("#todo-input")).toBeInTheDocument();
32
+ });
33
+
34
+ const input = container.querySelector("#todo-input") as HTMLInputElement;
35
+ const addBtn = container.querySelector("#add-btn") as HTMLButtonElement;
36
+
37
+ input.value = "Buy milk";
38
+ addBtn.click();
39
+
40
+ await waitFor(() => {
41
+ expect(container).toHaveTextContent("Buy milk");
42
+ });
43
+ });
44
+
45
+ test("todo added by user-2 appears in user-1's UI", async () => {
46
+ const harness = createPoeTileTestHarness<TodoSchema>({
47
+ store: { backendConfig: todoBackendConfig },
48
+ });
49
+ const { store: store1 } = await harness.createClient({ userId: "user-1" });
50
+ const { store: store2 } = await harness.createClient({ userId: "user-2" });
51
+
52
+ const { container } = render(() => <App store={store1} />);
53
+
54
+ await waitFor(() => {
55
+ expect(container.querySelector("#todo-input")).toBeInTheDocument();
56
+ });
57
+
58
+ await store2.mutate.setTodo({
59
+ id: "todo-from-user-2",
60
+ text: "Pick up groceries",
61
+ completed: false,
62
+ createdAt: 1000,
63
+ order: 1,
64
+ });
65
+
66
+ await waitFor(() => {
67
+ expect(container).toHaveTextContent("Pick up groceries");
68
+ });
69
+ });
70
+ });