2014-01-05 11:16:01 +01:00
|
|
|
|
2014-11-29 18:30:24 +01:00
|
|
|
var cljsLoad = require("./cljs-load");
|
2014-01-05 11:16:01 +01:00
|
|
|
|
2017-03-11 00:36:23 +02:00
|
|
|
var srcFile = "pre-render/main.js";
|
|
|
|
var outputDirectory = "pre-render/out/";
|
2015-08-20 09:54:15 +02:00
|
|
|
var devFile = "reagenttest/runtests.js";
|
2014-01-09 14:37:11 +01:00
|
|
|
|
2014-11-29 18:30:24 +01:00
|
|
|
var beep = "\u0007";
|
2014-01-05 11:16:01 +01:00
|
|
|
|
2014-12-09 07:30:57 +01: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 18:30:24 +01:00
|
|
|
var gensite = function () {
|
|
|
|
console.log("Loading " + srcFile);
|
2015-03-22 11:49:23 +01:00
|
|
|
var optNone = cljsLoad.load(srcFile, outputDirectory, devFile);
|
2017-03-11 00:36:23 +02:00
|
|
|
sitetools.server.genpages({"opt-none": optNone});
|
2014-01-19 12:13:19 +01:00
|
|
|
}
|
|
|
|
|
2014-11-29 18:30:24 +01: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 09:40:56 +01:00
|
|
|
return true;
|
2014-11-29 18:30:24 +01:00
|
|
|
}
|
2014-01-20 09:40:56 +01:00
|
|
|
};
|
2014-01-05 11:16:01 +01:00
|
|
|
|
2015-10-10 12:37:58 +02:00
|
|
|
process.env.NODE_ENV = "production";
|
|
|
|
|
2014-11-29 18:30:24 +01:00
|
|
|
if (!compileFail()) {
|
|
|
|
try {
|
|
|
|
gensite();
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e + beep);
|
|
|
|
console.error(e.stack);
|
2015-02-09 14:14:12 +01:00
|
|
|
process.exit(1);
|
2014-11-29 18:30:24 +01:00
|
|
|
}
|
2014-01-20 09:40:56 +01:00
|
|
|
}
|
2015-02-09 14:14:12 +01:00
|
|
|
process.exit(0);
|