Best approach to upgrade from Ember 1.0 to Ember 2.13


#1

Hi All,

I am new to Ember. I have a task to upgrade from Ember 1.0 to Ember 2.13. I can see that there is an Ember upgrade guide available at ‘www.emberscreencasts.com/meta_guide_to_upgrading_ember’ but I do not get a clear idea on my situation as Ember 1.0 is not even listed on Ember ‘https://emberjs.com/’. One of the main point the upgrade guide talks about is taking a note of deprecations but not how to make a note of those in my case as there may be a hell lot of(not sure). Someone suggested to go by creating your own javascript engine but I never worked on javascript engine as well. Can anyone please help to provide a best practical approach for my problem. Any help would really be appreciated.

Regards,


#2

Hi @TechLov, it depends on the size and complexity of your application. If it is very small it would not be hard, but if it is small\medium\big and complex I would say the upgrade will be the same as you would rewrite the app from scratch (but copy-paste some logic).

Note, Ember 2.x does not have views, partial views, so you will need to re-implement them with components. You will need to use ember-cli with the structure of files it proposes. By default, ember-cli expects you to use ES6, npm, so you need to know how it works. If you use Ember-data, it would need your backend to support json api specifications http://jsonapi.org (by default, ember-data 2.x uses JsonApiAdapter, but ember-data 1.x used RestAdapter)

I have couple applications written on Ember 1.9. When I need to upgrade them I would just look at the task as I need to write the apps from scratch


#3

Man, that will be like upgrading 3-4 years worth of framework changes. If you’re new to Ember this could be a great/painful learning experience (I did something similar though I only went from 1.11->2.1). Maybe this won’t be of as much help in your situation, but what helped for me was stepping through each version and clearing up any deprecation warnings incrementally. It was kinda of tedious and took a while but it worked pretty well. Getting up to 2.0 will be the hardest part by far, once you hit that it’s pretty smooth sailing.

@Enterpub is on to something though, the nuclear option may actually be the best approach in your case. I’d say try and evaluate the complexity of the app. Is it an ember CLI app? I’d guess no, and if not I’d say it’s probably not worth trying to upgrade in-place. Start a new ember app via CLI and start porting code over piece by piece. Does it use a lot of Ember Data customization? Do you have a lot of views? It it just a big app? If any of these are true I’d still consider starting with a fresh 2.13 app. If it’s fairly simple and using CLI maybe try the incremental upgrade approach.

A few random notes:

  • Ember isn’t using bower anymore (still supported but moving away from it) so if you can replace any bower packages you’re using with ember addons via npm that would be good.
  • Your code, even simple stuff, is probably going to look a lot different in 2.13. There’s a modern style guide and lots of other nice tips and tricks which may be helpful to look over before starting.
  • Sometimes the deprecation guides can be enough but to really ease the pain it may be helpful to just read a lot of docs/articles/etc. (a different kind of pain) to try and figure out what was changed and why, and how a modern Ember app should look (as @Enterpub mentioned ES6 and npm are changing, views are gone and replaced by components, you should understand modern Ember Data, etc)

Good luck!


#4

Ember 1.0…isn’t that even before Ember CLI? I remember Ember CLI came at around Ember 1.5


#5

@lightblade Yeah, I believe Ember 1.0 was even before the first stable version i.e. Ember 1.10


#6

thanks guys for the valuable insights, definitely I am gonna get a lot of helps from the views shared.

Can writing your own javascript engine be helpful in this case?


#7

Or you can swap the default JsonApiAdapter for the RESTAdapter and you’re done. From Ember 1.0 to 2.13 is quite a big upgrade, no need to make it more harder.


#8

@TechLov sorry what does writing your own javascript engine mean? I’m not even sure I know what that would be