@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
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// owner: aroe
|
|
2
|
+
/**
|
|
3
|
+
* File bodies for the store-less scaffold (`poe-tiles tiles init --no-store`).
|
|
4
|
+
*
|
|
5
|
+
* The store-less scaffold keeps the template's toolchain (Vite, Bun test,
|
|
6
|
+
* Happy DOM, Playwright viewport check) and drops synced-store. State lives
|
|
7
|
+
* in memory for the life of the page, so the entry mounts the app without
|
|
8
|
+
* `setupStore`, the UI takes no store prop, and the Happy DOM test renders
|
|
9
|
+
* the UI with no harness. Experimental: the flag exists so the Creator v2
|
|
10
|
+
* prototype workflow can compare a scaffolded prototype against a
|
|
11
|
+
* single-file one. See `no-store-scaffold.ts` for how these bodies land.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { TemplateName } from "./scaffold.js";
|
|
15
|
+
|
|
16
|
+
const NO_STORE_ENTRY_RENDERERS: Record<
|
|
17
|
+
TemplateName,
|
|
18
|
+
{ imports: string; renderCall: string }
|
|
19
|
+
> = {
|
|
20
|
+
preact: {
|
|
21
|
+
imports: `import { render } from "preact";
|
|
22
|
+
import { App } from "../../ui/App";`,
|
|
23
|
+
renderCall: "render(<App />, appRoot);",
|
|
24
|
+
},
|
|
25
|
+
react: {
|
|
26
|
+
imports: `import { createRoot } from "react-dom/client";
|
|
27
|
+
import { App } from "../../ui/App";`,
|
|
28
|
+
renderCall: "createRoot(appRoot).render(<App />);",
|
|
29
|
+
},
|
|
30
|
+
solidjs: {
|
|
31
|
+
imports: `import { render } from "solid-js/web";
|
|
32
|
+
import { App } from "../../ui/App";`,
|
|
33
|
+
renderCall: "render(() => <App />, appRoot);",
|
|
34
|
+
},
|
|
35
|
+
"vanilla-js": {
|
|
36
|
+
imports: `import { mountApp } from "../../ui/App";`,
|
|
37
|
+
renderCall: "mountApp(appRoot);",
|
|
38
|
+
},
|
|
39
|
+
phaserjs: {
|
|
40
|
+
imports: `import { mountApp } from "../../ui/App";`,
|
|
41
|
+
renderCall: "mountApp(appRoot);",
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export function noStoreEntryFor(template: TemplateName): string {
|
|
46
|
+
const renderer = NO_STORE_ENTRY_RENDERERS[template];
|
|
47
|
+
return `/**
|
|
48
|
+
* Entry point — the only file that imports joiner-sdk.
|
|
49
|
+
*
|
|
50
|
+
* This tile has no synced-store: state lives in memory for the life of
|
|
51
|
+
* the page and is not shared between players or saved between visits.
|
|
52
|
+
*/
|
|
53
|
+
import {
|
|
54
|
+
applyNativeAppGestureOverrides,
|
|
55
|
+
createPoe,
|
|
56
|
+
createVerticalScrollBounceMount,
|
|
57
|
+
PostMessageEnvironment,
|
|
58
|
+
} from "joiner-sdk/v1/client.js";
|
|
59
|
+
${renderer.imports}
|
|
60
|
+
|
|
61
|
+
// Suppress native WebView text selection, callouts, and link dragging so
|
|
62
|
+
// touch interactions behave like an app, not a web page.
|
|
63
|
+
applyNativeAppGestureOverrides();
|
|
64
|
+
|
|
65
|
+
const environment = new PostMessageEnvironment();
|
|
66
|
+
createPoe({ environment });
|
|
67
|
+
|
|
68
|
+
const root = document.getElementById("root");
|
|
69
|
+
if (root) {
|
|
70
|
+
const appRoot = createVerticalScrollBounceMount(root);
|
|
71
|
+
${renderer.renderCall}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function noStoreAppFor({
|
|
77
|
+
template,
|
|
78
|
+
appName,
|
|
79
|
+
}: {
|
|
80
|
+
template: TemplateName;
|
|
81
|
+
appName: string;
|
|
82
|
+
}): string {
|
|
83
|
+
const heading = `Hello, ${appName}`;
|
|
84
|
+
const note = "Edit ui/App to build your app. State lives in memory only.";
|
|
85
|
+
if (template === "react") {
|
|
86
|
+
return `import { useState } from "react";
|
|
87
|
+
|
|
88
|
+
export function App() {
|
|
89
|
+
const [taps, setTaps] = useState(0);
|
|
90
|
+
return (
|
|
91
|
+
<div>
|
|
92
|
+
<h1 id="app-heading">${heading}</h1>
|
|
93
|
+
<button
|
|
94
|
+
type="button"
|
|
95
|
+
data-testid="tap-button"
|
|
96
|
+
onClick={() => setTaps((count) => count + 1)}
|
|
97
|
+
>
|
|
98
|
+
Tapped {taps} times
|
|
99
|
+
</button>
|
|
100
|
+
<p>${note}</p>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
105
|
+
}
|
|
106
|
+
if (template === "preact") {
|
|
107
|
+
return `import { useState } from "preact/hooks";
|
|
108
|
+
|
|
109
|
+
export function App() {
|
|
110
|
+
const [taps, setTaps] = useState(0);
|
|
111
|
+
return (
|
|
112
|
+
<div>
|
|
113
|
+
<h1 id="app-heading">${heading}</h1>
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
data-testid="tap-button"
|
|
117
|
+
onClick={() => setTaps((count) => count + 1)}
|
|
118
|
+
>
|
|
119
|
+
Tapped {taps} times
|
|
120
|
+
</button>
|
|
121
|
+
<p>${note}</p>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
}
|
|
127
|
+
if (template === "solidjs") {
|
|
128
|
+
return `import { createSignal } from "solid-js";
|
|
129
|
+
|
|
130
|
+
export function App() {
|
|
131
|
+
const [taps, setTaps] = createSignal(0);
|
|
132
|
+
return (
|
|
133
|
+
<div>
|
|
134
|
+
<h1 id="app-heading">${heading}</h1>
|
|
135
|
+
<button
|
|
136
|
+
type="button"
|
|
137
|
+
data-testid="tap-button"
|
|
138
|
+
onClick={() => setTaps((count) => count + 1)}
|
|
139
|
+
>
|
|
140
|
+
Tapped {taps()} times
|
|
141
|
+
</button>
|
|
142
|
+
<p>${note}</p>
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
return `export function mountApp(root: HTMLElement): void {
|
|
149
|
+
let taps = 0;
|
|
150
|
+
root.innerHTML = \`
|
|
151
|
+
<div>
|
|
152
|
+
<h1 id="app-heading">${heading}</h1>
|
|
153
|
+
<button type="button" data-testid="tap-button">Tapped 0 times</button>
|
|
154
|
+
<p>${note}</p>
|
|
155
|
+
</div>
|
|
156
|
+
\`;
|
|
157
|
+
const button = root.querySelector<HTMLButtonElement>(
|
|
158
|
+
'[data-testid="tap-button"]',
|
|
159
|
+
);
|
|
160
|
+
button?.addEventListener("click", () => {
|
|
161
|
+
taps += 1;
|
|
162
|
+
button.textContent = \`Tapped \${taps} times\`;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export function noStoreHappyDomTestFor(template: TemplateName): string {
|
|
169
|
+
const jsxDirective =
|
|
170
|
+
template === "solidjs" ? "/** @jsxImportSource solid-js */\n" : "";
|
|
171
|
+
let frameworkImports: string;
|
|
172
|
+
let renderApp: string;
|
|
173
|
+
let cleanupApp: string;
|
|
174
|
+
// Component frameworks rebind `container` from the render result; the
|
|
175
|
+
// vanilla/Phaser mount path never reassigns it, and `useConst` rejects a
|
|
176
|
+
// `let` that is only ever read.
|
|
177
|
+
let containerBinding: "const" | "let";
|
|
178
|
+
if (template === "react") {
|
|
179
|
+
frameworkImports =
|
|
180
|
+
'import { act, cleanup, render } from "@testing-library/react";\nimport { App } from "./App";';
|
|
181
|
+
renderApp = "({ container } = render(<App />));";
|
|
182
|
+
cleanupApp = "cleanup();\n\t\tcontainer.remove();";
|
|
183
|
+
containerBinding = "let";
|
|
184
|
+
} else if (template === "preact") {
|
|
185
|
+
frameworkImports =
|
|
186
|
+
'import { cleanup, render, waitFor } from "@testing-library/preact";\nimport { App } from "./App";';
|
|
187
|
+
renderApp = "({ container } = render(<App />));";
|
|
188
|
+
cleanupApp = "cleanup();\n\t\tcontainer.remove();";
|
|
189
|
+
containerBinding = "let";
|
|
190
|
+
} else if (template === "solidjs") {
|
|
191
|
+
frameworkImports =
|
|
192
|
+
'import { cleanup, render, waitFor } from "@solidjs/testing-library";\nimport { App } from "./App";';
|
|
193
|
+
renderApp = "({ container } = render(() => <App />));";
|
|
194
|
+
cleanupApp = "cleanup();\n\t\tcontainer.remove();";
|
|
195
|
+
containerBinding = "let";
|
|
196
|
+
} else {
|
|
197
|
+
frameworkImports = 'import { mountApp } from "./App";';
|
|
198
|
+
renderApp = `document.body.appendChild(container);
|
|
199
|
+
mountApp(container);`;
|
|
200
|
+
cleanupApp = "container.remove();";
|
|
201
|
+
containerBinding = "const";
|
|
202
|
+
}
|
|
203
|
+
// React batches state updates; wrap the click in `act` so the DOM reflects
|
|
204
|
+
// the new count before the assertion. Preact and Solid re-render on a
|
|
205
|
+
// microtask, so their assertion waits. The DOM templates update the text
|
|
206
|
+
// synchronously in the click handler.
|
|
207
|
+
let tap: string;
|
|
208
|
+
if (template === "react") {
|
|
209
|
+
tap = `await act(async () => {
|
|
210
|
+
button.click();
|
|
211
|
+
});
|
|
212
|
+
expect(button).toHaveTextContent("Tapped 1 times");`;
|
|
213
|
+
} else if (template === "preact" || template === "solidjs") {
|
|
214
|
+
tap = `button.click();
|
|
215
|
+
await waitFor(() => {
|
|
216
|
+
expect(button).toHaveTextContent("Tapped 1 times");
|
|
217
|
+
});`;
|
|
218
|
+
} else {
|
|
219
|
+
tap = `button.click();
|
|
220
|
+
expect(button).toHaveTextContent("Tapped 1 times");`;
|
|
221
|
+
}
|
|
222
|
+
const containerType = template === "preact" ? "Element" : "HTMLElement";
|
|
223
|
+
return `${jsxDirective}import { expect, test } from "bun:test";
|
|
224
|
+
${frameworkImports}
|
|
225
|
+
|
|
226
|
+
test("renders the heading and counts taps in memory", async () => {
|
|
227
|
+
${containerBinding} container: ${containerType} = document.createElement("div");
|
|
228
|
+
try {
|
|
229
|
+
${renderApp}
|
|
230
|
+
|
|
231
|
+
expect(container.querySelector("#app-heading")).toHaveTextContent("Hello");
|
|
232
|
+
|
|
233
|
+
const button = container.querySelector<HTMLButtonElement>(
|
|
234
|
+
'[data-testid="tap-button"]',
|
|
235
|
+
);
|
|
236
|
+
if (!button) throw new Error("tap button not rendered");
|
|
237
|
+
expect(button).toBeInTheDocument();
|
|
238
|
+
expect(button).toHaveTextContent("Tapped 0 times");
|
|
239
|
+
|
|
240
|
+
${tap}
|
|
241
|
+
} finally {
|
|
242
|
+
${cleanupApp}
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
`;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export const NO_STORE_CLAUDE_MD = `# Joiner tile — {{APP_NAME}} (no synced-store)
|
|
249
|
+
|
|
250
|
+
This tile was scaffolded with \`joiner tiles init --no-store\`. It has
|
|
251
|
+
no synced-store: there is no \`synced-store/\` directory, no \`client.ts\`, and
|
|
252
|
+
no backend entry. State lives in memory for the life of the page and is not
|
|
253
|
+
shared between players or saved between visits.
|
|
254
|
+
|
|
255
|
+
## Layout
|
|
256
|
+
|
|
257
|
+
- \`tile/src/entry.*\` mounts the UI. It is the only file that imports
|
|
258
|
+
\`joiner-sdk\`.
|
|
259
|
+
- \`ui/App.*\` is the app. Keep state, rules, rendering, and input handling in
|
|
260
|
+
clearly separated functions or modules under \`ui/\` so a later move to a
|
|
261
|
+
synced-store tile can port them file by file.
|
|
262
|
+
- \`ui/App.test.happydom.tsx\` renders the UI with Happy DOM. Jest DOM
|
|
263
|
+
matchers are configured in \`tests/setup-dom.ts\`. Query the returned
|
|
264
|
+
container; Testing Library's global \`screen\` can bind before the preloaded
|
|
265
|
+
document exists.
|
|
266
|
+
|
|
267
|
+
## Verification
|
|
268
|
+
|
|
269
|
+
- \`bun run test\` runs the Happy DOM test. \`bun run type-check\` and
|
|
270
|
+
\`bun run build\` complete the local loop.
|
|
271
|
+
- \`bun run verify\` also runs the Playwright mobile-viewport check against the
|
|
272
|
+
built bundle.
|
|
273
|
+
- The Creator host owns publication when its system prompt says so. Finish
|
|
274
|
+
verification and report its results; do not invoke publication commands.
|
|
275
|
+
|
|
276
|
+
## Adding shared or durable state later
|
|
277
|
+
|
|
278
|
+
Do not add synced-store files to this scaffold by hand. Scaffold a fresh
|
|
279
|
+
tile without \`--no-store\` and port the modules under \`ui/\` into it; the
|
|
280
|
+
\`tile-creator\` and \`synced-store\` skills cover that project shape.
|
|
281
|
+
`;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// owner: aroe
|
|
2
|
+
/**
|
|
3
|
+
* `poe-tiles tiles init --no-store`: turn a finished scaffold into a
|
|
4
|
+
* store-less one.
|
|
5
|
+
*
|
|
6
|
+
* Runs last in `scaffoldApp`, after the blank overrides, so the default
|
|
7
|
+
* scaffold is untouched when the flag is off. The toolchain stays
|
|
8
|
+
* (package.json, Vite, Bun test with Happy DOM, the Playwright viewport
|
|
9
|
+
* check, `.claude/`); synced-store and everything that imports it go.
|
|
10
|
+
* Rewrites of template-owned lines assert the line they replace so a template
|
|
11
|
+
* change cannot leave a dangling store reference in the store-less output.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import {
|
|
17
|
+
NO_STORE_CLAUDE_MD,
|
|
18
|
+
noStoreAppFor,
|
|
19
|
+
noStoreEntryFor,
|
|
20
|
+
noStoreHappyDomTestFor,
|
|
21
|
+
} from "./no-store-scaffold-templates.js";
|
|
22
|
+
import type { TemplateName } from "./scaffold.js";
|
|
23
|
+
|
|
24
|
+
/** Files and directories the store-less scaffold does not ship. */
|
|
25
|
+
export const NO_STORE_REMOVED_PATHS: readonly string[] = [
|
|
26
|
+
"synced-store",
|
|
27
|
+
"client.ts",
|
|
28
|
+
"tile/src/backend.ts",
|
|
29
|
+
"tests/app-test-props.ts",
|
|
30
|
+
"tests/e2e.test.playwright.ts",
|
|
31
|
+
"tests/multiplayer.ts",
|
|
32
|
+
"ui/app-contract.ts",
|
|
33
|
+
// Phaser's todo scene imports the store types; the store-less App does
|
|
34
|
+
// not use it (the blank overrides already drop it, this covers --no-blank).
|
|
35
|
+
"ui/phaser-scene.ts",
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
const TSCONFIG_INCLUDE_WITH_STORE = `"include": ["tile/src", "synced-store", "ui", "tests", "client.ts"]`;
|
|
39
|
+
const TSCONFIG_INCLUDE_NO_STORE = `"include": ["tile/src", "ui", "tests"]`;
|
|
40
|
+
const VITE_PLUGIN_WITH_BACKEND = `poeTile({ backendEntryPoint: "src/backend.ts" })`;
|
|
41
|
+
const VITE_PLUGIN_NO_BACKEND = "poeTile()";
|
|
42
|
+
/**
|
|
43
|
+
* Dropping the backend entry shortens the `poeTile()` call enough that biome's
|
|
44
|
+
* formatter wants the whole `plugins` array back on one line. React is the only
|
|
45
|
+
* template whose array is wrapped, so its rewrite replaces the block rather
|
|
46
|
+
* than the call — otherwise the store-less scaffold fails its own
|
|
47
|
+
* `format:check` on the first run.
|
|
48
|
+
*/
|
|
49
|
+
const REACT_VITE_PLUGINS_WITH_BACKEND = `plugins: [
|
|
50
|
+
react() as PluginOption,
|
|
51
|
+
poeTile({ backendEntryPoint: "src/backend.ts" }),
|
|
52
|
+
],`;
|
|
53
|
+
const REACT_VITE_PLUGINS_NO_BACKEND = `plugins: [react() as PluginOption, poeTile()],`;
|
|
54
|
+
export const NO_STORE_TEST_SCRIPT =
|
|
55
|
+
"bun test --conditions browser ./ui/App.test.happydom.tsx";
|
|
56
|
+
|
|
57
|
+
function replaceExactly(
|
|
58
|
+
path: string,
|
|
59
|
+
from: string,
|
|
60
|
+
to: string,
|
|
61
|
+
what: string,
|
|
62
|
+
): void {
|
|
63
|
+
const content = readFileSync(path, "utf-8");
|
|
64
|
+
if (!content.includes(from)) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`--no-store: expected ${what} in ${path} to contain ${JSON.stringify(from)}; the template changed and the store-less rewrite needs updating.`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
writeFileSync(path, content.replace(from, to));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function applyNoStoreOverrides(
|
|
73
|
+
outputDir: string,
|
|
74
|
+
template: TemplateName,
|
|
75
|
+
appName: string,
|
|
76
|
+
): void {
|
|
77
|
+
for (const relativePath of NO_STORE_REMOVED_PATHS) {
|
|
78
|
+
rmSync(join(outputDir, relativePath), { recursive: true, force: true });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const isTsx = template !== "vanilla-js" && template !== "phaserjs";
|
|
82
|
+
const ext = isTsx ? "tsx" : "ts";
|
|
83
|
+
writeFileSync(
|
|
84
|
+
join(outputDir, `tile/src/entry.${ext}`),
|
|
85
|
+
noStoreEntryFor(template),
|
|
86
|
+
);
|
|
87
|
+
writeFileSync(
|
|
88
|
+
join(outputDir, `ui/App.${ext}`),
|
|
89
|
+
noStoreAppFor({ template, appName }),
|
|
90
|
+
);
|
|
91
|
+
// Every template ships the Happy DOM test as .tsx (see applyBlankOverrides).
|
|
92
|
+
writeFileSync(
|
|
93
|
+
join(outputDir, "ui/App.test.happydom.tsx"),
|
|
94
|
+
noStoreHappyDomTestFor(template),
|
|
95
|
+
);
|
|
96
|
+
writeFileSync(
|
|
97
|
+
join(outputDir, "CLAUDE.md"),
|
|
98
|
+
NO_STORE_CLAUDE_MD.replaceAll("{{APP_NAME}}", appName),
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// The `test` script named the mutator test; only the Happy DOM test remains.
|
|
102
|
+
const packagePath = join(outputDir, "package.json");
|
|
103
|
+
const pkg = JSON.parse(readFileSync(packagePath, "utf-8")) as {
|
|
104
|
+
scripts?: Record<string, string>;
|
|
105
|
+
};
|
|
106
|
+
if (pkg.scripts === undefined || pkg.scripts["test"] === undefined) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`--no-store: expected a test script in ${packagePath}; the template changed and the store-less rewrite needs updating.`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
pkg.scripts["test"] = NO_STORE_TEST_SCRIPT;
|
|
112
|
+
writeFileSync(packagePath, `${JSON.stringify(pkg, null, "\t")}\n`);
|
|
113
|
+
|
|
114
|
+
// Both the template tsconfig and the internal-mono-repo render list the
|
|
115
|
+
// store directories in the same include line.
|
|
116
|
+
replaceExactly(
|
|
117
|
+
join(outputDir, "tsconfig.json"),
|
|
118
|
+
TSCONFIG_INCLUDE_WITH_STORE,
|
|
119
|
+
TSCONFIG_INCLUDE_NO_STORE,
|
|
120
|
+
"the tsconfig include list",
|
|
121
|
+
);
|
|
122
|
+
// Without a backend entry the poeTile() plugin skips the backend build, so
|
|
123
|
+
// `dist/` carries no synced-store-backend-config artifact.
|
|
124
|
+
replaceExactly(
|
|
125
|
+
join(outputDir, "vite.config.ts"),
|
|
126
|
+
template === "react"
|
|
127
|
+
? REACT_VITE_PLUGINS_WITH_BACKEND
|
|
128
|
+
: VITE_PLUGIN_WITH_BACKEND,
|
|
129
|
+
template === "react"
|
|
130
|
+
? REACT_VITE_PLUGINS_NO_BACKEND
|
|
131
|
+
: VITE_PLUGIN_NO_BACKEND,
|
|
132
|
+
"the poeTile plugin call",
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// owner: jyoung-q
|
|
2
|
+
/**
|
|
3
|
+
* Package.json script helpers for scaffolded Poe apps.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { dirname, join, relative, sep } from "node:path";
|
|
8
|
+
|
|
9
|
+
const PLAYWRIGHT_SCRIPT = "scripts/run-playwright.ts";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wire an in-repo app's type gate the way `scripts/check-package-scripts.ts`
|
|
13
|
+
* requires: `type-check` keeps the command, because that is the name a
|
|
14
|
+
* standalone app carries, and `type-check-local` is what CI's Turbo task runs.
|
|
15
|
+
* A `test*` script may not run the check inline, or it would serialize ahead of
|
|
16
|
+
* the app's tests and share their cache entry.
|
|
17
|
+
*
|
|
18
|
+
* Only in-repo scaffolds get this. A standalone app has no Turbo, so
|
|
19
|
+
* `type-check-local` there would be a name pointing at nothing.
|
|
20
|
+
*/
|
|
21
|
+
export function applyInternalMonoRepoTypeCheckScripts(
|
|
22
|
+
scripts: Record<string, string>,
|
|
23
|
+
): void {
|
|
24
|
+
if (!scripts["type-check"]) return;
|
|
25
|
+
scripts["type-check-local"] = "bun run type-check";
|
|
26
|
+
for (const [name, command] of Object.entries(scripts)) {
|
|
27
|
+
if (!name.startsWith("test")) continue;
|
|
28
|
+
const withoutTypeCheck = command
|
|
29
|
+
.split(" && ")
|
|
30
|
+
.filter((segment) => segment.trim() !== "bun run type-check")
|
|
31
|
+
.join(" && ");
|
|
32
|
+
if (withoutTypeCheck.length > 0) scripts[name] = withoutTypeCheck;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function applyInternalMonoRepoPlaywrightScripts({
|
|
37
|
+
outputDir,
|
|
38
|
+
scripts,
|
|
39
|
+
}: {
|
|
40
|
+
outputDir: string;
|
|
41
|
+
scripts: Record<string, string>;
|
|
42
|
+
}): void {
|
|
43
|
+
const runner = findAncestorPath({
|
|
44
|
+
startDir: dirname(outputDir),
|
|
45
|
+
relativePath: PLAYWRIGHT_SCRIPT,
|
|
46
|
+
});
|
|
47
|
+
if (!runner) return;
|
|
48
|
+
const relativeRunner = relative(outputDir, runner).split(sep).join("/");
|
|
49
|
+
const command = `bun ${relativeRunner}`;
|
|
50
|
+
scripts["test:playwright"] =
|
|
51
|
+
`bun run build && ${command} test --update-snapshots`;
|
|
52
|
+
if (scripts["verify"]) {
|
|
53
|
+
scripts["verify"] = scripts["verify"].replaceAll(
|
|
54
|
+
"bunx playwright",
|
|
55
|
+
command,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function findAncestorPath({
|
|
61
|
+
startDir,
|
|
62
|
+
relativePath,
|
|
63
|
+
}: {
|
|
64
|
+
startDir: string;
|
|
65
|
+
relativePath: string;
|
|
66
|
+
}): string | null {
|
|
67
|
+
const candidate = join(startDir, relativePath);
|
|
68
|
+
if (existsSync(candidate)) return candidate;
|
|
69
|
+
const parent = dirname(startDir);
|
|
70
|
+
if (parent === startDir) return null;
|
|
71
|
+
return findAncestorPath({ startDir: parent, relativePath });
|
|
72
|
+
}
|