2014-01-05 10:16:01 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
var cljsLoad = require("./cljs-load");
|
2014-01-05 10:16:01 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
var srcFile = "outsite/public/js/main.js";
|
|
|
|
var outputDirectory = "outsite/public/js/out/";
|
2015-08-20 07:54:15 +00:00
|
|
|
var devFile = "reagenttest/runtests.js";
|
2014-01-09 13:37:11 +00:00
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
var beep = "\u0007";
|
2014-01-05 10:16:01 +00:00
|
|
|
|
2014-12-09 06:30:57 +00:00
|
|
|
if (typeof location === "undefined") {
|
|
|
|
// figwheel wants js/location to exist, even if it doesn't run,
|
|
|
|
// for some reason
|
|
|
|
global.location = {};
|
|
|
|
}
|
2014-11-29 17:30:24 +00:00
|
|
|
var gensite = function () {
|
|
|
|
console.log("Loading " + srcFile);
|
2015-03-22 10:49:23 +00:00
|
|
|
var optNone = cljsLoad.load(srcFile, outputDirectory, devFile);
|
2015-02-10 13:18:56 +00:00
|
|
|
sitetools.core.genpages({"opt-none": optNone});
|
2014-01-19 11:13:19 +00:00
|
|
|
}
|
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
var compileFail = function () {
|
|
|
|
var msg = process.argv[process.argv.length - 1];
|
|
|
|
if (msg && msg.match(/failed/)) {
|
|
|
|
console.log("Compilation failed" + beep);
|
2014-01-20 08:40:56 +00:00
|
|
|
return true;
|
2014-11-29 17:30:24 +00:00
|
|
|
}
|
2014-01-20 08:40:56 +00:00
|
|
|
};
|
2014-01-05 10:16:01 +00:00
|
|
|
|
2015-10-10 10:37:58 +00:00
|
|
|
process.env.NODE_ENV = "production";
|
|
|
|
|
2014-11-29 17:30:24 +00:00
|
|
|
if (!compileFail()) {
|
|
|
|
try {
|
|
|
|
gensite();
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e + beep);
|
|
|
|
console.error(e.stack);
|
2015-02-09 13:14:12 +00:00
|
|
|
process.exit(1);
|
2014-11-29 17:30:24 +00:00
|
|
|
}
|
2014-01-20 08:40:56 +00:00
|
|
|
}
|
2015-02-09 13:14:12 +00:00
|
|
|
process.exit(0);
|