@@ -12,19 +12,7 @@ const clfdate = require("helper/clfdate");
12
12
const log = ( ...arguments ) =>
13
13
console . log . apply ( null , [ clfdate ( ) , "Setup:" , ...arguments ] ) ;
14
14
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
-
22
15
function main ( callback ) {
23
- if ( SERVER_RESTART ) {
24
- log ( "Server restart detected. Skipping setup." ) ;
25
- return callback ( ) ;
26
- }
27
-
28
16
async . series (
29
17
[
30
18
async function ( ) {
@@ -83,10 +71,12 @@ function main(callback) {
83
71
} ,
84
72
85
73
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
+ }
90
80
} ,
91
81
92
82
async function ( ) {
@@ -107,13 +97,4 @@ function main(callback) {
107
97
) ;
108
98
}
109
99
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
-
119
100
module . exports = main ;
0 commit comments