quaertym / ember-cli-dependency-checker

Ember CLI addon for checking missing node and bower dependencies before running ember commands
MIT License
40 stars 37 forks source link

Idea: fail build if peerDep is missing? #96

Open samselikoff opened 5 years ago

samselikoff commented 5 years ago

👋 Hey there! I wanted to open an issue to discuss adding peerDependencies support to ember-cli-dependency-checker.

I've gone around a few times with folks like @ef4 and @Turbo87 about the best way for addons to specify their dependencies. It seems peerDependencies is semantically often what we want, but it's currently not really used or enforced by existing tooling.

If ember-cli-dependency-checker failed builds if a peer dependency were missing, it would encourage addon authors to start using them more, and might make everyone's lives a little easier.

What do you think? Has there been priori discussion around this? I'm just learning about these issues, but often get recommended to consider using peerDependencies even though it's not currently enforced anywhere. If this addon supported it, I think myself and others would be more incentivized to use it.

Turbo87 commented 5 years ago

in theory that sounds like a good idea, though in general I'm a little worried about it due to the other issues that peer dependencies have.

one example is ESLint plugins and ember-cli-eslint: the plugins usually declare an eslint peer dependency, but since the Ember app only has a dependency on ember-cli-eslint (which depends on broccoli-lint-eslint which depends on eslint) yarn will show warnings during yarn install. I'm worried that we'll run into similar issues 🤔

samselikoff commented 5 years ago

I see.

Would it be possible to inspect the "final graph" (if there is such a thing) to check for the presence of eslint?

Turbo87 commented 5 years ago

yes, but you might actually end up with several different versions if a subsubsubsubsubdependency misbehaves and has eslint as an actual dependency.

quaertym commented 5 years ago

We can only warn instead of failing build.

Turbo87 commented 5 years ago

@quaertym true, but yarn and npm already do that, so I'm not sure where the benefit would be

rwjblue commented 5 years ago

One benefit is that npm and yarn only warn once upon install, whereas this addon would warn upon each invocation of ember...

rwjblue commented 5 years ago

Also, see https://github.com/ember-cli/rfcs/pull/112 for some background context here. I still need to dust off that RFC and re-submit it to emberjs/rfcs though...