forked from standardshub/oma-tools-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
54 lines (50 loc) · 1.55 KB
/
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
#!/usr/local/bin/node
var fs = require("fs")
, pth = require("path")
, r = require("requirejs")
;
function build (options, cb) {
var config = {
baseUrl: pth.join(__dirname, "./oma-profile")
, optimize: options.optimize || "uglify2"
, paths: {
requireLib: "../node_modules/requirejs/require",
domReady: "../node_modules/respec/js/domReady",
core: "../node_modules/respec/js/core/",
text: "../node_modules/respec/js/text",
tmpl: "../node_modules/respec/js/tmpl",
handlebars: "../node_modules/respec/js/handlebars",
shortcut: "../node_modules/respec/js/shortcut",
webidl2: "../node_modules/respec/js/webidl2",
w3c: "../node_modules/respec/js/w3c"
}
, shim: {
"shortcut": {
exports: "shortcut"
}
}
, name: "oma"
, include: "requireLib".split(" ")
, out: options.out
, inlineText: true
, preserveLicenseComments: false
};
r.optimize(config, function () {
console.log("writing " + config.out)
// add header
try {
fs.writeFileSync(config.out,
fs.readFileSync(config.out, "utf8") + "\nrequire(['oma']);\n");
}
catch (e) {
console.log("ERROR", e);
}
cb();
});
}
exports.build = build;
build({
out: "builds/respec-oma-common.js"
}, function () {
console.log("DONE");
});