-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve help
output UX and DX
#10090
Conversation
🦋 Changeset detectedLatest commit: 2f14f96 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The algorithm now intelligently wraps the description for each option based on terminal width. Thanks @cb1kenobi for the idea! |
packages/cli/src/commands/help.ts
Outdated
} | ||
|
||
export function buildCommandOptionLines(command: Command) { | ||
const MAX_LINE_LENGTH = process.stdout.columns; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be client.stderr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good callout. Noticed that the client types don't use tty.WriteStream
, so I change that. Not sure if you did that intentionally or if you just didn't know that type existed. This is the type that process.stderr
uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya we should probably use that type then.
## @vercel/build-utils@6.8.1 ### Patch Changes - Revert "[build-utils] Allow file-ref sema to be controlled through env flag" ([#10167](#10167)) ## vercel@31.0.2 ### Patch Changes - Allow additional project settings in `createProject()` ([#10172](#10172)) - Run local Project detection during `vc link --repo`. ([#10094](#10094)) This allows for creation of new Projects that do not yet exist under the selected scope. - Redeploy command no longer redeploys preview deployments to production ([#10186](#10186)) - Added trailing new line at end of help output ([#10170](#10170)) - Create new help output and arg parsing for deploy command ([#10090](#10090)) - [cli] Remove `preinstall` script ([#10157](#10157)) - Updated dependencies \[[`7021279b2`](7021279), [`5e5332fbc`](5e5332f), [`027bce00b`](027bce0)]: - @vercel/build-utils@6.8.1 - @vercel/node@2.15.4 - @vercel/remix-builder@1.8.16 - @vercel/static-build@1.3.39 ## @vercel/client@12.6.4 ### Patch Changes - Updated dependencies \[[`7021279b2`](7021279)]: - @vercel/build-utils@6.8.1 ## @vercel/gatsby-plugin-vercel-builder@1.3.12 ### Patch Changes - Updated dependencies \[[`7021279b2`](7021279), [`5e5332fbc`](5e5332f)]: - @vercel/build-utils@6.8.1 - @vercel/node@2.15.4 ## @vercel/node@2.15.4 ### Patch Changes - [node] fix decompress mismatching ([#10184](#10184)) - Updated dependencies \[[`7021279b2`](7021279)]: - @vercel/build-utils@6.8.1 ## @vercel/remix-builder@1.8.16 ### Patch Changes - Update `@remix-run/dev` fork to v1.18.1 ([#10180](#10180)) - Updated dependencies \[[`7021279b2`](7021279)]: - @vercel/build-utils@6.8.1 ## @vercel/static-build@1.3.39 ### Patch Changes - Updated dependencies \[]: - @vercel/gatsby-plugin-vercel-builder@1.3.12 ## @vercel-internals/constants@1.0.4 ### Patch Changes - Create new help output and arg parsing for deploy command ([#10090](#10090)) ## @vercel-internals/types@1.0.4 ### Patch Changes - Updated dependencies \[[`7021279b2`](7021279), [`718bbd365`](718bbd3)]: - @vercel/build-utils@6.8.1 - @vercel-internals/constants@1.0.4 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Followup PR to #10090. Some of our commands duplicate global options into their `args` structure e.g. https://github.com/vercel/vercel/blob/2661f56347d5c32de369a6cea74bc9fb46d565a2/packages/cli/src/commands/logs.ts#L25-L26 Others commands omit it entirely. This updates the `--help` output for commands migrated to our new structure (so far, only `deploy`) will show a "Global Options" section: ``` ▲ vercel deploy [project-path] [options] Deploy your project to Vercel. The `deploy` command is the default command for the Vercel CLI, and can be omitted (`vc deploy my-app` equals `vc my-app`). Options --archive Compress the deployment code into a file before uploading it -b, --build-env <key=value> Specify environment variables during build-time (e.g. `-b KEY1=value1 -b KEY2=value2`) -e, --env <key=value> Specify environment variables during run-time (e.g. `-e KEY1=value1 -e KEY2=value2`) -f, --force Force a new deployment even if nothing has changed -m, --meta <key=value> Specify metadata for the deployment (e.g. `-m KEY1=value1 -m KEY2=value2`) --no-wait Don't wait for the deployment to finish --prebuilt Use in combination with `vc build`. Deploy an existing build --prod Create a production deployment -p, --public Deployment is public (`/_src`) is exposed) --regions Set default regions to enable the deployment on --with-cache Retain build cache when using "--force" -y, --yes Use default options to skip all prompts Global Options --cwd <DIR> Sets the current working directory for a single run of a command -d, --debug Debug mode (default off) -Q, --global-config <DIR> Path to the global ${'`.vercel`'} directory -h, --help Output usage information -A, --local-config <FILE> Path to the local `vercel.json` file --no-color No color mode (default off) -S, --scope Set a custom scope -t, --token <TOKEN> Login token -v, --version Output the version number ``` As commands are migrated to this new structure, they'll gain this output automatically.
Migrating `remove` to the command structure created in #10090. Unsure about tests. This is technically a refactor so existing tests should suffice.
Migrating `bisect` to the command structure created in #10090. Unsure about tests. This is technically a refactor so existing tests should suffice. Before: <img width="534" alt="CleanShot 2023-07-31 at 08 14 29@2x" src="https://github.com/vercel/vercel/assets/9736/8ae53672-9b1f-444a-94d3-296ac0fa8d30"> After: <img width="674" alt="CleanShot 2023-07-31 at 08 15 02@2x" src="https://github.com/vercel/vercel/assets/9736/0ba12f19-fb34-41f3-84fb-0c1498d7a485">
Migrating `whoami` to the command structure created in #10090. Unsure about tests. This is technically a refactor so existing tests should suffice.
This reverts commit deebabe.
This PR adds a new utility for generating
help
output for CLI commands. Backed by a JSON data structure that represents the commands, this utility uses deterministic functions for generating the different output sections (such asoptions
andexamples
). This change will let contributor easily add/modify command details. The data structure is also used by the CLI to generate the args parsing structure for thedeploy
command. Optimistically, this same data structure can be used to generate documentation output forfront
such that the online docs will match thehelp
output.