abuiles / ember-101

https://leanpub.com/ember-cli-101
95 stars 23 forks source link

Outdated "borrowers" repository #66

Closed fknoll closed 8 years ago

fknoll commented 8 years ago

To @abuiles,

I just started reading you book, dated 12. May 2016.

You upgraded your book to Ember 2.0, but it seems to me, that you did not upgrade the related code for the application on GitHub? I cloned your "borrowers" repository, and I tried to do the upgrade to the latest versions of Ember CLI, Ember and Ember Data.

However, I experienced many problems.

In particular, it was unclear to me, which code libraries to get rid of and which code libraries to keep/upgrade (package.jason and bower.jason). Therefore, I gave up for now.

I think it would be valuable for your readers, if each release of your book was accompanied with a not to outdated demo repository?

I also think it could be a valuable lesson to understand exactly what it takes to upgrade your Ember 1.x "borrowers" repository to the latest 2.x release of Ember.

fknoll commented 8 years ago

Inspired from trying to understand error messages in Ember Inspector, I managed to get your "borrowers" demo application up running with the latest version of Ember CLI, Ember and Ember Data :smiley:

Besides upgrading those three basic components, I merged the existing "package.json" with the one proposed by the command ember init - always choosing the newest version of a package.

I also upgraded "active-model-adapter" , "ember-cli-content-security-policy" and "moment" to their newest version.

Finally, I made corrections in the following three files:

// app/routes/index.js
import Ember from 'ember';
import request from 'ic-ajax';

export default Ember.Route.extend({
  model: function() {
    return request('http://api.ember-cli-101.com/api/v4/friends').then(function(data){
      return {
        friendsCount: data.friends.length
      };
    });
  }
});
// app/adapters/application.js
import ActiveModelAdapter from 'active-model-adapter';

export default ActiveModelAdapter.extend({
  host: 'http://api.ember-cli-101.com',
  namespace: 'api/v4',
  coalesceFindRequests: true
});
// config/environment.js
...
  ENV.contentSecurityPolicy = {
    'img-src':     ["'self'", "http://www.fillmurray.com/"],
    'connect-src': ["'self'", "http://api.ember-cli-101.com/api/v4/"]
  }
...

I might have made some small corrections to other stuff while playing around ... but I do not remember, sorry!

This is my resulting ”package.json" file:

{
  "name": "borrowers",
  "version": "0.0.0",
  "description": "Small description for borrowers goes here",
  "private": true,
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "build": "ember build",
    "start": "ember server",
    "test": "ember test"
  },
  "repository": "",
  "engines": {
    "node": ">= 0.10.0"
  },
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "active-model-adapter": "2.1.1",
    "broccoli-asset-rev": "^2.4.2",
    "ember-ajax": "0.7.1",
    "ember-cli": "2.5.0",
    "ember-cli-app-version": "^1.0.0",
    "ember-cli-babel": "^5.1.6",
    "ember-cli-content-security-policy": "0.5.0",
    "ember-cli-dependency-checker": "^1.2.0",
    "ember-cli-fill-murray": "0.3.0",
    "ember-cli-htmlbars": "^1.0.3",
    "ember-cli-htmlbars-inline-precompile": "^0.3.1",
    "ember-cli-ic-ajax": "^0.2.1",
    "ember-cli-inject-live-reload": "^1.4.0",
    "ember-cli-jshint": "^1.0.0",
    "ember-cli-qunit": "^1.4.0",
    "ember-cli-release": "0.2.8",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "^2.5.0",
    "ember-disable-proxy-controllers": "^1.0.0",
    "ember-export-application-global": "^1.0.2",
    "ember-load-initializers": "^0.5.1",
    "ember-resolver": "^2.0.3",
    "emberx-select": "1.1.4",
    "loader.js": "^4.0.1"
  }
}

This is my resulting ”bower.json" file:

{
  "name": "borrowers",
  "dependencies": {
    "ember": "~2.5.0",
    "ember-cli-shims": "0.1.1",
    "ember-cli-test-loader": "0.2.2",
    "ember-qunit-notifications": "0.1.0",
    "moment": "^2.13.0"
  }
}

Probably some packages could be removed and other upgraded to newest version. But, I am up running :smiley:

abuiles commented 8 years ago

Hi @fknoll, I'm sorry about that! I'm currently working on a new version of the book you can follow process here https://github.com/abuiles/ember-101/pull/65 so hopefully this issue will be fixed soon :).

abuiles commented 8 years ago

@fknoll btw, do you mind submitting a PR to the main repo in the meantime? thanks!

abuiles commented 8 years ago

Thanks everyone! This is now updated in the following repo https://github.com/abuiles/borrowers-2016