milkee 2.2.0-dev.4 → 2.2.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 +55 -6
- package/package.json +1 -1
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, checkLatest, compile, consola, crypto, exec, executePlugins, fs, getCompiledFiles, hideBin, isPackageLatest, 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, sleep, spawn, yargs;
|
|
4
4
|
|
|
5
5
|
yargs = require('yargs');
|
|
6
6
|
|
|
@@ -26,19 +26,28 @@
|
|
|
26
26
|
|
|
27
27
|
CONFIG_PATH = path.join(CWD, CONFIG_FILE);
|
|
28
28
|
|
|
29
|
+
sleep = function(time) {
|
|
30
|
+
return new Promise(function(resolve) {
|
|
31
|
+
return setTimeout(resolve, time);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
29
35
|
// async
|
|
30
36
|
checkLatest = async function() {
|
|
31
37
|
var res;
|
|
32
38
|
try {
|
|
33
39
|
res = (await isPackageLatest(pkg));
|
|
34
40
|
if (res.success && !res.isLatest) {
|
|
35
|
-
|
|
41
|
+
consola.box({
|
|
36
42
|
title: "A new version is now available!",
|
|
37
|
-
message: `${res.currentVersion} --> \`${res.latestVersion}\`\n\n# global installation\n\`npm i -g milkee@latest\`\n
|
|
43
|
+
message: `${res.currentVersion} --> \`${res.latestVersion}\`\n\n# global installation\n\`npm i -g milkee@latest\`\n# or local installation\n\`npm i -D milkee@latest\``
|
|
38
44
|
});
|
|
45
|
+
return true;
|
|
46
|
+
} else {
|
|
47
|
+
return false;
|
|
39
48
|
}
|
|
40
49
|
} catch (error1) {
|
|
41
|
-
return
|
|
50
|
+
return false;
|
|
42
51
|
}
|
|
43
52
|
};
|
|
44
53
|
|
|
@@ -179,8 +188,48 @@
|
|
|
179
188
|
|
|
180
189
|
// async
|
|
181
190
|
compile = async function() {
|
|
182
|
-
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;
|
|
183
|
-
await checkLatest();
|
|
191
|
+
var action, backupFiles, backupName, backupPath, cl, clearBackups, compilerProcess, config, debounceTimeout, dirName, enabledOptions, enabledOptionsList, error, execCommand, execCommandParts, execOtherOptionStrings, fileName, hash, i, installCmd, item, items, lastError, len, milkee, milkeeOptions, options, originalPath, restoreBackups, spawnArgs, stat, summary, targetDir, toContinue;
|
|
192
|
+
cl = (await checkLatest());
|
|
193
|
+
if (cl) {
|
|
194
|
+
action = (await consola.prompt("Do you want to update now?", {
|
|
195
|
+
type: 'select',
|
|
196
|
+
options: [
|
|
197
|
+
{
|
|
198
|
+
label: 'No (Skip)',
|
|
199
|
+
value: 'skip',
|
|
200
|
+
hint: 'Start compiling directly'
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
label: 'Yes (Global)',
|
|
204
|
+
value: 'global',
|
|
205
|
+
hint: 'npm i -g milkee@latest'
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
label: 'Yes (Local)',
|
|
209
|
+
value: 'local',
|
|
210
|
+
hint: 'npm i -D milkee@latest'
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}));
|
|
214
|
+
if (action && action !== 'skip') {
|
|
215
|
+
installCmd = action === 'global' ? 'npm i -g milkee@latest' : 'npm i -D milkee@latest';
|
|
216
|
+
consola.start("Updating milkee...");
|
|
217
|
+
await new Promise(function(resolve) {
|
|
218
|
+
var cp;
|
|
219
|
+
cp = spawn(installCmd, {
|
|
220
|
+
shell: true,
|
|
221
|
+
stdio: 'inherit'
|
|
222
|
+
});
|
|
223
|
+
return cp.on('close', resolve);
|
|
224
|
+
});
|
|
225
|
+
consola.success("Update finished! Please run the command again.");
|
|
226
|
+
process.exit(0);
|
|
227
|
+
} else if (action === 'skip') {
|
|
228
|
+
consola.info("Skipped!");
|
|
229
|
+
} else if (!action) {
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
184
233
|
checkCoffee();
|
|
185
234
|
if (!fs.existsSync(CONFIG_PATH)) {
|
|
186
235
|
consola.error(`\`${CONFIG_FILE}\` not found in this directory: ${CWD}`);
|