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

A new field in dependenciesMeta - linkBin #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions accepted/0000-link-bin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
- Start Date: 2019-07-30
- RFC PR: (leave this empty)
- Yarn Issue: (leave this empty)

# Summary

The new `dependenciesMeta[dependency name].linkBin` field allows to prevent a dependency from
linking its bin files to `node_modules/.bin`.

# Motivation

Sometimes several dependencies are exporting bin files that have the same name.
For instance, both `gulp` and `gulp-cli` implement the `gulp` command.
Which dependency's command should be linked into `node_modules/.bin`?
There is currently no way to choose which dependency's command will be linked,
when there's a conflict.

# Detailed design

Yarn already has a `dependenciesMeta` field. We can add a new field called `linkBin`.
When `linkBin` will be `false`, the dependency's commands will be not linked.
For instance:

```json
{
"dependencies": {
"gulp": "4.0.0",
"gulp-cli": "2.2.0"
},
"dependenciesMeta": {
"gulp": {
"linkBin": false
}
}
}
```

# How We Teach This

During a bin name conflict, Yarn may print a warning and suggest users to
declare a dependenciesMeta field with `linkBin: false` for one of the conflicting dependencies.

# Drawbacks

# Alternatives

# Unresolved questions

The suggested solution might be not flexible enough.

Should it be possible to disable specific commands only?
Should it be possible to rename commands?