Skip to content

Commit 82f0c5b

Browse files
committed
Refactor setup
1 parent 61f2571 commit 82f0c5b

File tree

1 file changed

+6
-25
lines changed

1 file changed

+6
-25
lines changed

Diff for: app/setup.js

+6-25
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,7 @@ const clfdate = require("helper/clfdate");
1212
const log = (...arguments) =>
1313
console.log.apply(null, [clfdate(), "Setup:", ...arguments]);
1414

15-
// skip building the documentation if it's already been built
16-
// this suggests that the server has already been started
17-
// and this speeds up the restart process when we run out of memory
18-
const SERVER_RESTART =
19-
config.environment === "production" &&
20-
fs.existsSync(config.views_directory + "/index.html");
21-
2215
function main(callback) {
23-
if (SERVER_RESTART) {
24-
log("Server restart detected. Skipping setup.");
25-
return callback();
26-
}
27-
2816
async.series(
2917
[
3018
async function () {
@@ -83,10 +71,12 @@ function main(callback) {
8371
},
8472

8573
async function () {
86-
log("Building documentation");
87-
// we only want to watch for changes in the documentation in development
88-
await documentation({ watch: config.environment === "development" });
89-
log("Built documentation");
74+
// The docker build stage for production runs this script ahead of time
75+
if (config.environment === "development") {
76+
await documentation({ watch: true });
77+
} else {
78+
log("Skipping documentation build");
79+
}
9080
},
9181

9282
async function () {
@@ -107,13 +97,4 @@ function main(callback) {
10797
);
10898
}
10999

110-
if (require.main === module) {
111-
log("Setting up Blot...");
112-
main(function (err) {
113-
if (err) throw err;
114-
log("Setup complete!");
115-
process.exit();
116-
});
117-
}
118-
119100
module.exports = main;

0 commit comments

Comments
 (0)