Gabriel Grant
Gabriel Grant

Reputation: 5591

How should I specify a minimum version of Ember.js in my ember-cli addon?

I've just published an ember-cli addon using features available only in projects that have updated to Ember 2.x by making the required changes to their package.json and bower.json.

How should I specify that the addon will only work with Ember 2.x?

Upvotes: 2

Views: 68

Answers (1)

jrjohnson
jrjohnson

Reputation: 2459

Very late answer, but I found this question while searching for this myself.

The answer is to require ember-cli-version-checker. The documentation gives several examples, but to require a minimum version of Ember itself you would do

//index.js
let VersionChecker = require('ember-cli-version-checker');

module.exports = {
  name: 'awesome-addon',
  init() {
    let checker = new VersionChecker(this);

    checker.for('ember-cli').assertAbove('2.0.0', 'To use awesome-addon you must have ember-cli 2.0.0');
  }
};

Upvotes: 0

Related Questions