forked from ahmadsoe/ember-highcharts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
70 lines (55 loc) · 1.89 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* eslint-env node */
'use strict';
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var path = require('path');
module.exports = {
name: 'ember-highcharts',
included: function(target) {
this._super.included.apply(this, arguments);
var app = target.app || target;
var options = app.options.emberHighCharts || { includeHighCharts: true };
var highchartsPath = 'vendor/highcharts';
if (options.includeHighCharts) {
app.import(path.join(highchartsPath, 'highcharts.src.js'));
}
if (options.includeHighStock) {
app.import(path.join(highchartsPath, 'highstock.src.js'));
}
if (options.includeHighMaps) {
app.import(path.join(highchartsPath, 'highmaps.src.js'));
}
if (options.includeHighChartsMore) {
app.import(path.join(highchartsPath, 'highcharts-more.src.js'));
}
if (options.includeHighCharts3D) {
// boost module need to be imported before highcharts-3d
if (options.includeModules) {
var boostIndex = options.includeModules.indexOf('boost');
if (boostIndex !== -1) {
app.import(path.join(highchartsPath, 'modules', 'boost.src.js'));
options.includeModules.splice(boostIndex, 1);
}
}
app.import(path.join(highchartsPath, 'highcharts-3d.src.js'));
}
if (options.includeModules) {
var modules = options.includeModules;
for (var i = 0; i < modules.length; i++) {
var moduleFilename = modules[i] + '.src.js';
app.import(path.join(highchartsPath, 'modules', moduleFilename));
}
}
},
treeForVendor: function(vendorTree) {
var trees = [];
var highchartsPath = path.dirname(require.resolve('highcharts'));
if (vendorTree) {
trees.push(vendorTree);
}
trees.push(new Funnel(highchartsPath, {
destDir: 'highcharts'
}));
return mergeTrees(trees);
}
};