This repository has been archived by the owner on Dec 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Brocfile.js
149 lines (140 loc) · 3.8 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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
var path = require('path');
var merge = require('broccoli-merge-trees');
var fastBrowserify = require('./index');
var babelify = require('babelify');
var simpleBundle = fastBrowserify('test/simple', {
outputDirectory: 'simple'
});
var simpleWithCustomization = fastBrowserify('test/simple-with-customization', {
bundleExtension: '.bundle',
outputExtension: 'my-custom-extension',
outputDirectory: 'simple-with-customization'
});
var nonGlob = fastBrowserify('test/non-glob', {
bundles: {
'non-glob/bundle.js': {
entryPoints: ['index.js']
}
}
});
var multipleEntries = fastBrowserify('test/multiple-entries', {
outputDirectory: 'multiple-entries',
bundles: {
'bundle.js': {
entryPoints: ['**/*.js']
}
}
});
var fancyMultipleEntries = fastBrowserify('test/fancy-multiple-entries', {
outputDirectory: 'fancy-multiple-entries',
bundles: {
'bundle.js': {
entryPoints: function(relativePath) {
var entryPoints = [relativePath];
var dir = path.dirname(relativePath);
entryPoints.push(path.join(dir, '**/bootstrap.js'));
return entryPoints;
}
}
}
});
var directoryGlobBundles = fastBrowserify('test/directory-glob-bundles', {
outputDirectory: 'directory-glob-bundles',
bundles: {
'packages/*': {
glob: true,
entryPoints: function(p) {
return [p + 'index.js'];
},
outputPath: function(p) {
return p + 'bundle.js';
}
},
'all.js': {
entryPoints: ['packages/*/index.js']
}
}
});
var transformed = fastBrowserify('test/transformed/simple', {
bundles: {
'transformed/simple/bundle.js': {
entryPoints: ['index.js'],
transform: require('./test/transformed/transformify')
}
}
});
var transformedBabelify = fastBrowserify('test/transformed/babelify', {
browserify: {
extensions: [".babel"]
},
bundles: {
'transformed/babelify/bundle.js': {
entryPoints: ['es2015-modules.babel'],
transform: {
tr: babelify,
options: {
extensions: [".babel"]
}
}
}
}
});
var externals = fastBrowserify('test/externals', {
externals: ['globallyExternal'],
outputDirectory: 'externals',
bundles: {
'subdir/bundle.js': {
externals: ['./included.js'],
entryPoints: ['subdir/index.js']
},
'bundle.js': {
externals: ['bundleExternalNonExistantModule', './included.js'],
entryPoints: ['index.js']
},
'all.js': {
externals: ['bundleExternalNonExistantModule'],
entryPoints: ['index.js']
}
}
});
var allTogetherNow = fastBrowserify('test', {
outputDirectory: 'all-together-now',
bundles: {
'non-glob/bundle.js': {
entryPoints: ['non-glob/index.js']
},
'multiple-entries/bundle.js': {
entryPoints: ['multiple-entries/**/*.js']
},
'fancy-multiple-entries/bundle.js': {
entryPoints: function(relativePath) {
var entryPoints = [relativePath];
var dir = path.dirname(relativePath);
entryPoints.push(path.join(dir, '**/bootstrap.js'));
return entryPoints;
}
},
'directory-glob-bundles/packages/*': {
glob: true,
entryPoints: function(p) {
return [p + 'index.js'];
},
outputPath: function(p) {
return p + 'bundle.js';
}
},
'directory-glob-bundles/all.js': {
entryPoints: ['directory-glob-bundles/packages/*/index.js']
}
}
});
module.exports = merge([simpleBundle,
simpleWithCustomization,
nonGlob,
multipleEntries,
fancyMultipleEntries,
directoryGlobBundles,
transformed,
transformedBabelify,
externals,
allTogetherNow]);