forked from ember-cli-sentry/ember-cli-sentry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
40 lines (30 loc) · 874 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
33
34
35
36
37
38
39
40
'use strict';
/* eslint-env node */
const path = require('path');
const resolve = require('resolve');
const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-cli-sentry',
included() {
this._super.included.apply(this, arguments);
let host = this.import ? this : findHost(this);
host.import('vendor/raven-shim.js');
host.import('vendor/raven.js');
},
treeForVendor(vendorTree) {
let ravenPath = path.dirname(resolve.sync('raven-js/dist/raven.js'));
let ravenTree = new Funnel(ravenPath, {
files: ['raven.js'],
});
return new MergeTrees([vendorTree, ravenTree]);
},
};
function findHost(addon) {
let current = addon;
let app;
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));
return app;
}