|
7 | 7 | const cp = require("child_process"); |
8 | 8 | const fs = require("fs"); |
9 | 9 | const path = require("path"); |
10 | | -const async = require("neo-async"); |
11 | 10 | const tc = require("./template-common"); |
12 | 11 |
|
13 | 12 | const extraArgs = ""; |
@@ -150,29 +149,26 @@ const doCompileAndReplace = (args, prefix, callback) => { |
150 | 149 | connectIO(subprocess); |
151 | 150 | }; |
152 | 151 |
|
153 | | -async.series( |
154 | | - [ |
155 | | - (callback) => |
156 | | - doCompileAndReplace( |
157 | | - "--mode production --env production", |
158 | | - "production", |
159 | | - callback |
160 | | - ), |
161 | | - (callback) => |
162 | | - doCompileAndReplace( |
163 | | - "--mode development --env development --devtool none", |
164 | | - "development", |
165 | | - callback |
166 | | - ), |
167 | | - (callback) => |
168 | | - doCompileAndReplace( |
169 | | - "--mode none --env none --output-pathinfo verbose", |
170 | | - "", |
171 | | - callback |
172 | | - ) |
173 | | - ], |
174 | | - () => { |
| 152 | +/** @type {[string, string][]} */ |
| 153 | +const compilations = [ |
| 154 | + ["--mode production --env production", "production"], |
| 155 | + ["--mode development --env development --devtool none", "development"], |
| 156 | + ["--mode none --env none --output-pathinfo verbose", ""] |
| 157 | +]; |
| 158 | + |
| 159 | +/** |
| 160 | + * Runs the compilations one after another, as each one rewrites the README. |
| 161 | + * @param {number} index compilation to run |
| 162 | + * @returns {void} |
| 163 | + */ |
| 164 | +const runCompilation = (index) => { |
| 165 | + if (index === compilations.length) { |
175 | 166 | readme = tc.replaceBase(readme); |
176 | 167 | fs.writeFile("README.md", readme, "utf8", () => {}); |
| 168 | + return; |
177 | 169 | } |
178 | | -); |
| 170 | + const [args, prefix] = compilations[index]; |
| 171 | + doCompileAndReplace(args, prefix, () => runCompilation(index + 1)); |
| 172 | +}; |
| 173 | + |
| 174 | +runCompilation(0); |
0 commit comments