forked from bustle/mobiledoc-kit
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathBrocfile.js
51 lines (41 loc) · 1.46 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
/* jshint node:true */
var broccoli = require("broccoli");
var Watcher = require("broccoli-sane-watcher");
var Funnel = require("broccoli-funnel");
var builder = require("broccoli-multi-builder");
var mergeTrees = require("broccoli-merge-trees");
var testTreeBuilder = require("broccoli-test-builder");
var jquery = require("./broccoli/jquery");
var BroccoliLiveReload = require("broccoli-livereload");
var replace = require("broccoli-string-replace");
var demoTree = require("./broccoli/demo");
var vendoredModules = [
{ name: "mobiledoc-dom-renderer" },
{ name: "mobiledoc-text-renderer" }
];
var cssFiles = new Funnel("src/css", { destDir: "css" });
var packageName = 'mobiledoc-kit';
var buildOptions = {
libDirName: "src/js",
vendoredModules: vendoredModules,
packageName: packageName
};
var testTree = testTreeBuilder.build({ libDirName: "src" });
testTree = jquery.build(testTree, "/tests/jquery");
testTree = new BroccoliLiveReload(testTree, { target: "index.html" });
var testBuilder = new broccoli.Builder(testTree);
function replaceVersion(tree) {
var version = require("./package.json").version;
return replace(tree, {
files: [ "**/*.js" ],
pattern: { match: /##VERSION##/g, replacement: version }
});
}
module.exports = mergeTrees([
replaceVersion(builder.build("amd", buildOptions)),
replaceVersion(builder.build("global", buildOptions)),
replaceVersion(builder.build("commonjs", buildOptions)),
cssFiles,
testTree,
demoTree()
]);