Repository navigation
chore(scripts): pnpm size:pages --help prints its usage - #11840
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Changes requested: --help works, but it does not yet come before every other argument check, as the description says.
pnpm size:pages --fast --help, or a typo such aspnpm size:pages --base main --fsat --help, still exits 1 withUnknown argument: …and no usage, becauseparseArgsreturns for help only when its loop reaches the flag (scripts/measure-reference-pages.mjs:330); checkargvfor--helpand-hbefore the loop and add a test for['--fast', '--help'], or narrow the description and the test name to say help applies when it comes before any unknown argument.
Everything else checks out: the usage matches the record's four reference pages and its 307 B limit, the measurement path is untouched, and the script's 11 tests pass.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
--helpand-hprint the usage and exit 0: verified (scripts/measure-reference-pages.mjs:330,:349-352; both commands exit 0 on this head).- Help is handled before any other argument check: false; an unknown argument before the flag is still refused (
scripts/measure-reference-pages.mjs:328-339). - The usage covers every flag, including
--unused-on <pages>: verified (:305-314). - The usage says the numbers are first-load minified and gzip bytes per reference page, base against head: verified (
:299-301). - The usage gives the limit as 0.3 KB gzip, 307 B: verified (
:39,:310), matching the record's 1,024-byte KB. - The usage includes an example run: verified (
:316-317). - The same text replaces the message for a missing
--base: verified (:341-343; the usage goes to stderr with exit 1). - Before the change,
--helpfailed with "Unknown argument: --help" and exit 1: verified on the base. - No package source changes, and the measurement path is untouched: verified (the diff touches only
USAGE,parseArgsand the help branch inmain). - No CI impact and no workflow changes: verified.
- The test file's 11 tests pass, including the two new ones: verified (11 passed).
- No public API, product behavior, visual or policy change, and no internal context: verified.
Files:
scripts/measure-reference-pages.mjs: finding (help after an unknown argument).scripts/measure-reference-pages.test.mjs: the new help test covers only arguments after-h; part of the same finding.
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet because it skips draft pull requests, so it runs once the pull request is marked ready for review.
The earlier finding is fixed: --help and -h now win wherever they appear (scripts/measure-reference-pages.mjs:328-330), and the new expectations pin both orders (scripts/measure-reference-pages.test.mjs:157-158). The usage matches the record's four reference pages and its 307 B limit, and the measurement path is untouched.
Claims and files checked
Review mode: incremental; reason: none
Claims:
--helpand-hprint the usage and exit 0, before any other argument check: verified (scripts/measure-reference-pages.mjs:328-330,:351-354;--fast --helpand--base main --fsat --helpexit 0 on this head).- The usage covers every flag, including
--unused-on <pages>: verified (:306-314against the parser at:333-341). - The usage says the numbers are first-load minified and gzip bytes of each reference page, base against head: verified (
:299-301). - The usage gives the limit as 0.3 KB gzip, 307 B: verified (
:39,:310), matching the record's 1,024-byte KB. - The usage includes an example run: verified (
:316-317). - The same text replaces the message for a missing
--base: verified (:343-345; the usage goes to stderr with exit 1). - Before the change,
--helpprinted "Unknown argument: --help" and exited 1: verified on the base. - After the change,
--helpand-hprint the usage and exit 0: verified on this head. - The measurement runs exactly as before, no package source changes, and only the help flags are new besides the missing-
--basetext: verified (the diff touches onlyUSAGE,parseArgsand the help branch inmain). - No CI impact and no workflow changes: verified (only two files under
scripts/change). - No public API, product behavior, visual or policy change, and no internal context in public text: verified.
- The test file's 11 tests pass, and the new ones check help ahead of any other argument and the usage's flags, limit and example: verified (11 passed;
scripts/measure-reference-pages.test.mjs:154-175).
Files:
scripts/measure-reference-pages.mjs: clear.scripts/measure-reference-pages.test.mjs: clear; it pins both help orders and the usage text.
Maintainer impact
pnpm size:pages --helpfailed with "Unknown argument: --help". Someone checking INV10's numbers had to read the script to learn its flags, what the numbers mean, and which limit--unused-onchecks.Intended invariant
pnpm size:pagesmeasures INV10's reference pages exactly as before. Only--helpand-hare new.Change
--helpand-hprint the usage and exit 0, before any other argument check.--unused-on <pages>;--baseis missing.Evidence
pnpm size:pages --helpprinted "Unknown argument: --help" and exited 1.pnpm size:pages --helpandpnpm size:pages -hprint the usage and exit 0.Scope
Components: none (repository script and its test)
Testing
vitest run --project node scripts/measure-reference-pages.test.mjs: 11 tests pass. The two new ones check that--helpand-hask for help ahead of any other argument, and that the usage names every flag, the 307 B limit and the example.pnpm size:pages -h: prints the usage, exits 0.