What does ember install do


#1

Dependencies can get messy, sometimes you need to install different versions to see which version caused a bug (but potentially fixed another!). I know ember install usually just installs an npm package as a dev (development) dependency, but I’m not sure what else could be going on (like an ember generate command).

Searching google for “what does ember install do” gives this page on how addons work: How does EmberJS Addons work? But this isn’t quite the information I was hoping for. Ember install is hugely dependent on npm and bower, and as such it’d be great to know exactly what it’s doing, in case we’re debugging versions or doing something more involved.

Furthermore, like homebrew, I think it’d be great for addons to have a way to print out some info after install. An uninstall command would be fantastic, but dev’s should at least be informed about exactly what was installed (a bower, AND/OR npm package) so they can know exactly how to uninstall just that dependency. (rm -rf’ing node_modules and bower_components, then re-installing takes a long time.)


#2

Well if you run ember help install it says:

ember install <addon-name>
  Installs an ember-cli addon from npm.

When installing an addon, it runs some blueprints and can do things like create files, so it does more than just bower or npm installing.

EDIT:

Looking at the ember cli docs, it says:

Installs the given addon into your project and saves it to the package.json file. If provided, the command will run the addon’s default blueprint.


#3

Also saw this in the some release notes for version 0.1.5

...
ember install ember install:bower moment ember install:npm ember-browserify

They behave exactly as you’d expect. Install runs npm and bower install on the project. The last two simply pass in the package names you give it to the underlying task to do it.

#2805 Added the install:addon command, which installs an addon with NPM and then runs the included generator of the same name if it provides one.

If the blueprint for the installed addon requires arguments, then you can pass them too, for example, the ember-cli-cordova addon needs an extra argument which you can pass running the command as follows: ember install:addon ember-cli-cordova com.myapp.app.

Q: Can you still pass in this extra argument for the blueprint generation? What are the limitations for the default blueprint generator? (What can and can’t it do?)

In conclusion, I think ember-cli should print out which of these 3 things has happened when you do an install: blueprint generation (perhaps even print out the code diff), bower package(s) installed, and npm package(s) installed. The documentation given when you run ember help install should probably include more info than just “Installs an ember-cli addon from npm” because there’s plenty more that could be going on.


#4

ember install <addon-name>

is an exact replacement for

npm install <addon-name> --save-dev
ember generate <addon-name>

#5

Therefore ember generate can actually install bower components?


#6

ember generate calls the addon’s blueprint, which can theoretically do anything a node.js program can do. Sometimes, they use the conveniently provided addBowerPackagesToProject hook to install bower packages. They can also install npm packages or even additional ember addons.