forked from jamesarosen/ember-i18n
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
43 lines (36 loc) · 1009 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-env node */
'use strict';
var Funnel = require('broccoli-funnel');
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'ember-i18n',
isLocalizationFramework: true,
init() {
this._super.init && this._super.init.apply(this, arguments);
var checker = new VersionChecker(this);
var dep = checker.forEmber();
this.hasEmberHelper = !dep.lt('1.13.0');
},
treeFor(name) {
var result = this._super.treeFor.apply(this, arguments);
if (this.hasEmberHelper) {
result = exclude(result, [
'initializers/ember-i18n-legacy-helper.js',
'modules/ember-i18n/legacy/helper.js',
'modules/ember-i18n/legacy/initializer.js',
'modules/ember-i18n/legacy/stream.js'
]);
} else {
result = exclude(result, [
'helpers/t.js',
'modules/ember-i18n/helper.js'
]);
}
return result;
}
};
function exclude(tree, files) {
return new Funnel(tree, {
exclude: files
});
}