Unverified Commit 2c752da3 authored by Will Binns-Smith's avatar Will Binns-Smith Committed by GitHub

devlow: use commander for cli argument parsing (#93860)

This has devlow use `commander` to parse its arguments.

There's a breaking change here to make it fit better into `commander`'s
patterns without extra code. It also makes things more explicit:

Arbitrary variant filtering can no longer be done with
`--variantname=value`. Now that there are more flags, these share the
namespace with these, so instead we use `--filter variantname=value`, or
`-F variantname=value`.
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarWill Binns-Smith <755844+wbinnssmith@users.noreply.github.com>
parent adba1e3f
...@@ -381,12 +381,12 @@ jobs: ...@@ -381,12 +381,12 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
mode: mode:
- '--turbopack=false' - '-F turbopack=false'
- '--turbopack=true' - '-F turbopack=true'
selector: selector:
- '--scenario=heavy-npm-deps-dev --page=homepage' - '--scenario=heavy-npm-deps-dev -F page=homepage'
- '--scenario=heavy-npm-deps-build --page=homepage' - '--scenario=heavy-npm-deps-build -F page=homepage'
- '--scenario=heavy-npm-deps-build-turbo-cache-enabled --page=homepage' - '--scenario=heavy-npm-deps-build-turbo-cache-enabled -F page=homepage'
permissions: permissions:
contents: read contents: read
id-token: write id-token: write
......
...@@ -10,19 +10,36 @@ npm install devlow-bench ...@@ -10,19 +10,36 @@ npm install devlow-bench
## Usage ## Usage
```bash ```text
Usage: devlow-bench [options] <scenario files> Usage: devlow-bench [options] [command]
## Selecting scenarios
--scenario=<filter>, -s=<filter> Only run the scenario with the given name Run developer-workflow benchmarks.
--interactive, -i Select scenarios and variants interactively
--<prop>=<value> Filter by any variant property defined in scenarios Options:
## Output -h, --help display help for command
--json=<path>, -j=<path> Write the results to the given path as JSON
--console Print the results to the console Commands:
--datadog[=<hostname>] Upload the results to Datadog run [options] [scenarios...] Run scenario files and report measurements.
(requires DATADOG_API_KEY environment variables) compare <baseline> <current> Compare two snapshot CSVs side-by-side.
## Help help [command] display help for command
--help, -h, -? Show this help ```
`run` is the default command, so scenario paths can still be passed without
writing `run` explicitly. Its options include:
```text
-s, --scenario <filter> Only run scenarios whose name matches the filter (repeatable).
-F, --filter <pair> Filter variants by property: key=value (repeatable).
-i, --interactive Select scenarios and variants interactively.
--n <number> Run each variant N times.
--warmup <number> Discard the first N runs before sampling.
--snapshot <path> Override the snapshot CSV path.
--compare Print a comparison table after the run.
--baseline <path> Select a comparison baseline; implies --compare.
-j, --json <path> Write results as JSON.
--no-console Suppress console output.
--datadog [host] Upload results to Datadog.
--snowflake [batchUri] Upload results to Snowflake.
``` ```
## Scenarios ## Scenarios
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
}, },
"dependencies": { "dependencies": {
"@datadog/datadog-api-client": "^1.13.0", "@datadog/datadog-api-client": "^1.13.0",
"commander": "^14.0.3",
"inquirer": "^9.2.7", "inquirer": "^9.2.7",
"jstat": "^1.9.6", "jstat": "^1.9.6",
"minimist": "^1.2.8", "minimist": "^1.2.8",
......
This diff is collapsed.
...@@ -980,6 +980,9 @@ importers: ...@@ -980,6 +980,9 @@ importers:
'@datadog/datadog-api-client': '@datadog/datadog-api-client':
specifier: ^1.13.0 specifier: ^1.13.0
version: 1.25.0(encoding@0.1.13) version: 1.25.0(encoding@0.1.13)
commander:
specifier: ^14.0.3
version: 14.0.3
inquirer: inquirer:
specifier: ^9.2.7 specifier: ^9.2.7
version: 9.2.23 version: 9.2.23
...@@ -9093,6 +9096,10 @@ packages: ...@@ -9093,6 +9096,10 @@ packages:
resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==} resolution: {integrity: sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==}
engines: {node: '>=18'} engines: {node: '>=18'}
commander@14.0.3:
resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==}
engines: {node: '>=20'}
commander@2.20.0: commander@2.20.0:
resolution: {integrity: sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==} resolution: {integrity: sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==}
...@@ -26665,6 +26672,8 @@ snapshots: ...@@ -26665,6 +26672,8 @@ snapshots:
commander@12.1.0: {} commander@12.1.0: {}
commander@14.0.3: {}
commander@2.20.0: {} commander@2.20.0: {}
commander@3.0.2: {} commander@3.0.2: {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment