forked from kurko/ember-json-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Brocfile.js
89 lines (75 loc) · 2.05 KB
/
Brocfile.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var uglifyJavaScript = require('broccoli-uglify-js');
var pickFiles = require('broccoli-static-compiler');
var mergeTrees = require('broccoli-merge-trees');
var env = require('broccoli-env').getEnv();
var compileES6 = require('broccoli-es6-concatenator');
var findBowerTrees = require('broccoli-bower');
var sourceTrees = [];
if (env === 'production') {
// Build file
var js = compileES6('src', {
loaderFile: '../vendor/no-loader.js',
inputFiles: [
'**/*.js'
],
wrapInEval: false,
outputFile: '/ember-json-api.js'
});
var jsMinified = compileES6('src', {
loaderFile: '../vendor/no-loader.js',
inputFiles: [
'**/*.js'
],
wrapInEval: false,
outputFile: '/ember-json-api.min.js'
});
var ugly = uglifyJavaScript(jsMinified, {
mangle: true,
compress: true
});
sourceTrees = sourceTrees.concat(js);
sourceTrees = sourceTrees.concat(ugly);
} else if (env === 'development') {
var src, vendor, bowerComponents;
src = pickFiles('src', {
srcDir: '/',
destDir: '/src'
});
vendor = pickFiles('vendor', {
srcDir: '/',
destDir: '/vendor'
});
loaderJs = pickFiles('bower_components/loader.js', {
srcDir: '/',
files: ['loader.js'],
destDir: '/vendor/loader.js'
});
sourceTrees = sourceTrees.concat(src);
sourceTrees = sourceTrees.concat(findBowerTrees());
sourceTrees = sourceTrees.concat(vendor);
sourceTrees = sourceTrees.concat(loaderJs);
var js = new mergeTrees(sourceTrees, { overwrite: true });
js = compileES6(js, {
loaderFile: 'vendor/loader.js/loader.js',
inputFiles: [
'src/**/*.js'
],
legacyFilesToAppend: [
'jquery.js',
'qunit.js',
'handlebars.js',
'ember.debug.js',
'ember-data.js'
],
wrapInEval: true,
outputFile: '/assets/app.js'
});
sourceTrees = sourceTrees.concat(js);
var tests = pickFiles('tests', {
srcDir: '/',
destDir: '/tests'
})
sourceTrees.push(tests)
sourceTrees = sourceTrees.concat(tests);
}
module.exports = mergeTrees(sourceTrees, { overwrite: true });