milkee 2.2.0 → 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.
Files changed (2) hide show
  1. package/dist/main.js +40 -3
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -40,7 +40,7 @@
40
40
  if (res.success && !res.isLatest) {
41
41
  consola.box({
42
42
  title: "A new version is now available!",
43
- message: `${res.currentVersion} --> \`${res.latestVersion}\`\n\n# global installation\n\`npm i -g milkee@latest\`\n\n# or local installation\n\`npm i -D 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\``
44
44
  });
45
45
  return true;
46
46
  } else {
@@ -188,10 +188,47 @@
188
188
 
189
189
  // async
190
190
  compile = async function() {
191
- var backupFiles, backupName, backupPath, cl, 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;
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
192
  cl = (await checkLatest());
193
193
  if (cl) {
194
- await sleep(1000);
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
+ }
195
232
  }
196
233
  checkCoffee();
197
234
  if (!fs.existsSync(CONFIG_PATH)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "milkee",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "A simple CoffeeScript build tool with coffee.config.cjs",
5
5
  "main": "dist/main.js",
6
6
  "bin": {