Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Adds a headless CLI that runs curated WebPerf Snippets via Playwright, enabling Core Web Vitals diagnosis and CI budget gating without manual DevTools copy-paste. - npx webperf-snippets <url> runs LCP + CLS with human-readable output - --json, --snippet, --budget-lcp/cls, --headed, --wait flags - Decision tree: LCP > 2.5s auto-enqueues LCP-Sub-Parts - Runner shims performance.getEntriesByType for LCP/layout-shift entries (Chrome does not expose these via the API without a buffered observer) - Zero non-peer deps, requires Node >= 20.12, Playwright as peer dep - Root package renamed to webperf-snippets-docs; workspace added at cli/
Replace the hardcoded desktop viewport with named presets (mobile, tablet, desktop). Mobile (375×812) is now the default, matching real-world usage. The --viewport flag lets callers select a preset from the CLI.
Add Vitest as dev dependency with three test layers: - Unit tests for decision-tree, reporters (JSON and human), and viewport presets - E2E tests using Playwright against a local HTTP server to verify LCP and CLS snippets return valid results on a real browser session
Publish to npm on cli-v* tags via publish-cli.yml. The workflow runs the full test suite (unit + E2E) before publishing. Access is controlled via GitHub tag protection rules on the cli-v* pattern.
Adds --snippet fonts as a short alias for the Fonts-Preloaded-Loaded-and-used-above-the-fold snippet. Reporter now shows loaded fonts table (with font-display warnings for block/auto) and used-above-fold table, matching the detail level of the browser console output.
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.
Summary
webperf-snippets-docs(private, no external impact);cli/added as npm workspace withname: webperf-snippets.Available snippets
LCPCLSLCP-SubpartsfontsThe default workflow runs
LCP+CLSand auto-enqueuesLCP-Subpartsif LCP exceeds 2.5s.What it does
Key implementation detail
Chrome does not expose
largest-contentful-paintorlayout-shiftentries viaperformance.getEntriesByType()without a buffered observer running before the entries are emitted. The runner installs anaddInitScriptshim before navigation that captures entries via observers and patchesgetEntriesByTypeso existing snippets work unmodified.This is also a real bug in the snippets'
// Synchronous return for agentpaths — tracked and fixed in a separate PR.Files added
cli/package.jsoncli/src/bin.jsutil.parseArgs, exit codes 0/1/2cli/src/runner.jscli/src/load-snippet.jscli/src/workflows/cwv.jscli/src/decision-tree.jscli/src/reporters/human.jsutil.styleTextcli/src/reporters/json.jscli/README.mdTest plan
node cli/src/bin.js --helpprints usagenode cli/src/bin.js https://web.devreturns green LCP + CLS with element infonode cli/src/bin.js https://web.dev --jsonreturns valid JSON with all fieldsnode cli/src/bin.js https://web.dev --snippet LCP-Subpartsshows sub-part breakdownnode cli/src/bin.js https://web.dev --snippet fontsshows loaded/used-above-fold font tablesnode cli/src/bin.js https://web.dev --budget-lcp 100exits 1 with violation on stderr