Time to upgrade Ember to 2.0!

When upgrading the project I like to us the series shown on the Ember CLI page.

  1. rm -rf node_modules bower_components dist tmp – Delete temporary development folders.
  2. npm install –save-dev ember-cli@1.13.8 – Update project’s package.json to use latest version.
  3. npm install – Reinstall NPM dependencies.
  4. bower install – Reinstall bower dependencies.
  5. ember init – This runs the new project blueprint on your projects directory. Please follow the prompts, and review all changes (tip: you can see a diff by pressing d). The most common source of upgrade pain is missing changes in this step.

Ember-cli should be defaulting to Ember 2.0.0. Unfortunately, when I ran this my instance was still running an older version. Have no fear as I can manually update. First open up the bower.json file. Under dependencies change the ember version as well as the ember data version.

"ember": "~2.0.0",
...
"ember-data": "2.0.0-beta.1",

Ember Data has not release their 2.0 version as of yet. For now you’ll have to use the beta version till the official release. You can’t use an earlier version with Ember 2.0. After the dependencies section add a resolution section as follows:

"resolutions": {
  "ember": "~2.0.0"
}

Now under the package.json file also change the ember-data version to 2.0.0=beta.1. Now run:

npm install
bower install
ember s

ember s will run the ember server. It should start up easily and say

Livereload server on http://localhost:49154
Serving on http://localhost:4200/

If you go to that page you’ll see a basic ‘Welcome to Ember’ page. If you go to the app/templates directory of the project you can open up the application.hbs file. With the server running put in some new information such as

<p>
  Watch me live reload!
</p>

And save the file. The page will automatically update the new information on save. This can be a blessing and a curse. Depending on your machine, the live reload might be a tad slow. It can become annoying to have the page constantly updating every time a file changes. If you don’t want the live reload feature just start the server with the following flag.

ember server --live-reload=false

That’s all I will do for now. Tomorrow I’ll talk a bit about git and version control. To start I wont do much on the ember side. I need to get our database prepared and start figuring out how to model the data.

Comments