forked from emberjs/ember-mocha
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Brocfile.js
132 lines (112 loc) · 3.43 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
var concat = require('broccoli-sourcemap-concat');
var Funnel = require('broccoli-funnel');
var mergeTrees = require('broccoli-merge-trees');
var compileES6 = require('broccoli-es6modules');
var jshintTree = require('broccoli-jshint');
var replace = require('broccoli-string-replace');
var gitVersion = require('git-repo-version');
// --- Compile ES6 modules ---
var loader = new Funnel('bower_components', {
srcDir: 'loader',
files: ['loader.js'],
destDir: '/assets/'
});
// TODO - this manual dependency management has got to go!
var klassy = new Funnel('bower_components', {
srcDir: '/klassy/lib',
files: ['klassy.js'],
destDir: '/'
});
var emberTestHelpers = new Funnel('bower_components', {
srcDir: '/ember-test-helpers/lib',
include: [/.js$/],
destDir: '/'
});
var deps = mergeTrees([klassy, emberTestHelpers]);
var lib = new Funnel('lib', {
srcDir: '/',
include: [/.js$/],
destDir: '/'
});
var tests = new Funnel('tests', {
srcDir: '/',
include: [/test-support\/resolver.js$/, /.js$/],
destDir: '/tests'
});
var main = mergeTrees([deps, lib]);
main = concat(new compileES6(main), {
inputFiles: ['**/*.js'],
outputFile: '/ember-mocha.amd.js'
});
var generatedBowerConfig = new Funnel('build-support', {
srcDir: '/',
destDir: '/',
files: ['bower.json']
});
generatedBowerConfig = replace(generatedBowerConfig, {
files: ['bower.json'],
pattern: {
match: /VERSION_PLACEHOLDER/,
replacement: function() {
// remove leading `v` (since by default our tags use a `v` prefix)
return gitVersion().replace(/^v/, '');
}
}
});
var buildExtras = new Funnel('build-support', {
srcDir: '/',
destDir: '/',
files: ['README.md', 'LICENSE', 'mocha-setup.js']
});
var globalizedBuildSupport = new Funnel('build-support', {
srcDir: '/',
files: ['iife-start.js', 'globalize.js', 'iife-stop.js'],
destDir: '/'
});
var globalizedMain = concat(mergeTrees([loader, main, globalizedBuildSupport]), {
inputFiles: ['iife-start.js', 'assets/loader.js', 'ember-mocha.amd.js', 'globalize.js', 'iife-stop.js'],
outputFile: '/ember-mocha.js'
});
var jshintLib = jshintTree(lib);
var jshintTest = jshintTree(tests);
var mainWithTests = mergeTrees([deps, lib, tests, jshintLib, jshintTest]);
mainWithTests = concat(new compileES6(mainWithTests), {
inputFiles: ['**/*.js'],
outputFile: '/assets/ember-mocha-tests.amd.js'
});
// --- Select and concat vendor / support files ---
var vendor = concat('bower_components', {
inputFiles: [
'jquery/dist/jquery.js',
'ember/ember-template-compiler.js',
'ember/ember.js',
'ember-data/ember-data.js'],
outputFile: '/assets/vendor.js'
});
var mocha = new Funnel('bower_components', {
srcDir: '/mocha',
files: ['mocha.js', 'mocha.css'],
destDir: '/assets'
});
var chai = new Funnel('bower_components', {
srcDir: '/chai',
files: ['chai.js'],
destDir: '/assets'
});
var adapter = new Funnel('bower_components', {
srcDir: '/ember-mocha-adapter',
files: ['adapter.js'],
destDir: '/assets'
});
var testSupport = concat('bower_components', {
inputFiles: [
'ember-cli-shims/app-shims.js',
'../tests/test-support/test-loader.js'],
outputFile: '/assets/test-support.js'
});
var testIndex = new Funnel('tests', {
srcDir: '/',
files: ['index.html'],
destDir: '/tests'
});
module.exports = mergeTrees([loader, main, mainWithTests, globalizedMain, vendor, mocha, chai, adapter, testSupport, testIndex, generatedBowerConfig, buildExtras]);