Deprecations Added in Ember CLI 2.x

Deprecations Present in Ember CLI 2.0.0

Migrate from Brocfile.js to ember-cli-build.js

until: 3.0.0
id: cli.brocfile

Early versions of Ember CLI utilized the default build file of Broccoli: Brocfile.js. Over time we began realizing that this was not a tenable solution (we could not pass high fidelity objects into the build pipeline, and therefore created two instances of all addons, etc), and introduced a replacement for Brocfile.js: ember-cli-build.js. The new structure allows Ember CLI to pass information into the function exported by ember-cli-build.js and avoid the issues mentioned above.

The migration from Brocfile.js to ember-cli-build.js is fairly straight forward:

Migrate Brocfile.js from: js // Brocfile.js var EmberApp = require('ember-cli/lib/broccoli/ember-app'); var app = new EmberApp(); module.exports = app.toTree();

To ember-cli-build.js:

1
2
3
4
5
6
7
8
9
var EmberApp = require('ember-cli/lib/broccoli/ember-app');

module.exports = function(defaults) {
  var app = new EmberApp(defaults, {
      // Any options
  });

  return app.toTree();
};

Deprecations Added in Ember CLI 2.2.0

Deprecate Utility

until: 3.0.0
id: cli.ui.deprecate

Using the ember-cli/lib/utlities/deprecate module to issue deprecations has been deprecated in favor of using .writeDeprecateLine method on the ui object (which is available on both addons and project instances).

Migrate from:

1
2
3
4
5
6
7
8
9
const deprecate = require('ember-cli/lib/utilities/deprecate');

module.exports = {
  name: 'my-addon-name',

  someMethod() {
    deprecate('this thing is deprecated!');
  }
}

To:

1
2
3
4
5
6
7
module.exports = {
  name: 'my-addon-name',

  someMethod() {
    this.ui.writeDeprecateLine('this thing is deprecated!');
  }
}

Deprecations Added in Ember CLI 2.7.0

Base URL

until: 3.0.0
id: cli.baseURL

The usage of baseURL setting in config/environments.js has been deprecated in favor of using an explicit rootURL. A detailed explanation of the problem and the migration path can be found in this blog post.

Migration for pre-2.7 applications is:

  1. Update config/environment.js to remove reference to baseURL and update to rootURL.
  2. Update app/index.html to add {{rootURL}} a the beginning of all assets that are loaded.
  3. Update the app/router.js to pass rootURL to the subclass of Ember.Router being created.

More detailed descriptions of this migration can be found on the blog: here

Deprecations Added in Ember CLI 2.12.0

Clobbering Addon#options

Clobbering this.options within an addon has been deprecated. If you would like to use this.options for internal options within your addon, you must preserve the intitial options object that is present.

Instead of doing this:

1
2
3
included() {
  this.options = { my-addons: { special: { options: 'here' } } };
}

You should do the following:

1
2
3
4
included() {
  this.options = this.options || {};
  this.options['my-addons'] = { special: { options: 'here' } };
}