ember-cli-dependency-checker icon indicating copy to clipboard operation
ember-cli-dependency-checker copied to clipboard

Idea: fail build if peerDep is missing?

Open samselikoff opened this issue 6 years ago • 7 comments

👋 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.

samselikoff avatar Feb 05 '19 22:02 samselikoff

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 🤔

Turbo87 avatar Feb 06 '19 08:02 Turbo87

I see.

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

samselikoff avatar Feb 06 '19 15:02 samselikoff

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

Turbo87 avatar Feb 06 '19 15:02 Turbo87

We can only warn instead of failing build.

quaertym avatar Feb 06 '19 15:02 quaertym

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

Turbo87 avatar Feb 06 '19 16:02 Turbo87

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

rwjblue avatar Feb 06 '19 16:02 rwjblue

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...

rwjblue avatar Feb 06 '19 16:02 rwjblue