forked from emberjs/data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathember-cli-build.js
59 lines (50 loc) · 1.81 KB
/
ember-cli-build.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
/* eslint-env node */
var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
var merge = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');
var globals = require('./lib/globals');
var yuidoc = require('./lib/yuidoc');
var StripClassCallCheck = require('babel6-plugin-strip-class-callcheck');
var path = require('path');
// allow toggling of heimdall instrumentation
var INSTRUMENT_HEIMDALL = false;
var args = process.argv;
for (var i = 0; i < args.length; i++) {
if (args[i] === '--instrument') {
INSTRUMENT_HEIMDALL = true;
break;
}
}
module.exports = function(defaults) {
var app = new EmberAddon(defaults, {
// use babel6 options until we are using [email protected]
babel6: {
postTransformPlugins: [
// while ember-data strips itself, ember does not currently
[StripClassCallCheck]
]
}
});
if (INSTRUMENT_HEIMDALL) {
console.warn('IMPORTED HEIMDALL & SET EMBER TO PRODUCTION');
var heimdallTree = new Funnel('node_modules/heimdalljs', {
destDir: 'heimdalljs'
});
app.trees.vendor = merge([app.trees.vendor, heimdallTree]);
app.import('vendor/heimdalljs/dist/heimdalljs.iife.js', {prepend: true});
app.vendorFiles['ember.js'].development = path.join(app.bowerDirectory, 'ember/ember.prod.js');
}
/*
This build file specifies the options for the dummy test app of this
addon, located in `/tests/dummy`
This build file does *not* influence how the addon or the app using it
behave. You most likely want to be modifying `./index.js` or app's build file
*/
var appTree = app.toTree();
if (process.env.EMBER_ENV === 'production') {
var globalsBuild = globals('addon', 'config/package-manager-files');
return merge([appTree, globalsBuild, yuidoc()]);
} else {
return appTree;
}
};