Skip to content
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

Fallback to kebab-case command #357

Closed
wants to merge 3 commits into from
Closed

Fallback to kebab-case command #357

wants to merge 3 commits into from

Conversation

Yash-Singh1
Copy link
Contributor

See preview


## Detailed Explanation

Let's say that `npm my-command` is run. Then `npm` should first see if their is a builtin command called `my-command`. If not then it will look through the path for `npm-my-command`. If that fails, then the current fallback will be run:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the advantage of using npm-my-command? is this a convention that's used (besides perhaps git)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't completely understand your question. If you were asking why I chose my-command, that was just an example. If you meant why custom commands should be a thing: Creating custom npm command will allow developers to "extend" npm with more CLI features for users.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing that would make "npm adds a new top-level command" a breaking change, and would also make npm's interface different on a per-package basis.

accepted/0000-fallback-kebab-case-command.md Outdated Show resolved Hide resolved
@isaacs
Copy link
Contributor

isaacs commented Apr 20, 2021

Doesn't this have all the same problems that killed the --default-command proposal?

@darcyclarke
Copy link
Contributor

@isaacs yes; It's the same non-deterministic approach we've discussed at length previously & I believe the general consensus, & our team's own feelings, were that we don't want to move forward with any kind of fallback support for top-level commands. This type of implementation can cause confusion between developers (ex. docs/how-tos get written with customized/nuanced commands that aren't supported out-of-the-box) & clobbers the namespace, hampering our future development

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants