This repository has been archived by the owner on Feb 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
50 lines (39 loc) · 1.37 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
/* jshint node: true */
'use strict';
var DeployPluginBase = require('ember-cli-deploy-plugin');
var NewRelic = require('./lib/new-relic-client');
module.exports = {
name: 'ember-cli-deploy-new-relic-sourcemap',
createDeployPlugin: function(options) {
var DeployPlugin = DeployPluginBase.extend({
name: options.name,
NewRelic: options.NewRelic || NewRelic,
defaultConfig: {
sourceMapPattern: '**/*.map',
distDir: function(context) {
return context.distDir;
}
},
requiredConfig: ['prefix', 'applicationId', 'nrAdminKey'],
upload: function(/* context */) {
var sourceMapPattern = this.readConfig('sourceMapPattern');
var applicationId = this.readConfig('applicationId');
var nrAdminKey = this.readConfig('nrAdminKey');
var distDir = this.readConfig('distDir');
var prefix = this.readConfig('prefix');
this.log('Preparing to upload source maps to New Relic', { verbose: true });
var nrClient = new this.NewRelic({
plugin: this,
applicationId: applicationId,
nrAdminKey: nrAdminKey,
prefix: prefix
});
return nrClient.publishSourcemaps({
sourceMapPattern: sourceMapPattern,
distDir: distDir
});
}
});
return new DeployPlugin();
}
}