Repository navigation
feat: perfkit render --config writes a site with no runs, and data/site.json - #22
Merged
Merged
Conversation
…te.json perfkit render --config <perfkit.yaml> --out <dir> (no --report) writes the app, an empty data/runs.json (or the --history as it is), a new data/site.json (schema perfkit/site/v1: the project with its inlined logo, favicon and live URL) and the shells. Every render with --report also writes data/site.json from the report's project. The app draws a no-runs page from data/site.json when data/runs.json is empty, and resolves the live URL as ?live=, then data/site.json, then the latest report, so a project can publish its site and show a run in progress live before its first published run.
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
perfkit renderrequired--report, and the app learned the live URL only from the latest report. A project could not publish its benchmarks site before its first published run, and the site could not show a run in progress until then. Routr wants to clear its old site now and have routr.io/benchmarks show live runs right away.What
perfkit render --config <perfkit.yaml> --out <dir> [--history <file|url>], with no--report: writesapp/<version>/app.js,data/runs.json(empty without--history, else the history as it is; runs.json v1 already allows zero runs), the newdata/site.jsonand the shells (index.html, plus one per run in a given history).--reportand--configtogether, or neither, is a usage error (exit 1).data/site.json,schema: perfkit/site/v1(ZodsiteSchema, JSON Schemaschemas/site-v1.schema.json):{ schema, project }, whereprojectis report.json's project shape: name, repo, siteUrl, accent, logoSvg/faviconSvg (inlined from the config's files), title, lead, live.url. The live URL resolves as it does for reports (project.live.url, elselive.url, elsehttps://<live.domain>/live.json). That logic now lives inprojectFromConfig, whichtoReportProjectuses too.render --reportalso writesdata/site.jsonfrom the report's project on every render.data/runs.jsonis empty, the latest page is drawn fromdata/site.json. It shows the nav brand, eyebrow, title, lead, "No published runs yet. When a run is in progress it appears here live." and the footer, in the existing page styles. The live URL is?live=, thendata/site.json, then the latest report. The page polls it from the site root as before.renderline list now includesdata/site.json (...). The Contract test was updated for that line.Compatibility
--reportis no longer a required option at the commander level, but a render without it (and without--config) still exits 1.data/site.jsonkeep working: the app falls back to the latest report's live URL.Verify
npm test: 660 passing.npm run typecheckandnpm run lintare clean. New tests: config-only render (lines, empty runs.json, site.json, history kept, invalid config, both/neither flags), the no-runs draw (fromsite.json, and an invalidsite.json),siteSchema,projectFromConfiglive URL order, theresolveLiveUrlorder,createReadSiteLiveUrl, and a jsdom run of the real bundle on a config-only site.examples/minimal/perfkit.yamlwith--configand served it withperfkit serve. The no-runs page drew with no console errors and no horizontal scroll at 375px. With alive.urlin the config, the page fetcheddata/site.jsonand then polled that live.json.🤖 Generated with Claude Code