milkee 2.1.2 → 2.2.0-dev.0
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/README.md +1 -1
- package/dist/main.js +26 -5
- package/package.json +2 -1
- package/.gitattributes +0 -2
package/README.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by CoffeeScript 2.7.0
|
|
2
2
|
(function() {
|
|
3
|
-
var CONFIG_FILE, CONFIG_PATH, CWD, argv, checkCoffee, compile, consola, crypto, exec, executePlugins, fs, getCompiledFiles, hideBin, path, pkg, runPlugins, setup, spawn, yargs;
|
|
3
|
+
var CONFIG_FILE, CONFIG_PATH, CWD, argv, checkCoffee, checkLatest, compile, consola, crypto, exec, executePlugins, fs, getCompiledFiles, hideBin, isPackageLatest, path, pkg, runPlugins, setup, spawn, yargs;
|
|
4
4
|
|
|
5
5
|
yargs = require('yargs');
|
|
6
6
|
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
|
|
9
9
|
consola = require('consola');
|
|
10
10
|
|
|
11
|
+
({isPackageLatest} = require('is-package-latest'));
|
|
12
|
+
|
|
11
13
|
fs = require('fs');
|
|
12
14
|
|
|
13
15
|
path = require('path');
|
|
@@ -24,6 +26,19 @@
|
|
|
24
26
|
|
|
25
27
|
CONFIG_PATH = path.join(CWD, CONFIG_FILE);
|
|
26
28
|
|
|
29
|
+
// async
|
|
30
|
+
checkLatest = async function() {
|
|
31
|
+
var res;
|
|
32
|
+
try {
|
|
33
|
+
res = (await isPackageLatest(pkg));
|
|
34
|
+
if (res.success && res.isLatest) {
|
|
35
|
+
return consola.box(`A new version is available!\n\n${res.currentVersion} --> \`${res.latestVersion}\``);
|
|
36
|
+
}
|
|
37
|
+
} catch (error1) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
27
42
|
checkCoffee = function() {
|
|
28
43
|
var PKG_PATH, error, pkgData, pkgFile, ref, ref1;
|
|
29
44
|
PKG_PATH = path.join(CWD, 'package.json');
|
|
@@ -101,7 +116,9 @@
|
|
|
101
116
|
}
|
|
102
117
|
} else if (stat.isFile()) {
|
|
103
118
|
if (targetPath.endsWith('.js' || targetPath.endsWith('.js.map'))) {
|
|
104
|
-
|
|
119
|
+
if (fs.existsSync(targetPath)) {
|
|
120
|
+
consola.info(`Found file: \`${targetPath}\``);
|
|
121
|
+
}
|
|
105
122
|
filesList.push(targetPath);
|
|
106
123
|
}
|
|
107
124
|
}
|
|
@@ -119,7 +136,7 @@
|
|
|
119
136
|
return;
|
|
120
137
|
}
|
|
121
138
|
consola.start(`Running ${plugins.length} plugin(s)...`);
|
|
122
|
-
return (async function() {
|
|
139
|
+
return (async function() { // async
|
|
123
140
|
var error, i, len, pluginFn;
|
|
124
141
|
try {
|
|
125
142
|
for (i = 0, len = plugins.length; i < len; i++) {
|
|
@@ -159,6 +176,7 @@
|
|
|
159
176
|
|
|
160
177
|
compile = async function() {
|
|
161
178
|
var backupFiles, backupName, backupPath, clearBackups, compilerProcess, config, debounceTimeout, dirName, enabledOptions, enabledOptionsList, error, execCommand, execCommandParts, execOtherOptionStrings, fileName, hash, i, item, items, lastError, len, milkee, milkeeOptions, options, originalPath, restoreBackups, spawnArgs, stat, summary, targetDir, toContinue;
|
|
179
|
+
checkLatest();
|
|
162
180
|
checkCoffee();
|
|
163
181
|
if (!fs.existsSync(CONFIG_PATH)) {
|
|
164
182
|
consola.error(`\`${CONFIG_FILE}\` not found in this directory: ${CWD}`);
|
|
@@ -265,8 +283,8 @@
|
|
|
265
283
|
backupFiles = [];
|
|
266
284
|
restoreBackups = function() {
|
|
267
285
|
var backup, e, i, len;
|
|
286
|
+
consola.info("Restoring previous files...");
|
|
268
287
|
if (backupFiles.length > 0) {
|
|
269
|
-
consola.info("Restoring previous files...");
|
|
270
288
|
for (i = 0, len = backupFiles.length; i < len; i++) {
|
|
271
289
|
backup = backupFiles[i];
|
|
272
290
|
try {
|
|
@@ -284,6 +302,8 @@
|
|
|
284
302
|
}
|
|
285
303
|
}
|
|
286
304
|
return consola.success("Restored!");
|
|
305
|
+
} else {
|
|
306
|
+
return consola.info("No files found to restore.");
|
|
287
307
|
}
|
|
288
308
|
};
|
|
289
309
|
clearBackups = function() {
|
|
@@ -318,6 +338,7 @@
|
|
|
318
338
|
if (stat.isDirectory()) {
|
|
319
339
|
consola.info("Executing: Refresh");
|
|
320
340
|
items = fs.readdirSync(targetDir);
|
|
341
|
+
consola.start("Bucking up files...");
|
|
321
342
|
for (i = 0, len = items.length; i < len; i++) {
|
|
322
343
|
item = items[i];
|
|
323
344
|
originalPath = path.join(targetDir, item);
|
|
@@ -331,7 +352,7 @@
|
|
|
331
352
|
}
|
|
332
353
|
// itemPath = path.join targetDir, item
|
|
333
354
|
// fs.rmSync itemPath, recursive: true, force: true
|
|
334
|
-
consola.success(`
|
|
355
|
+
consola.success(`Files backed up with hash \`${hash}\``);
|
|
335
356
|
} else {
|
|
336
357
|
// consola.success "Refreshed!"
|
|
337
358
|
consola.info("Executing: Refresh (Single File)");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "milkee",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-dev.0",
|
|
4
4
|
"description": "A simple CoffeeScript build tool with coffee.config.cjs",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@milkee/d": "^0.2.0",
|
|
36
36
|
"consola": "^3.4.2",
|
|
37
|
+
"is-package-latest": "^1.0.0",
|
|
37
38
|
"yargs": "^18.0.0"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
package/.gitattributes
DELETED