-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
39 lines (28 loc) · 1.01 KB
/
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
'use strict';
const VersionChecker = require('ember-cli-version-checker');
const Funnel = require('broccoli-funnel');
module.exports = {
name: require('./package').name,
included(...args) {
this._super.included.apply(this, args);
const emberSource = new VersionChecker(this.project).for('ember-source');
this.hasNativeIdHelper = emberSource.gte('4.4.0-beta.1');
if (this.hasNativeIdHelper && this.parent === this.project) {
let message =
'The `{{unique-id}}` helper is available natively since Ember 4.4.0-beta.1. You can remove `ember-unique-id-helper-polyfill` from your `package.json`.';
this.ui.writeWarnLine(message);
}
},
treeForApp(...args) {
return this.filterTree(this._super.treeForApp.apply(this, args));
},
treeForAddon(...args) {
return this.filterTree(this._super.treeForAddon.apply(this, args));
},
filterTree(tree) {
if (this.hasNativeIdHelper) {
return new Funnel(tree, { exclude: [/helpers/] });
}
return tree;
},
};