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
src: reserve node run
command
#52267
Conversation
Review requested:
|
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.
LGTM!
@anonrig Non blocking proposal: do you think you can generalize this to work on a list of commands so that in the future similar PRs will be way faster?
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.
lgtm
@ShogunPanda I can follow up. Do you have a list in mind? |
To be honest no. |
|
@GeoffreyBooth maybe node watch? |
maybe |
cc @tniessen please review. |
I thought that #52190 had already been merged
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.
For the same reason explained in #52190 (review): subcommands are great, but we shouldn't add one in a breaking manner without having discussed a strategy for subcommands in a much more general setting. Accepting positional arguments and subcommands in the same position is an anti-pattern, and we shouldn't make an ad-hoc decision for any specific subcommand. (On a side note, as explained elsewhere, node run
is much more likely to break things than node inspect
was seven years ago.)
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 not blocking but I also agree with @tniessen that we should discuss a little bit more about how we want to introduce the subcommand since is a breaking change and also a paradigm shift from "flags by default".
I also agree with @ShogunPanda, instead of introducing a breaking change every time we want to move a flag to a subcommand, we can think of possible subcommand (even if we didn't implement it in the future, like bench
, compile
, etc...) and then introduce all of them at once.
Maybe we also could include a cli flag
or an environment variable to disable the subcommand, this could be useful for cloud environments to keep the old behavior without the fear of having to remember/know all the subcommand that we want to introduce in the future, for them, subcommand could be dangerous.
But in general, I'm very happy to see subcommand being introduced, this is a huge DX improvement!
this is great for sure, but agree with @tniessen for having a strategy around subcommands before proceeding? |
All that this PR does is add a placeholder that errors; is this really “adding” a subcommand? I agree it would be good to discuss and come up with an overall design for subcommands before we go forth and add them, but is all of that necessary just before creating the placeholder stub? It would be nice to not have to wait until 23 to land subcommands, if that’s what we decide to do (and we can always remove the stub at any time, in 22.x or 23). |
It breaks existing applications and introduces an unforeseen edge case to the CLI, regardless of what the subcommand does. |
But it's a semver major change, that's the point? And the remediation is to just add a file extension, so it's not a hard break. The error message should perhaps suggest running as I don't think we should shy away from breaking changes even in a major release, especially when users can mitigate so easily. |
I don't think the point of semver-major releases is to arbitrarily break things. Also, breakage aside, I still believe that mixing subcommands and positional arguments is an anti-pattern and that we need a proper strategy for doing so.
I do think we should shy away from making ad hoc design decisions leading to breaking changes to our CLI, especially because users rely on it so heavily. |
We might need a proper strategy, I agree on that.
Heavily? Do you have any poll or number on thing? I'm genuinely curious. I trust you on the numbers so accept them. But, despite of that, we have rationale for that change as people proposed this might open for future subcommand. And, to be honest, subcommands in CLI app is definitely not an antipattern and widely used. We can't stagnate development and innovation because users might like the old DX, especially since there is an easy way to migrate. I strongly pro this. |
After writing the message above I just thought a thing that might be a good compromise. Let's say the user runs
This way we can start reserving the behavior for user that want to use subcommands and, at the same time, not interfere with current users behavior and start warn them to migrate away. What do you folks thing about it? |
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 this should go through a deprecation cycle.
I think we wrote at the same time. Do you mean the original idea or my proposal? |
I think moving away from automatically inferring extensions would be a good thing. |
I mean any change to how |
It doesn't have to be extension-less. |
I meant the established CLI conventions in general, i.e., I assume that the vast majority of users is relying on the fact that No, I do not have any poll for how many users use the Node.js CLI. |
I think starting with a warning is a good idea (note that warning is also semver-major).
I think we are mostly guessing how users use the CLI here, and it's difficult to estimate the breakage without a warning. If it turned out that there were use cases we didn't anticipate and couldn't fix, reverting a warning would be a lot easier than reverting an actual breaking change. |
If the objection is to (Similar to |
I think we should have a discussion in the TSC about subcommands in general. |
Yes, I believe that's what @joyeecheung proposed in an earlier PR.
Precisely. Subcommands are a great way to reduce the number of "global" CLI options, but I've definitely relied on |
This pull-request reserves
node run
command.cc @nodejs/tsc