refactor: decouple publish target into renderMode × host axes - #35
Merged
Merged
Conversation
The publish API conflated "what to build" and "where it's served" in one
`buildMode` enum (ssg/ssr/cloudflare), which doesn't scale to the planned
remote hosts (SSH, Coolify) — each would multiply the enum.
Split the target into two orthogonal axes at the request boundary:
renderMode — "ssg" | "ssr"
host — "local" | "cloudflare" | "coolify" | "ssh"
`POST /publish` now accepts `{ renderMode, host }` and resolves it via
`RENDER_HOSTS` / `normalizeTarget`. The legacy `buildMode` field still
works (ssg→ssg/local, ssr→ssr/local, cloudflare→ssg/cloudflare) so the
upstream `webstudio` npm CLI and older builder images are unaffected.
Planned-but-unimplemented pairs (ssg:ssh, ssr:coolify, ssg:coolify)
answer 501 so the builder can show "coming soon" instead of an error.
`GET /capabilities` gains `coolify`, `ssh` and a `targets` array listing
the `${renderMode}:${host}` pairs this publisher can currently run — the
builder will use it to disable the rest.
No change to the pipeline bodies or the internal `state.json.mode` field.
Groundwork for webstudio-self-host#22 (#7, #23, #24).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HrBZ6qo4r4D2fGPEZqBccz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
POST /publishconflated what to build and where it's served in onebuildModeenum (ssg/ssr/cloudflare). The planned remote hosts (SSH → self-host#7, Coolify SSR/SSG → self-host#23/#24) would each multiply that enum. This is the common groundwork of self-host#22.What
Split the publish target into two orthogonal axes, resolved at the request boundary:
renderModehostssglocalpublishBuildssrlocalpublishBuildSsrssgcloudflarepublishBuildCloudflareCLOUDFLARE_*)ssgssh501(self-host#7)ssrcoolify501(self-host#23)ssgcoolify501(self-host#24)POST /publishaccepts{ renderMode, host }; mapping lives inRENDER_HOSTS/normalizeTarget.buildModestill works —ssg→ssg/local,ssr→ssr/local,cloudflare→ssg/cloudflare. The upstreamwebstudionpm CLI and older builder images are unaffected.GET /capabilitiesgainscoolify,ssh, and atargets: ["ssg:local", …]array of the pairs this publisher can currently run — the builder will use it to disable the rest.Not in this PR
buildSsgOutput()/buildDockerImage()) — deferred to self-host#7 / Cross-repo PR test builds: publisher image tagged per builder PR #23 where it's actually exercised.state.json.modefield is untouched.Test
node --checkpasses; resolver logic smoke-tested. No test infra in this repo — end-to-end validation on the Coolify bench: publish a site SSG → SSR → Cloudflare → SSG on the same domain and confirm each legacybuildModepath is unchanged.🤖 Generated with Claude Code
https://claude.ai/code/session_01HrBZ6qo4r4D2fGPEZqBccz