Using Ember CLI as a single NPM dependency to upgrade?

I quite like using Ember CLI, but I always find it difficult to upgrade from one version of Ember CLI to the next. Specifically, it’s a challenge to upgrade all of the dependencies in package.json.

I run ember init and then have to manually go through the diff between the new and old copies of package.json. Oftentimes, there will be a small different in version numbers on dependencies like ember-cli-babel and ember-cli-sri that I will lose in the process. Or I will overwrite and lose a top-level dependency that I added myself.

This experience upgrading Ember CLI is in contrast with the experience of upgrading Ruby on Rails. In that case, I just increment the version number of the Rails Rubygem in Gemfile. That links to all of the appropriate children dependencies, which are stored in Gemfile.lock. I usually don’t have to worry about the Rails gem’s child dependencies – it’s only when there’s a conflict within Gemfile.lock that I’ll look more closely.

Could this be possible with Ember CLI? Would it be possible to have just a package.json with:

"devDependencies": {
  "ember-cli": "2.12.1"
}

and then have NPM handle all the child dependencies?

Or perhaps this is functionality that Yarn can now provide through a Yarn.lock file?

If my questions/suggestions are off base, please do let me know – I’m mainly just wondering if it’s possible to have the easy upgrade experience with Ember CLI that I now take for granted with Rails and Bundler.

1 Like

There’s an addon called ember-cli-commands that will automate all this for you. You just run ember upgrade and it will install the newest version of Ember and also analyse your package.json file to automatically update any other dependencies it needs.

I agree, isn’t this what create-react-app does? I quite like it. Feels much simpler!

Thanks, this is very useful.

The ember-cli team is also working on ember-cli-update which automatically manages the upgrade process (both package.json and actual blueprinted content). I think we hope to be able to move forward with ember-cli-update as the default and recommended path sometime in the near future…

2 Likes