-
Notifications
You must be signed in to change notification settings - Fork 99
feat(cli): add tab completions #1082
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
base: main
Are you sure you want to change the base?
Conversation
π¦ Bundle Size Comparisonπ nuxi
β‘οΈ nuxt-cli
β‘οΈ create-nuxt
|
commit: |
CodSpeed Performance ReportMerging #1082 will not alter performanceComparing Summary
|
3fab8fe
to
911f4b4
Compare
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.
this is looking very, very exciting!
packages/nuxi/src/completions.ts
Outdated
complete('node-server', 'Node.js server') | ||
complete('static', 'Static hosting') | ||
complete('cloudflare-pages', 'Cloudflare Pages') | ||
complete('vercel', 'Vercel') | ||
complete('netlify', 'Netlify') | ||
complete('aws-lambda', 'AWS Lambda') | ||
complete('azure', 'Azure') | ||
complete('firebase', 'Firebase') | ||
complete('deno-deploy', 'Deno Deploy') | ||
complete('bun', 'Bun runtime') |
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.
we have a very long list of possible providers here:
I wonder if it's possible to use nitropack at build time to get this list rather than hard code any of them?
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.
hmm.. are there any approaches you prefer? I thought of fetching from the url (https://nitro.build/deploy) and extracting the names of the providers, but the CLI preset names don't always match the provider names directly. for example, the docs page says βCloudflareβ but the actual valid presets are: "cloudflare-pages" and "cloudflare-workers" (not just cloudflare)
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.
It would be great if there is a json or a file where we can get the full internal preset keys
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.
I think we can import from nitropack directly
packages/nuxi/src/completions.ts
Outdated
complete('v3', 'Nuxt 3 template') | ||
complete('v4', 'Nuxt 4 template') |
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.
our first-party templates are available at https://github.com/nuxt/starter/tree/templates/templates.
again, do you think maybe we could grab data from these at build-time?
b605055
to
81e36cf
Compare
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.
@danielroe I made some changes.. I imported the presets internally from the nitro package and fetched the templates from the starter repo. It's working, but it feels like a lot of overhead just for completion values... Not sure if that is overkill, but that is just my impression.
π Linked issue
β Type of change
π Description
This PR introduces tab completion functionality for the nuxt cli, improving developer experience by allowing shell(zsh, powershell, fish, bash) autocompletion for commands, options, values, and flags. With this PR, users can navigate available commands, options and values more efficiently and faster with speeding up workflow.
A small video of how this works:
nuxi.mp4
A small documentation of how CLIs can integrate tab ( in this case, I'm using the citty adapter )