@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.
- package/README.md +30 -2
- package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
- package/bundled-resources/poe-tile-templates/base/README.md +7 -0
- package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
- package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
- package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
- package/bundled-resources/poe-tile-templates/base/package.json +36 -0
- package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
- package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
- package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
- package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
- package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
- package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
- package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
- package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
- package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
- package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
- package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
- package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
- package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
- package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
- package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
- package/bundled-resources/poe-tile-templates/index.ts +27 -0
- package/bundled-resources/poe-tile-templates/package.json +31 -0
- package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
- package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
- package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
- package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
- package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
- package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
- package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
- package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
- package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
- package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
- package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
- package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
- package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
- package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
- package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
- package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
- package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
- package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
- package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
- package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
- package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
- package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
- package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
- package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
- package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
- package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
- package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
- package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
- package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
- package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
- package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
- package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
- package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
- package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
- package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
- package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
- package/cli.ts +134 -0
- package/index.ts +96 -0
- package/package.json +48 -5
- package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/audio-generation/SKILL.md +125 -0
- package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/finish-prototype/SKILL.md +22 -0
- package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
- package/skills/help-me-build/SKILL.md +56 -0
- package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
- package/skills/image-generation/SKILL.md +128 -0
- package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
- package/skills/one-shot/SKILL.md +22 -0
- package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-prototype/SKILL.md +60 -0
- package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
- package/skills/platform-subagent/SKILL.md +16 -0
- package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
- package/skills/poe-tiles-cli/SKILL.md +609 -0
- package/skills/poe-tiles-cli/references/device-motion.md +40 -0
- package/skills/poe-tiles-cli/references/player-updates.md +41 -0
- package/skills/prototype/.generated-by-poe-templated-docs +0 -0
- package/skills/prototype/SKILL.md +149 -0
- package/skills/publish/.generated-by-poe-templated-docs +0 -0
- package/skills/publish/SKILL.md +73 -0
- package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
- package/skills/synced-store/SKILL.md +583 -0
- package/skills/synced-store/references/actions.md +85 -0
- package/skills/synced-store/references/api-patterns.md +245 -0
- package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
- package/skills/synced-store/references/client-api-reference.md +263 -0
- package/skills/synced-store/references/data-visibility.md +95 -0
- package/skills/synced-store/references/external-stores.md +162 -0
- package/skills/synced-store/references/file-uploads.md +216 -0
- package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
- package/skills/synced-store/references/limitations.md +72 -0
- package/skills/synced-store/references/live-data-limit-hook.md +131 -0
- package/skills/synced-store/references/mutator-rules.md +169 -0
- package/skills/synced-store/references/platform.md +49 -0
- package/skills/synced-store/references/schema-and-bindings.md +85 -0
- package/skills/synced-store/references/schema-libraries.md +57 -0
- package/skills/synced-store/references/schema-migrations.md +119 -0
- package/skills/synced-store/references/searchable-tables.md +27 -0
- package/skills/synced-store/references/server-forking.md +115 -0
- package/skills/synced-store/references/singleton-tables.md +61 -0
- package/skills/synced-store/references/sort-keys.md +253 -0
- package/skills/synced-store/references/ui-patterns.md +95 -0
- package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
- package/skills/tile-creator/SKILL.md +197 -0
- package/skills/tile-creator/references/assets.md +124 -0
- package/skills/tile-creator/references/backend-api.md +354 -0
- package/skills/tile-creator/references/cli-limitations.md +64 -0
- package/skills/tile-creator/references/cli.md +604 -0
- package/skills/tile-creator/references/client-api.md +2407 -0
- package/skills/tile-creator/references/composing-apps.md +166 -0
- package/skills/tile-creator/references/e2e-tests.md +55 -0
- package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
- package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
- package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
- package/skills/tile-creator/references/native-results.md +100 -0
- package/skills/tile-creator/references/platform-integration.md +201 -0
- package/skills/tile-creator/references/power-report.md +199 -0
- package/skills/tile-creator/references/publish-rollout.md +166 -0
- package/skills/tile-creator/references/publishing.md +33 -0
- package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
- package/skills/tile-creator/references/render-check.md +266 -0
- package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
- package/skills/tile-creator/references/safe-area-insets.md +79 -0
- package/skills/tile-creator/references/sandbox-limitations.md +32 -0
- package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
- package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
- package/skills/tile-creator/references/simulations.md +125 -0
- package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
- package/skills/tile-creator/references/troubleshooting.md +22 -0
- package/skills/tile-creator/references/turn-based-mutator.md +43 -0
- package/skills/tile-creator/references/user-erasure.md +14 -0
- package/skills/tile-creator/references/vite-plugin.md +166 -0
- package/skills/tile-creator/references/workspace-retention.md +72 -0
- package/src/admin-conversions-client.ts +28 -0
- package/src/admin-reviews-client.ts +36 -0
- package/src/api.generated.ts +1527 -0
- package/src/auth-token.ts +198 -0
- package/src/bounded-read.ts +35 -0
- package/src/bun-version.ts +33 -0
- package/src/checkout-base.ts +207 -0
- package/src/cli-bun-version.ts +16 -0
- package/src/cli-env.ts +28 -0
- package/src/cli-name.ts +23 -0
- package/src/client.ts +2474 -0
- package/src/collect-files.ts +226 -0
- package/src/commands/accounts.ts +55 -0
- package/src/commands/admin-abandon-conversion.ts +60 -0
- package/src/commands/admin-reviews.ts +66 -0
- package/src/commands/admin.ts +219 -0
- package/src/commands/auth.ts +89 -0
- package/src/commands/checkout-prototype.ts +67 -0
- package/src/commands/creator-source-capability.ts +11 -0
- package/src/commands/doctor-bun.ts +145 -0
- package/src/commands/doctor-command.ts +64 -0
- package/src/commands/doctor-package-json.ts +47 -0
- package/src/commands/doctor-sdk-pin.ts +156 -0
- package/src/commands/doctor-store-keys-lexer.ts +213 -0
- package/src/commands/doctor-store-keys-scan.ts +262 -0
- package/src/commands/doctor-store-keys.ts +196 -0
- package/src/commands/doctor.ts +371 -0
- package/src/commands/init/blank-scaffold-templates.ts +397 -0
- package/src/commands/init/index.ts +170 -0
- package/src/commands/init/internal-toolchain.ts +49 -0
- package/src/commands/init/manager-test-template.ts +107 -0
- package/src/commands/init/multiplayer-test-template.ts +217 -0
- package/src/commands/init/name-input.tsx +167 -0
- package/src/commands/init/no-store-scaffold-templates.ts +281 -0
- package/src/commands/init/no-store-scaffold.ts +134 -0
- package/src/commands/init/package-json-scripts.ts +72 -0
- package/src/commands/init/scaffold.ts +960 -0
- package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
- package/src/commands/init/sdk-tarball-url.ts +31 -0
- package/src/commands/init/template-picker.tsx +147 -0
- package/src/commands/inspect-child-entry.ts +107 -0
- package/src/commands/inspect-contract.ts +87 -0
- package/src/commands/inspect-freshness.ts +217 -0
- package/src/commands/inspect-lock.ts +201 -0
- package/src/commands/inspect-options.ts +360 -0
- package/src/commands/inspect-orchestrate.ts +375 -0
- package/src/commands/inspect-process.ts +172 -0
- package/src/commands/inspect-ready.ts +65 -0
- package/src/commands/inspect-report.ts +235 -0
- package/src/commands/inspect-run-state.ts +296 -0
- package/src/commands/inspect-run.ts +157 -0
- package/src/commands/inspect-watchdog.ts +74 -0
- package/src/commands/install-joiner.ts +208 -0
- package/src/commands/login.ts +308 -0
- package/src/commands/models.ts +40 -0
- package/src/commands/parse-options.ts +36 -0
- package/src/commands/remix-package-json.ts +64 -0
- package/src/commands/remix.ts +379 -0
- package/src/commands/sdk-url.ts +141 -0
- package/src/commands/simulations.ts +133 -0
- package/src/commands/skills.ts +108 -0
- package/src/commands/store-files.ts +92 -0
- package/src/commands/stores.ts +703 -0
- package/src/commands/tiles-channel-commands.ts +115 -0
- package/src/commands/tiles-checkout.ts +351 -0
- package/src/commands/tiles-gallery-command.ts +95 -0
- package/src/commands/tiles-get-helpers.ts +27 -0
- package/src/commands/tiles-inspect.ts +276 -0
- package/src/commands/tiles-power-command.ts +308 -0
- package/src/commands/tiles-power-format.ts +396 -0
- package/src/commands/tiles-power-versions.ts +299 -0
- package/src/commands/tiles-publish-helpers.ts +145 -0
- package/src/commands/tiles-upload-command.ts +277 -0
- package/src/commands/tiles-version-commands.ts +201 -0
- package/src/commands/tiles-visibility-command.ts +103 -0
- package/src/commands/tiles.ts +257 -0
- package/src/commands/upgrade.ts +307 -0
- package/src/commit-in-progress.ts +42 -0
- package/src/creator-source-context.ts +97 -0
- package/src/creator-source-publish.ts +52 -0
- package/src/deferred-assets.ts +125 -0
- package/src/distribution.ts +28 -0
- package/src/errors.ts +61 -0
- package/src/install-command.ts +43 -0
- package/src/output.ts +62 -0
- package/src/poe-tile-config-files.ts +100 -0
- package/src/poe-tile-config-players.ts +168 -0
- package/src/poe-tile-config-remix.ts +166 -0
- package/src/poe-tile-config.ts +831 -0
- package/src/power-report-client.ts +55 -0
- package/src/prototype-startup.ts +21 -0
- package/src/publish-change-summary.ts +55 -0
- package/src/publish-overrides-validation.ts +49 -0
- package/src/publish-pack.ts +167 -0
- package/src/publish-phases.ts +57 -0
- package/src/publish-retry.ts +51 -0
- package/src/publish-tile-from-config.ts +434 -0
- package/src/recorder-stream.ts +169 -0
- package/src/remix-provenance.ts +156 -0
- package/src/resolve-client-credential.ts +71 -0
- package/src/resolve-media-uploads.ts +147 -0
- package/src/sdk-dependency.ts +54 -0
- package/src/sdk-skills.ts +85 -0
- package/src/should-skip-client-setup.ts +20 -0
- package/src/simulation-snapshot.ts +123 -0
- package/src/simulation-types.ts +74 -0
- package/src/simulations-client.ts +112 -0
- package/src/source-bundle.ts +466 -0
- package/src/staged-publish-cleanup.ts +44 -0
- package/src/staged-publish-deferred.ts +160 -0
- package/src/staged-publish.ts +401 -0
- package/src/store-file-upload.ts +268 -0
- package/src/store-request.ts +168 -0
- package/src/tar-canonical.ts +41 -0
- package/src/tar-extensions.ts +159 -0
- package/src/tar-extract.ts +193 -0
- package/src/tar-parse.ts +224 -0
- package/src/tar.ts +231 -0
- package/src/template-check-scripts.ts +18 -0
- package/src/tile-gallery-client.ts +82 -0
- package/src/types.ts +258 -0
- package/src/upload-concurrency.ts +54 -0
- package/src/whole-tile.ts +52 -0
package/README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @joiner-platform/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Joiner command line: create, test, and publish Joiner tiles.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Joiner runs on [Bun](https://bun.sh) 1.4.2 or later.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @joiner-platform/cli
|
|
11
|
+
joiner login
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Agent skills
|
|
15
|
+
|
|
16
|
+
The package ships agent skills (tile-creator, synced-store, prototype, and
|
|
17
|
+
more) under `skills/<name>/SKILL.md`. Install them for every project:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
joiner skills install --global
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This writes `~/.claude/skills` and `~/.agents/skills`. Inside one project,
|
|
24
|
+
`joiner skills install` writes that project's `.claude/skills` and
|
|
25
|
+
`.agents/skills` instead. `joiner tiles init` does this for new projects.
|
|
26
|
+
|
|
27
|
+
## Upgrade
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
joiner upgrade
|
|
31
|
+
```
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Joiner tile — {{APP_NAME}}
|
|
2
|
+
|
|
3
|
+
**Load the `tile-creator` skill before editing this tile**, following the host's skill-loading policy. It covers scaffold workflow, sandbox restrictions, schema/mutator patterns, and testing setup.
|
|
4
|
+
|
|
5
|
+
For synced-store work specifically, also load `synced-store`.
|
|
6
|
+
|
|
7
|
+
## Verification
|
|
8
|
+
|
|
9
|
+
- Test creator-authored behavior with mutator/unit tests and Happy DOM UI tests.
|
|
10
|
+
Jest DOM matchers are configured in `tests/setup-dom.ts`. In Happy DOM tests,
|
|
11
|
+
query the returned container; Testing Library's global `screen` can bind
|
|
12
|
+
before the preloaded document exists. Add browser-only coverage when the
|
|
13
|
+
behavior needs it. Before publishing a multiplayer tile, adapt and run
|
|
14
|
+
a two-client browser test, including reconnect and persisted server state.
|
|
15
|
+
- Follow the `tile-creator` skill for `bun run verify` (including existing browser smoke
|
|
16
|
+
checks) and ad-hoc browser tooling. `tests/multiplayer.ts` is the
|
|
17
|
+
multiplayer browser recipe.
|
|
18
|
+
- The Creator host owns publication when its system prompt says so. Finish
|
|
19
|
+
verification and report its results; do not invoke publication commands.
|
|
20
|
+
|
|
21
|
+
## Multiplayer golden path
|
|
22
|
+
|
|
23
|
+
The scaffold already contains the complete typed path; start by editing it
|
|
24
|
+
instead of searching the SDK or declaration files:
|
|
25
|
+
|
|
26
|
+
1. Define tile-owned state and mutators in `synced-store/schema.ts`.
|
|
27
|
+
2. Auto-seat members in `synced-store/hooks.ts` using `onAddUsers`. Keep the
|
|
28
|
+
hook deterministic and wired into both client and backend configs.
|
|
29
|
+
3. Import `AppReadContext` from `client.ts` for reusable readers. It includes
|
|
30
|
+
tile tables plus `$users`, `$userInfo`, `$permissions`, and `$$system`.
|
|
31
|
+
In React, use `useLiveQuery` from `joiner-sdk/v1/react`; in Solid, use
|
|
32
|
+
`createLiveQueryResource` from `joiner-sdk/v1/solid`; in Preact, subscribe
|
|
33
|
+
from `useEffect` and return the unsubscribe function; in Vanilla JS and the
|
|
34
|
+
Phaser DOM shell, pass the module-level `(ctx: AppReadContext) => ...` reader
|
|
35
|
+
to `store.subscribe`. Keep Phaser itself behind the scaffold's dynamic import,
|
|
36
|
+
feed it snapshots from the DOM shell, and mutate only on semantic input—not
|
|
37
|
+
from the frame loop. The generated `ui/App.*` demonstrates each path.
|
|
38
|
+
The reader's tile rows, profiles, and return value are inferred; do not add
|
|
39
|
+
manual row types or inspect SDK declarations.
|
|
40
|
+
4. Keep production and Happy DOM UI wiring on the shared `ui/app-contract.ts`
|
|
41
|
+
contract. Add platform capabilities to `AppProps` using SDK types such as
|
|
42
|
+
`PoeAPI["haptics"]` or `typeof resumeAudioContext`, wire the real value in
|
|
43
|
+
`tile/src/entry.*`, and update `createTestAppProps` in
|
|
44
|
+
`tests/app-test-props.ts` with the test value. Do not duplicate handwritten
|
|
45
|
+
callback signatures in the component or its tests.
|
|
46
|
+
5. Read participant names and avatars from `$userInfo`; never display raw user
|
|
47
|
+
IDs as profile labels.
|
|
48
|
+
6. Test with `createPoeTileTestHarness`. Each `createClient({ userId })` creates
|
|
49
|
+
`$users` and `$userInfo` rows and runs `onAddUsers`; the default profile name
|
|
50
|
+
equals `userId`. Pass `userInfo: { displayName, profilePicture }` on the
|
|
51
|
+
FIRST `createClient` for a user — a seeded profile is frozen after that, and
|
|
52
|
+
a later differing value throws rather than silently diverging from the
|
|
53
|
+
`$userInfo` row the store already committed. Always call `harness.dispose()`.
|
|
54
|
+
|
|
55
|
+
The generated mutator and Happy DOM tests are executable examples of this
|
|
56
|
+
flow. The default multiplayer starter also ships `synced-store/manager.test.ts`:
|
|
57
|
+
adapt it for typed manager-harness setup and turn/unread/Activity-tab/push assertions.
|
|
58
|
+
A temporary `$userInfo` inspection test should never be necessary.
|
|
59
|
+
Keep those focused tests small while iterating. Follow the skill's visual
|
|
60
|
+
verification guidance for task-appropriate browser checks.
|
|
61
|
+
|
|
62
|
+
## Type-checking
|
|
63
|
+
|
|
64
|
+
Use `bun run type-check` so the project's configured compiler and options
|
|
65
|
+
apply. Keep `tests/` included in `tsconfig.json`: optional Playwright specs and
|
|
66
|
+
`tests/multiplayer.ts` still need type coverage even when they are not run.
|
|
67
|
+
Do not exclude those sources to make a check pass.
|
|
68
|
+
|
|
69
|
+
`bun run type-check` first runs `scripts/check-source.ts`. It fails on any
|
|
70
|
+
source file over 1500 lines, any `@ts-nocheck`, `@ts-ignore` or
|
|
71
|
+
`@ts-expect-error`, and any JavaScript file in a type-checked folder. Split the
|
|
72
|
+
file or fix the types; do not change the script or the `type-check` command.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<!-- TODO: update this README before publishing. -->
|
|
2
|
+
# {{APP_NAME}}
|
|
3
|
+
|
|
4
|
+
TODO: a short, player-facing description (2–4 sentences of prose) of what you
|
|
5
|
+
actually do in this app — written for someone deciding whether to play, not a
|
|
6
|
+
feature spec. No "What you can do" bullet list and no "Built on Synced-Store"
|
|
7
|
+
section; match the player-facing READMEs shipped under `poe-tiles/*`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
|
|
3
|
+
# Build output
|
|
4
|
+
dist/
|
|
5
|
+
|
|
6
|
+
# Local CLI credential filenames. The CLI normally reads them from ~/.poe-tiles/.
|
|
7
|
+
.poe-tiles-token
|
|
8
|
+
poe-tiles-api-key
|
|
9
|
+
poe-tiles-session-token
|
|
10
|
+
|
|
11
|
+
# Keep app metadata images trackable. Commit any local profilePicture file
|
|
12
|
+
# referenced by .poe-tile.json.
|
|
13
|
+
.poe-tile-change-summary
|
|
14
|
+
|
|
15
|
+
# Local verification screenshots and recordings (scripts/visual-check.ts).
|
|
16
|
+
# Also excluded from the published source bundle, so nothing here counts
|
|
17
|
+
# toward its size limit.
|
|
18
|
+
.visual-checks/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InferSyncedStoreClient } from "joiner-sdk/v1/client.js";
|
|
2
|
+
import type { TodoSchema } from "./synced-store/schema";
|
|
3
|
+
|
|
4
|
+
export type { TodoSchema, todoSchema } from "./synced-store/schema";
|
|
5
|
+
export type TodoStoreClient = InferSyncedStoreClient<TodoSchema>;
|
|
6
|
+
export { todoClientConfig } from "./synced-store/client-config";
|
|
7
|
+
export type {
|
|
8
|
+
TodoItem,
|
|
9
|
+
TodoReadContext as AppReadContext,
|
|
10
|
+
TodoTableTypes,
|
|
11
|
+
} from "./synced-store/data/items";
|
|
12
|
+
export { todoMutatorHandlers } from "./synced-store/mutators/index";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{APP_NAME}}",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"doctor": "./scripts/doctor.sh",
|
|
7
|
+
"dev": "bun scripts/check-bun.ts && bun scripts/dev.ts",
|
|
8
|
+
"build": "bun scripts/check-bun.ts && vite build",
|
|
9
|
+
"type-check": "bun scripts/check-source.ts && tsc --noEmit",
|
|
10
|
+
"test": "bun test --conditions browser ./synced-store ./ui/App.test.happydom.tsx",
|
|
11
|
+
"test:playwright": "bun run build && bunx playwright install chromium && bunx playwright test --update-snapshots",
|
|
12
|
+
"test:all": "bun run type-check && bun run test",
|
|
13
|
+
"verify": "bun run type-check && bun run test && bun run build && bunx playwright install chromium && bunx playwright test && bun run doctor",
|
|
14
|
+
"regenerate-screenshot": "bun run build && bunx playwright install chromium && REGEN_SCREENSHOTS=1 bunx playwright test tests/screenshot.test.playwright.ts",
|
|
15
|
+
"render-check": "bun run build && bunx playwright install chromium && RENDER_CHECK=1 bunx playwright test tests/render-check.test.playwright.ts",
|
|
16
|
+
"publish-to-poe-tiles": "bun run build && poe-tiles tiles upload",
|
|
17
|
+
"preinstall": "bun scripts/check-bun.ts"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"joiner-sdk": "{{POE_SDK_VERSION}}"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@playwright/test": "1.61.1",
|
|
24
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
25
|
+
"@types/bun": "1.3.12",
|
|
26
|
+
"fake-indexeddb": "6.2.5",
|
|
27
|
+
"happy-dom": "20.11.2",
|
|
28
|
+
"typescript": "7.0.2",
|
|
29
|
+
"vite": "6.4.2",
|
|
30
|
+
"zod": "4.5.4"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"bun": ">=1.4.2 <1.5.0",
|
|
34
|
+
"node": ">=22.22.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineConfig, devices } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
testDir: "./tests",
|
|
5
|
+
testMatch: "*.test.playwright.ts",
|
|
6
|
+
projects: [
|
|
7
|
+
{
|
|
8
|
+
name: "desktop",
|
|
9
|
+
use: { ...devices["Desktop Chrome"] },
|
|
10
|
+
testIgnore: [
|
|
11
|
+
"**/mobile-viewport.test.playwright.ts",
|
|
12
|
+
"**/render-check.test.playwright.ts",
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
// Named `mobile-viewport`, not `mobile`: this is Chromium with
|
|
17
|
+
// phone-shaped dimensions, NOT real WebKit. Safari-specific quirks
|
|
18
|
+
// (momentum scroll, address-bar dvh/vh, focus/keyboard) need real
|
|
19
|
+
// iOS Safari. The `browserName` override is required because
|
|
20
|
+
// `devices["iPhone 13"]` defaults to webkit but only Chromium is
|
|
21
|
+
// installed on CI / devcontainer images — mirrors the Pixel 7
|
|
22
|
+
// setup in projects/benchmarks/src/web-ui/playwright.config.ts.
|
|
23
|
+
name: "mobile-viewport",
|
|
24
|
+
use: {
|
|
25
|
+
...devices["iPhone 13"],
|
|
26
|
+
browserName: "chromium",
|
|
27
|
+
defaultBrowserType: "chromium",
|
|
28
|
+
},
|
|
29
|
+
// The render check runs here too: the phone descriptor's scale factor
|
|
30
|
+
// and touch emulation are what let the render budget resolve its
|
|
31
|
+
// mobile defaults inside the tile frame.
|
|
32
|
+
testMatch: [
|
|
33
|
+
"**/mobile-viewport.test.playwright.ts",
|
|
34
|
+
"**/render-check.test.playwright.ts",
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source rules `bun run type-check` enforces before running `tsc`. Each one
|
|
3
|
+
* closes a way for tile code to grow past what the type checker and an agent
|
|
4
|
+
* editing it can keep correct:
|
|
5
|
+
*
|
|
6
|
+
* - A type-check suppression comment hides real errors, and a whole-file
|
|
7
|
+
* `nocheck` turns the checker off for everything later added to that file.
|
|
8
|
+
* - JavaScript in a type-checked folder is invisible to `tsc`.
|
|
9
|
+
* - A file over MAX_SOURCE_LINES cannot be read whole, so edits to it miss
|
|
10
|
+
* the other places that need the same change.
|
|
11
|
+
*
|
|
12
|
+
* Folders whose names start with a dot are skipped: copied skills quote the
|
|
13
|
+
* suppression comments, and `.visual-checks/` holds no source.
|
|
14
|
+
*/
|
|
15
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
16
|
+
import { extname, join, relative, sep } from "node:path";
|
|
17
|
+
|
|
18
|
+
export const MAX_SOURCE_LINES = 1500;
|
|
19
|
+
|
|
20
|
+
const CODE_EXTENSIONS = new Set([
|
|
21
|
+
".ts",
|
|
22
|
+
".tsx",
|
|
23
|
+
".mts",
|
|
24
|
+
".cts",
|
|
25
|
+
".js",
|
|
26
|
+
".jsx",
|
|
27
|
+
".mjs",
|
|
28
|
+
".cjs",
|
|
29
|
+
]);
|
|
30
|
+
const JS_EXTENSIONS = new Set([".js", ".jsx", ".mjs", ".cjs"]);
|
|
31
|
+
const SKIPPED_DIRS = new Set(["node_modules", "dist"]);
|
|
32
|
+
/** The folders `tsconfig.json` includes, where JavaScript escapes `tsc`. */
|
|
33
|
+
const TYPED_DIRS = ["tile/src", "synced-store", "ui", "tests"];
|
|
34
|
+
/** A directive TypeScript honors: the comment opens with it. */
|
|
35
|
+
const SUPPRESSION = /(?:\/\/|\/\*)[/*!\s]*@ts-(nocheck|ignore|expect-error)\b/;
|
|
36
|
+
/** The same directive on a later line of a block comment opened above. */
|
|
37
|
+
const CONTINUED_SUPPRESSION = /^[\s*]*@ts-(nocheck|ignore|expect-error)\b/;
|
|
38
|
+
|
|
39
|
+
/** Code files under `dir`, as absolute paths. O(files in the tree). */
|
|
40
|
+
function codeFiles(dir: string): string[] {
|
|
41
|
+
const files: string[] = [];
|
|
42
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
43
|
+
if (entry.name.startsWith(".") || SKIPPED_DIRS.has(entry.name)) continue;
|
|
44
|
+
const path = join(dir, entry.name);
|
|
45
|
+
if (entry.isDirectory()) files.push(...codeFiles(path));
|
|
46
|
+
else if (entry.isFile() && CODE_EXTENSIONS.has(extname(entry.name)))
|
|
47
|
+
files.push(path);
|
|
48
|
+
}
|
|
49
|
+
return files;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function isInTypedDir(relPath: string): boolean {
|
|
53
|
+
const posixPath = relPath.split(sep).join("/");
|
|
54
|
+
return (
|
|
55
|
+
posixPath.startsWith("client.") ||
|
|
56
|
+
TYPED_DIRS.some((dir) => posixPath.startsWith(`${dir}/`))
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** One message per broken rule in `relPath`. O(lines in the file). */
|
|
61
|
+
function fileProblems({
|
|
62
|
+
relPath,
|
|
63
|
+
text,
|
|
64
|
+
}: {
|
|
65
|
+
relPath: string;
|
|
66
|
+
text: string;
|
|
67
|
+
}): string[] {
|
|
68
|
+
const problems: string[] = [];
|
|
69
|
+
if (JS_EXTENSIONS.has(extname(relPath)) && isInTypedDir(relPath)) {
|
|
70
|
+
problems.push(
|
|
71
|
+
`${relPath}: JavaScript is not type-checked. Rename it to TypeScript and fix the errors tsc reports.`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
const lines = text.split("\n");
|
|
75
|
+
if (lines.at(-1) === "") lines.pop();
|
|
76
|
+
if (lines.length > MAX_SOURCE_LINES) {
|
|
77
|
+
problems.push(
|
|
78
|
+
`${relPath}: ${lines.length} lines. Split it into focused modules of at most ${MAX_SOURCE_LINES} lines each.`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return [...problems, ...suppressionProblems({ relPath, lines })];
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Whether a block comment is still open after `line`. Strings are not parsed,
|
|
86
|
+
* so a `/*` inside one can open a comment early; that only matters when a
|
|
87
|
+
* following line then starts with a directive. O(line length).
|
|
88
|
+
*/
|
|
89
|
+
function blockCommentOpenAfter({
|
|
90
|
+
line,
|
|
91
|
+
open,
|
|
92
|
+
}: {
|
|
93
|
+
line: string;
|
|
94
|
+
open: boolean;
|
|
95
|
+
}): boolean {
|
|
96
|
+
let isOpen = open;
|
|
97
|
+
let from = 0;
|
|
98
|
+
for (;;) {
|
|
99
|
+
const at = line.indexOf(isOpen ? "*/" : "/*", from);
|
|
100
|
+
if (at === -1) return isOpen;
|
|
101
|
+
isOpen = !isOpen;
|
|
102
|
+
from = at + 2;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** One message per suppression directive. O(lines in the file). */
|
|
107
|
+
function suppressionProblems({
|
|
108
|
+
relPath,
|
|
109
|
+
lines,
|
|
110
|
+
}: {
|
|
111
|
+
relPath: string;
|
|
112
|
+
lines: string[];
|
|
113
|
+
}): string[] {
|
|
114
|
+
const problems: string[] = [];
|
|
115
|
+
let inBlockComment = false;
|
|
116
|
+
lines.forEach((line, index) => {
|
|
117
|
+
const continued = inBlockComment ? CONTINUED_SUPPRESSION.exec(line) : null;
|
|
118
|
+
const directive = (continued ?? SUPPRESSION.exec(line))?.[1];
|
|
119
|
+
inBlockComment = blockCommentOpenAfter({ line, open: inBlockComment });
|
|
120
|
+
if (!directive) return;
|
|
121
|
+
problems.push(
|
|
122
|
+
`${relPath}:${index + 1}: @ts-${directive} hides type errors. Remove it and fix the errors tsc reports.`,
|
|
123
|
+
);
|
|
124
|
+
});
|
|
125
|
+
return problems;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Every broken rule under the tile at `root`. O(total source size). */
|
|
129
|
+
export function findSourceProblems(root: string): string[] {
|
|
130
|
+
return codeFiles(root)
|
|
131
|
+
.sort()
|
|
132
|
+
.flatMap((path) =>
|
|
133
|
+
fileProblems({
|
|
134
|
+
relPath: relative(root, path),
|
|
135
|
+
text: readFileSync(path, "utf8"),
|
|
136
|
+
}),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (import.meta.main) {
|
|
141
|
+
const problems = findSourceProblems(process.cwd());
|
|
142
|
+
if (problems.length > 0) {
|
|
143
|
+
console.error(
|
|
144
|
+
`Source check failed (scripts/check-source.ts):\n${problems.map((problem) => ` ${problem}`).join("\n")}`,
|
|
145
|
+
);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev server for {{APP_NAME}}.
|
|
3
|
+
*
|
|
4
|
+
* Spawns `vite build --watch`, serves the bundle through TestServer, and
|
|
5
|
+
* injects browser auto-reload on rebuild.
|
|
6
|
+
*
|
|
7
|
+
* bun run dev
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { dirname, resolve } from "node:path";
|
|
11
|
+
import { fileURLToPath } from "node:url";
|
|
12
|
+
import { runPoeTileDevServer } from "joiner-sdk/v1/test-utils/dev-server.js";
|
|
13
|
+
|
|
14
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
|
|
16
|
+
await runPoeTileDevServer({
|
|
17
|
+
tileTypeId: "{{APP_NAME}}",
|
|
18
|
+
tileRootDir: resolve(__dirname, ".."),
|
|
19
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Diagnostic launcher for a scaffolded Poe tile.
|
|
3
|
+
#
|
|
4
|
+
# Run from the project root:
|
|
5
|
+
#
|
|
6
|
+
# ./scripts/doctor.sh
|
|
7
|
+
|
|
8
|
+
set -euo pipefail
|
|
9
|
+
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
12
|
+
REPO_ROOT="$(git -C "$PROJECT_ROOT" rev-parse --show-toplevel 2>/dev/null || printf '%s\n' "$PROJECT_ROOT")"
|
|
13
|
+
REPO_CLI="$REPO_ROOT/projects/poe-tiles-cli/cli.ts"
|
|
14
|
+
|
|
15
|
+
if [[ -f "$REPO_CLI" ]] && command -v bun >/dev/null 2>&1; then
|
|
16
|
+
exec bun "$REPO_CLI" doctor --cwd "$PROJECT_ROOT"
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
if command -v poe-tiles >/dev/null 2>&1; then
|
|
20
|
+
exec poe-tiles doctor --cwd "$PROJECT_ROOT"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
if command -v bun >/dev/null 2>&1; then
|
|
24
|
+
exec bunx --bun poe-tiles doctor --cwd "$PROJECT_ROOT"
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
echo "Could not run Joiner doctor because Bun is not available."
|
|
28
|
+
echo "Install Bun from https://bun.sh, then open a new terminal or restart the agent."
|
|
29
|
+
exit 1
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { mkdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Where ad-hoc verification screenshots and recordings go. Gitignored and
|
|
6
|
+
* excluded from the published source bundle, so frames left here for review
|
|
7
|
+
* never count toward the bundle's size limit.
|
|
8
|
+
*/
|
|
9
|
+
export const VISUAL_CHECKS_DIR = ".visual-checks";
|
|
10
|
+
|
|
11
|
+
/** A path under {@link VISUAL_CHECKS_DIR}, creating the directory on first use. */
|
|
12
|
+
export function visualCheckPath(name: string, root = process.cwd()): string {
|
|
13
|
+
const dir = join(root, VISUAL_CHECKS_DIR);
|
|
14
|
+
mkdirSync(dir, { recursive: true });
|
|
15
|
+
return join(dir, name);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function callLog(error: unknown): string {
|
|
19
|
+
if (!(error instanceof Error) || !("callLog" in error)) return "";
|
|
20
|
+
const log = error.callLog;
|
|
21
|
+
if (typeof log === "string") return log;
|
|
22
|
+
if (Array.isArray(log) && log.every((line) => typeof line === "string")) {
|
|
23
|
+
return log.join("\n");
|
|
24
|
+
}
|
|
25
|
+
return "";
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Resolves once everything already written to stdout and stderr is flushed. */
|
|
29
|
+
async function flushOutput(): Promise<void> {
|
|
30
|
+
await Promise.all(
|
|
31
|
+
[process.stdout, process.stderr].map(
|
|
32
|
+
(stream) =>
|
|
33
|
+
new Promise<void>((resolve) => stream.write("", () => resolve())),
|
|
34
|
+
),
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Run an ad-hoc browser check as the script's last statement, then end the
|
|
40
|
+
* process: exit 0 once the body resolves, or print the failure without an
|
|
41
|
+
* uncaught library code frame and exit 1.
|
|
42
|
+
*
|
|
43
|
+
* Ending on success is deliberate. A check that leaves its `TestServer` or
|
|
44
|
+
* browser open (no `server.close()` in its `finally`) keeps the event loop
|
|
45
|
+
* alive after its last screenshot, so the command would otherwise run until a
|
|
46
|
+
* timeout kills it.
|
|
47
|
+
*/
|
|
48
|
+
export async function runVisualCheck(
|
|
49
|
+
fn: () => void | Promise<void>,
|
|
50
|
+
): Promise<never> {
|
|
51
|
+
let exitCode = 0;
|
|
52
|
+
try {
|
|
53
|
+
await fn();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
56
|
+
console.error(message);
|
|
57
|
+
// Playwright usually includes its call log in message already.
|
|
58
|
+
const log = callLog(error);
|
|
59
|
+
if (log && !message.includes(log)) console.error(log);
|
|
60
|
+
exitCode = 1;
|
|
61
|
+
}
|
|
62
|
+
await flushOutput();
|
|
63
|
+
process.exit(exitCode);
|
|
64
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineBackendConfig } from "joiner-sdk/v1/backend.js";
|
|
2
|
+
import { todoMutatorHandlers } from "./mutators/index";
|
|
3
|
+
import { todoSchema } from "./schema";
|
|
4
|
+
|
|
5
|
+
export const todoBackendConfig = defineBackendConfig({
|
|
6
|
+
schema: todoSchema,
|
|
7
|
+
mutators: todoMutatorHandlers,
|
|
8
|
+
actions: {},
|
|
9
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineClientConfig } from "joiner-sdk/v1/client.js";
|
|
2
|
+
import { todoMutatorHandlers } from "./mutators/index";
|
|
3
|
+
import type { todoSchema } from "./schema";
|
|
4
|
+
|
|
5
|
+
export const todoClientConfig = defineClientConfig<typeof todoSchema>({
|
|
6
|
+
mutators: todoMutatorHandlers,
|
|
7
|
+
schemaVersion: 1,
|
|
8
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InferReadContext,
|
|
3
|
+
InferSchemaTableTypes,
|
|
4
|
+
} from "joiner-sdk/v1/client.js";
|
|
5
|
+
import type { TodoSchema } from "../schema";
|
|
6
|
+
|
|
7
|
+
export type TodoTableTypes = InferSchemaTableTypes<TodoSchema>;
|
|
8
|
+
export type TodoItem = TodoTableTypes["items"];
|
|
9
|
+
export type TodoReadContext = InferReadContext<TodoSchema>;
|
|
10
|
+
|
|
11
|
+
export async function readTodo(
|
|
12
|
+
ctx: TodoReadContext,
|
|
13
|
+
id: string,
|
|
14
|
+
): Promise<TodoItem | undefined> {
|
|
15
|
+
return (await ctx.table("items").get(id)) as TodoItem | undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { removeTodo } from "./remove-todo";
|
|
2
|
+
import { setTodo } from "./set-todo";
|
|
3
|
+
import type { TodoMutators } from "./types";
|
|
4
|
+
|
|
5
|
+
export const todoMutatorHandlers: TodoMutators = {
|
|
6
|
+
setTodo,
|
|
7
|
+
removeTodo,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type { TodoMutator, TodoMutators } from "./types";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readTodo, type TodoItem } from "../data/items";
|
|
2
|
+
import type { TodoMutator } from "./types";
|
|
3
|
+
|
|
4
|
+
export const setTodo: TodoMutator<"setTodo"> = async (ctx, input) => {
|
|
5
|
+
const existing = await readTodo(ctx, input.id);
|
|
6
|
+
const createdAt = input.createdAt ?? existing?.createdAt;
|
|
7
|
+
if (createdAt === undefined) {
|
|
8
|
+
throw new Error("createdAt is required when creating a todo");
|
|
9
|
+
}
|
|
10
|
+
const order = input.order ?? existing?.order ?? createdAt;
|
|
11
|
+
const todo: TodoItem = {
|
|
12
|
+
id: input.id,
|
|
13
|
+
text: input.text ?? existing?.text ?? "",
|
|
14
|
+
completed: input.completed ?? existing?.completed ?? false,
|
|
15
|
+
createdAt,
|
|
16
|
+
createdBy: existing?.createdBy ?? ctx.userId,
|
|
17
|
+
order,
|
|
18
|
+
};
|
|
19
|
+
await ctx.table("items").set({ itemKey: input.id, value: todo });
|
|
20
|
+
};
|