vueless 0.0.795 → 0.0.796

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.
@@ -2,7 +2,8 @@
2
2
 
3
3
  import { cwd } from "node:process";
4
4
  import path from "node:path";
5
- import { writeFile } from "node:fs/promises";
5
+ import { existsSync } from "node:fs";
6
+ import { writeFile, rename } from "node:fs/promises";
6
7
  import { styleText } from "node:util";
7
8
 
8
9
  import { DEFAULT_VUELESS_CONFIG_CONTNET } from "../constants.js";
@@ -24,6 +25,21 @@ export async function vuelessInit(options) {
24
25
  ext: fileExt,
25
26
  });
26
27
 
28
+ if (existsSync(formattedDestPath)) {
29
+ const timestamp = new Date().valueOf();
30
+ const renamedTarget = `${VUELESS_CONFIG_FILE_NAME}-backup-${timestamp}${fileExt}`;
31
+
32
+ await rename(formattedDestPath, renamedTarget);
33
+
34
+ const warnMessage = styleText(
35
+ "yellow",
36
+ // eslint-disable-next-line vue/max-len
37
+ `Current Vueless config backed into: '${path.basename(renamedTarget)}' folder. Don't forget to remove it before commit.`,
38
+ );
39
+
40
+ console.warn(warnMessage);
41
+ }
42
+
27
43
  await writeFile(formattedDestPath, DEFAULT_VUELESS_CONFIG_CONTNET, "utf-8");
28
44
 
29
45
  const successMessage = styleText(
package/bin/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  /* eslint-disable no-console */
4
4
 
5
+ import { styleText } from "node:util";
6
+
5
7
  import { commands } from "./commands/index.js";
6
8
 
7
9
  import { DEFAULT_EXIT_CODE, FAILURE_CODE } from "../constants.js";
@@ -16,9 +18,9 @@ try {
16
18
  if (command in commands) {
17
19
  commands[command](options);
18
20
  } else {
19
- throw new Error(`There is no such command: ${command}`);
21
+ throw new Error(styleText("red", `There is no such command: ${command}`));
20
22
  }
21
23
  } catch (error) {
22
- console.error(error.message);
24
+ console.error(styleText("red", error.message));
23
25
  process.exit(error.code || FAILURE_CODE);
24
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.795",
3
+ "version": "0.0.796",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless UI Component Library, powered by Tailwind CSS.",
6
6
  "keywords": [