-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
52 lines (40 loc) · 1.31 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
52
/* jshint node: true */
'use strict';
const path = require('path');
const mergeTrees = require('broccoli-merge-trees');
const includeEmberElectronDir = require('./build/include-ember-electron-dir');
const includeGlimmerApps = require('./build/include-glimmer-apps');
const includeRendererInterfaces =
require('./build/include-renderer-interfaces');
module.exports = {
name: 'ember-render-vendor',
_env: undefined,
included(parent) {
this._env = parent.env;
while (this._env === undefined && parent !== undefined) {
parent = parent.parent;
this._env = parent.env;
}
},
treeForApp(tree) {
let renderers = includeRendererInterfaces(this.project.root);
return tree === undefined ?
renderers :
mergeTrees([renderers, tree]);
},
postprocessTree(type, tree) {
let isAll = type === 'all';
let isEmberElectron = process.env.EMBER_CLI_ELECTRON;
let isTest = this._env === 'test';
if (!isTest && isEmberElectron && isAll) {
let emberElectronTree = includeEmberElectronDir();
let glimmerAppTrees = includeGlimmerApps({
baseRenderersPath: path.join(this.project.root, 'renderers'),
env: this.project.env,
ui: this.ui
});
return mergeTrees([emberElectronTree, ...glimmerAppTrees, tree]);
}
return tree;
}
};