ember-cli / rfcs

Archive of RFCs for changes to ember-cli (for current RFC repo see https://github.com/emberjs/rfcs)
45 stars 54 forks source link

Add flag to determine if addon is installed to devDependencies or dependencies #56

Closed GCheung55 closed 8 years ago

GCheung55 commented 8 years ago

npm allows the developer to determine whether to save a dependency in package.json under devDependencies or dependencies.

The difference between the two is that dependencies are required to run, while devDependencies are required to develop.

Examples of dependencies required to run: ember-cli, ember-resolver, and ember-core. Examples of devDependencies required to develop: ember-cli, ember-resolver, ember-core, ember-cli-template-lint, ember-cli-jshint, and ember-cli-qunit.

In an Ember app, a user would have to manually maintain dependencies in package.json when running ember install <addon>.

I propose a --dev flag to ember install to allow developers to decide when the addon is not for development, like ember-route-action-helper, which would be used in-app. The flag would be true by default.

A benefit to this is that addons that are truly devDependencies would be excluded when the repo is being built and deployed in a CI environment, thus speeding up the process.

nathanhammond commented 8 years ago

Changing the behavior here would be a breaking change. Currently anything specified in devDependencies is able to participate in the build process. In a CI environment in which we build your Ember application we can't exclude anything which has the possibility to influence the outcome of the build.

I understand that it seems incongruous to have something marked as a dev dependency being required to build the application, but this is a consequence of our (highly beneficial) addon system. For example, how would you even begin to classify something like ember-cli-deploy?

We have discussed ways to make this better, and @kellyselden has been thinking about our addon install/uninstall process. This is a good concern to pay attention to, but we're incredibly unlikely to make any change without a holistic review of the problems we're trying to solve.

I'm closing this in favor of #34. Thanks for taking the time to write up your thoughts!