forked from simonihmig/ember-cli-head
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
32 lines (24 loc) · 956 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
/* jshint node: true */
'use strict';
var path = require('path');
var filterInitializers = require('fastboot-filter-initializers');
var VersionChecker = require('ember-cli-version-checker');
var mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-head',
treeForApp: function(defaultTree) {
var checker = new VersionChecker(this);
var emberVersion = checker.for('ember-source', 'npm');
if (!emberVersion.version) {
emberVersion = checker.for('ember', 'bower');
}
var trees = [defaultTree];
// 2.9.0-beta.1 - 2.9.0-beta.5 used glimmer2 (but 2.9.0 did not)
// 2.10.0-beta.1+ includes glimmer2
if (!(emberVersion.gt('2.9.0-beta') && emberVersion.lt('2.9.0')) && !emberVersion.gt('2.10.0-beta')) {
trees.push(this.treeGenerator(path.resolve(this.root, 'app-lt-2-10')));
}
var tree = mergeTrees(trees, { overwrite: true });
return filterInitializers(tree);
}
};