forked from soulim/ember-cli-bootstrap-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
39 lines (32 loc) · 1.24 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 path = require('path');
const mergeTrees = require('broccoli-merge-trees');
const Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-bootstrap-date-component',
included: function(app) {
this._super.included(app);
if (process.env.EMBER_CLI_FASTBOOT !== 'true') {
app.import(path.join(this.treePaths.vendor, 'bootstrap-datepicker.js'));
app.import(path.join(this.treePaths.vendor, 'bootstrap-datepicker.css'));
}
},
treeForVendor(vendorTree) {
let jsDir = path.dirname(require.resolve('bootstrap-datepicker'));
let cssDir = path.resolve(jsDir, '..', 'css');
let localesDir = path.resolve(jsDir, '..', 'locales');
// If there's no vendor directory (it apparently get stripped if empty when
// publishin to npm), the vendorTree is undefined and mergeTrees() gets
// grumpy if one of the trees passed in isn't a broccoli node.
let trees = [];
if (vendorTree) {
trees.push(vendorTree);
}
trees.push(
new Funnel(jsDir, { files: [ 'bootstrap-datepicker.js' ] }),
new Funnel(cssDir, { files: [ 'bootstrap-datepicker.css' ] }),
new Funnel(localesDir, { destDir: 'bootstrap-datepicker-locales' })
);
return mergeTrees(trees);
}
};