fetch the starter template at build time - #432
Merged
Merged
Conversation
The Download button on the example pages builds its zip from mhkeller/layercake-template. Until now a pre-build shell script degit-ed that repo into src/scripts/svelte-app, turned it into static/svelte-app.json and static/deps.json, and all of that was committed, so every build left a diff behind and the checked-in copy was never what deployed. getTemplateFiles.js downloads the template's tarball from GitHub and reads it in memory with node-tar. /svelte-app.json and /deps.json are endpoints that serve the same JSON the script wrote and are prerendered into docs/. They're listed in prerender.entries because no page links to them. Binary template files travel as base64 and are decoded when the zip is built, so the favicon in the zip is a real PNG. Before, it went through a text decode and came out corrupt. The example's files now land in the zip without a `./` in their paths. The vendored folder, the shell script, the generated files, the prebuild and update_template scripts, the degit dependency and the prettier and jsconfig exclusions for the folder are gone.
The download test required a zip over 65 kB. That only held because the template used to ship a package-lock.json, which the template repo has since removed. The test now checks that the template files, the example's page and components, a valid favicon and the layercake pin are in the archive.
mhkeller
marked this pull request as ready for review
September 6, 2026 15:57
Contributor
🎭 Playwright tests failedThe Playwright tests failed on this PR. Please check the test results and fix any issues. |
The landing page's SSR gallery screenshot on Linux differs from its baseline by one pixel since the v10 notice was added above it, on main too. The blur in screenshot.css is meant to absorb that kind of noise. A ten pixel allowance covers what slips through it.
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.
The example pages' Download button builds its zip from layercake-template. Until now a prebuild script degit-ed that repo into
src/scripts/svelte-app, wrotestatic/svelte-app.jsonandstatic/deps.json, and all of it was committed. The site builds on gh actions now, so none of that needs to live in the repo.src/_modules/getTemplateFiles.jsdownloads the template tarball and reads it in memory with node-tar/svelte-app.jsonand/deps.jsonare endpoints, prerendered intodocs/. listed inprerender.entriessince nothing links to themsrc/routes/./_data/...prebuild,update_templateanddegitBuilds need network to reach codeload.github.com.