-
Notifications
You must be signed in to change notification settings - Fork 17
RFC: introduce volta list and deprecate volta current
#34
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
Conversation
text/0000-informational-commands.md
Outdated
| ```sh | ||
| $ volta list | ||
| runtime node@v10.15.3 (default) | ||
| packager yarn@v1.12.3 (default) |
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'm unsure what we should actually output here: if the user has install-ed Yarn, presumably we should print it. Should we also always print the built-in npm? I currently lean toward yes; that would then extend to the human format as well. Thoughts?
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 printing the built-in npm is a good idea, along with what that version is
03237ad to
751a726
Compare
- identify whether the item is a runtime, a packager, or a tool - update the list to match the example user configuration
- use the correct invocation for plain, `--print=plain` - show both bare subcommand and `--all` for plain output
Co-Authored-By: Robert Jackson <me@rwjblue.com>
mikrostew
left a comment
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.
Awesome! Just a few comments on things I saw reading through this RFC.
(also, great use of <details> 😄 )
| - to runtimes: `volta list node` | ||
| - to packagers: `volta list yarn` (and, when custom installations of `npm` are supported, `volta list npm`) | ||
| - to a specific package: `volta list <package name>` | ||
| - to a specific tool: `volta list <tool name>` |
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.
These two options don't match the format below in "Details", which is:
volta list package <package>
volta list tool <tool>
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.
Ah, good catch. Updated for consistency, though depending on how we sort out the related question I may have to update it the other direction. 😆
text/0000-informational-commands.md
Outdated
| ```sh | ||
| $ volta list | ||
| runtime node@v10.15.3 (default) | ||
| packager yarn@v1.12.3 (default) |
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 printing the built-in npm is a good idea, along with what that version is
text/0000-informational-commands.md
Outdated
| For the TypeScript config specified in the canonical example: | ||
|
|
||
| ```sh | ||
| volta list package typescript --human |
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.
Slight discrepancy here between volta list <package> and volta list package typescript.
This will probably need to be volta list package <package> and volta list tool <tool> to be able to disambiguate when packages and tools have the same names (like the create-react-app example).
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 actually the reason why I had volta list package <package> and volta list tool <tool> in an earlier draft of the RFC. I'm back-and-forth on it, because in the case you identified, it's the same output either way. In a case where there's more than one binary, but one does match the package name, I don't think it harms anything to default to the package in that case? 🤔 But I'm very willing to be persuaded here—I just found myself leaning slightly in the direction of brevity!
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.
After thinking about this more, I like the volta list <package-or-tool> approach, where it defaults to the package. It's more compact to type, and in cases where the binary and the package are the same name, you get more information.
|
|
||
| - all available package binaries? | ||
| - a subset of package binaries once the number crosses a threshold, with instructions about how to see all? | ||
| - no package binaries? |
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.
Currently the only way to create a shim for a binary is to use volta install <package>, which installs the package and shims any of the installed binaries. Then the shim will intercept any invocation inside of a project to detect if it is a package binary.
Since this is already displaying the available binaries (from installed packages), the available package binaries will be a subset of that, and could probably be displayed with some indication that they are coming from the current project.
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 plus your suggestion below make a ton of sense to me; I'll update the design accordingly and at least the initial implementation will work that way.
| - a subset of package binaries once the number crosses a threshold, with instructions about how to see all? | ||
| - no package binaries? | ||
|
|
||
| And how should that be presented in `plain` vs. `human` mode? Should there be any differences between `plain` and `human` for the bare command (as in the current design)? |
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.
My first thought at this would be the addition of a single line (if for instance the project uses ember):
$ volta list --human
⚡️ Currently active tools:
Node: v8.16.0 (current @ ~/node-only/package.json)
Yarn: v1.12.3 (default)
Tool binaries available:
create-react-app, tsc, tsserver
ember (current @ ~/node-only/package.json)
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 like that design a lot. Should the previous line then include (defaults) to distinguish 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.
I think having (defaults) for the first is a great idea to make the distinction obvious
charlespierce
left a comment
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 awesome and incredibly detailed! I don't have any substantive comments on the command itself, just a few comments around the edges.
|
|
||
| ## Use another command name | ||
|
|
||
| As noted in [**Why `list`?**][why-list], options for this subcommand name include `list`, `ls`, `tools`, `toolchain`, `info`, and `current`. (For discussion of shorthands, see the next section.) Given the considerable [prior art][prior-art] using `list`, however, it seems the best option in terms of what users will expect. |
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 like the idea (first mentioned in Discord I believe) of having ls be a full alias of list, just for ergonomic reasons. It doesn't have to be documented or shown anywhere, just as a bonus for usability & potential discoverability of the command.
|
|
||
| ## Deprecating `volta current` | ||
|
|
||
| Since `volta list` subsumes (and substantially extends upon) the functionality of `volta current`, `volta current` should be deprecated when `volta list` is implemented. The deprecation should include a warning that the command will be removed in a future version and information about how to use `volta list --current <tool>` as a replacement. |
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 like this approach a lot, it allows us to introduce the command and the deprecation warning without a breaking change, and then the next time we have a breaking change we can take that opportunity to remove the current command (that I suspect no one is using anyway given its limited functionality).
| - Should the command accept flags to narrow the search instead of a positional argument, e.g. `volta list --node`, `volta list --yarn`, `volta list --package=typescript`, etc.? | ||
|
|
||
| - How should the built-in version of `npm` be displayed to the user? Options include: | ||
| - associated with the runtime it ships with, e.g. `v12.2.0 (with npm v6.4.1)` |
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 how we currently show it when you run e.g. volta install node, so if possible it would be good to align with that. Also, until we implement the volta install npm logic, listing npm as a separate packager seems like it has the potential for confusion, implying that the user can manage npm themselves.
04a3e33 to
b629a9a
Compare
b629a9a to
0dba88c
Compare
- Go back to using `(default|current @ <path>|fetched)` as the design for indicating the origin of a given item, but with the simplifications made for packages in the previous commit. - Add an example for local package overrides.
cf0d266 to
a38c96a
Compare
|
Now that volta-cli/volta#461, volta-cli/volta#701, and volta-cli/volta#697 have landed, is this RFC ready to be merged? Should we wait for volta-cli/volta#659? |
|
I think this is quite ready to merge. We may continue to add more output formats and to iterate on the design as we find pain points, but the RFC has served its purpose and is fully implemented given our existing constraints from where I stand! |
Rendered RFC text. See earlier discussion at volta-cli/volta#349.