milkee 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +24 -16
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
compile = async function() {
|
|
159
|
-
var compilerProcess, config, debounceTimeout, enabledOptions, enabledOptionsList, error, execCommand, execCommandParts, execOtherOptionStrings, i, item, itemPath, items, lastError, len, milkee, milkeeOptions, options,
|
|
159
|
+
var compilerProcess, config, debounceTimeout, enabledOptions, enabledOptionsList, error, execCommand, execCommandParts, execOtherOptionStrings, i, item, itemPath, items, lastError, len, milkee, milkeeOptions, options, spawnArgs, stat, summary, targetDir, toContinue;
|
|
160
160
|
checkCoffee();
|
|
161
161
|
if (!fs.existsSync(CONFIG_PATH)) {
|
|
162
162
|
consola.error(`\`${CONFIG_FILE}\` not found in this directory: ${CWD}`);
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
consola.error('`entry` and `output` properties are required in your configuration.');
|
|
170
170
|
process.exit(1);
|
|
171
171
|
}
|
|
172
|
-
options = config.options || {};
|
|
172
|
+
options = {...(config.options || {})};
|
|
173
173
|
milkee = config.milkee || {};
|
|
174
174
|
milkeeOptions = config.milkee.options || {};
|
|
175
175
|
execCommandParts = ['coffee'];
|
|
@@ -259,24 +259,32 @@
|
|
|
259
259
|
return;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
optionsForPlugins = {...options};
|
|
263
262
|
delete options.join;
|
|
264
263
|
if (milkeeOptions.refresh) {
|
|
265
264
|
targetDir = path.join(CWD, config.output);
|
|
266
|
-
if (
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
265
|
+
if (fs.existsSync(targetDir)) {
|
|
266
|
+
stat = fs.statSync(targetDir);
|
|
267
|
+
if (stat.isDirectory()) {
|
|
268
|
+
consola.info("Executing: Refresh");
|
|
269
|
+
items = fs.readdirSync(targetDir);
|
|
270
|
+
for (i = 0, len = items.length; i < len; i++) {
|
|
271
|
+
item = items[i];
|
|
272
|
+
itemPath = path.join(targetDir, item);
|
|
273
|
+
fs.rmSync(itemPath, {
|
|
274
|
+
recursive: true,
|
|
275
|
+
force: true
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
consola.success("Refreshed!");
|
|
279
|
+
} else {
|
|
280
|
+
consola.info("Executing: Refresh (Single File)");
|
|
281
|
+
fs.rmSync(targetDir, {
|
|
276
282
|
force: true
|
|
277
283
|
});
|
|
284
|
+
consola.success("Refreshed!");
|
|
278
285
|
}
|
|
279
|
-
|
|
286
|
+
} else {
|
|
287
|
+
consola.info("Refresh skipped.");
|
|
280
288
|
}
|
|
281
289
|
}
|
|
282
290
|
if (options.watch) {
|
|
@@ -310,7 +318,7 @@
|
|
|
310
318
|
consola.warn("Compilation failed, plugins skipped.");
|
|
311
319
|
} else {
|
|
312
320
|
consola.success('Compilation successful (watch mode).');
|
|
313
|
-
runPlugins(config,
|
|
321
|
+
runPlugins(config, {...(config.options || {})}, '(watch mode)', '');
|
|
314
322
|
}
|
|
315
323
|
return lastError = null;
|
|
316
324
|
}, 100);
|
|
@@ -341,7 +349,7 @@
|
|
|
341
349
|
if (stderr && !error) {
|
|
342
350
|
process.stderr.write(stderr);
|
|
343
351
|
}
|
|
344
|
-
return runPlugins(config,
|
|
352
|
+
return runPlugins(config, {...(config.options || {})}, stdout, stderr);
|
|
345
353
|
});
|
|
346
354
|
}
|
|
347
355
|
} catch (error1) {
|