milkee 0.0.8 → 0.0.9
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 +13 -3
- package/package.json +1 -1
package/dist/main.js
CHANGED
@@ -24,24 +24,34 @@
|
|
24
24
|
|
25
25
|
// async
|
26
26
|
setup = async function() {
|
27
|
-
var CONFIG_TEMPLATE, TEMPLATE_PATH, check, error;
|
27
|
+
var CONFIG_TEMPLATE, TEMPLATE_PATH, check, error, pstat, stat;
|
28
|
+
pstat = "created";
|
29
|
+
stat = "create";
|
28
30
|
if (fs.existsSync(CONFIG_PATH)) {
|
29
31
|
consola.warn(`\`${CONFIG_FILE}\` already exists in this directory.`);
|
30
32
|
check = (await consola.prompt("Do you want to reset `coffee.config.js`?", {
|
31
33
|
type: "confirm"
|
32
34
|
}));
|
33
35
|
if (check !== true) {
|
36
|
+
consola.info("Cancelled.");
|
34
37
|
return;
|
38
|
+
} else {
|
39
|
+
fs.rmSync(CONFIG_PATH, {
|
40
|
+
recursive: true,
|
41
|
+
force: true
|
42
|
+
});
|
43
|
+
pstat = "reset";
|
44
|
+
stat = "reset";
|
35
45
|
}
|
36
46
|
}
|
37
47
|
try {
|
38
48
|
TEMPLATE_PATH = path.join(__dirname, '..', 'temp', 'coffee.config.js');
|
39
49
|
CONFIG_TEMPLATE = fs.readFileSync(TEMPLATE_PATH, 'utf-8');
|
40
50
|
fs.writeFileSync(CONFIG_PATH, CONFIG_TEMPLATE);
|
41
|
-
return consola.success(`Successfully
|
51
|
+
return consola.success(`Successfully ${pstat} \`${CONFIG_FILE}\`!`);
|
42
52
|
} catch (error1) {
|
43
53
|
error = error1;
|
44
|
-
consola.error(`Failed to
|
54
|
+
consola.error(`Failed to ${stat} \`${CONFIG_FILE}\`:`, error);
|
45
55
|
return consola.info(`Template file may be missing from the package installation at \`${TEMPLATE_PATH}\``);
|
46
56
|
}
|
47
57
|
};
|