-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
51 lines (39 loc) · 1.02 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
40
41
42
43
44
45
46
47
48
49
50
51
'use strict';
const VersionChecker = require('ember-cli-version-checker');
const MINIMUM_VERSION = '4.5.0-alpha.4';
module.exports = {
name: require('./package').name,
_usePolyfill: flag(process.env.USE_DEFAULT_HELPER_MANAGER_POLYFILL),
options: {
'ember-cli-babel': {
enableTypeScriptTransform: true,
},
},
usePolyfill() {
if (this._usePolyfill === undefined) {
let version = new VersionChecker(this.project).for(`ember-source`);
this._usePolyfill = version.lt(MINIMUM_VERSION);
}
return this._usePolyfill;
},
treeForAddon() {
if (this.usePolyfill()) {
return this._super.treeForAddon.apply(this, arguments);
}
},
treeForApp() {
if (this.usePolyfill()) {
return this._super.treeForApp.apply(this, arguments);
}
},
};
const FALSE = ['false', 'disable', 'no', 'off', '0'];
function flag(flag) {
if (flag === undefined) {
return undefined;
} else if (FALSE.includes(flag.toLowerCase())) {
return false;
} else {
return true;
}
}