vueless 0.0.795 → 0.0.797
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/bin/commands/init.js +19 -3
- package/bin/constants.js +16 -15
- package/bin/index.js +4 -2
- package/package.json +1 -1
package/bin/commands/init.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { cwd } from "node:process";
|
|
4
4
|
import path from "node:path";
|
|
5
|
-
import {
|
|
5
|
+
import { existsSync } from "node:fs";
|
|
6
|
+
import { writeFile, rename } from "node:fs/promises";
|
|
6
7
|
import { styleText } from "node:util";
|
|
7
8
|
|
|
8
|
-
import {
|
|
9
|
+
import { DEFAULT_VUELESS_CONFIG_CONTENT } from "../constants.js";
|
|
9
10
|
import { JAVASCRIPT_EXT, TYPESCRIPT_EXT, VUELESS_CONFIG_FILE_NAME } from "../../constants.js";
|
|
10
11
|
|
|
11
12
|
const vuelessInitOptions = ["--ts", "--js"];
|
|
@@ -24,7 +25,22 @@ export async function vuelessInit(options) {
|
|
|
24
25
|
ext: fileExt,
|
|
25
26
|
});
|
|
26
27
|
|
|
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
|
+
|
|
43
|
+
await writeFile(formattedDestPath, DEFAULT_VUELESS_CONFIG_CONTENT, "utf-8");
|
|
28
44
|
|
|
29
45
|
const successMessage = styleText(
|
|
30
46
|
"green",
|
package/bin/constants.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
export const SRC_COMPONENTS_PATH = "/src/components";
|
|
2
2
|
export const COMPONENTS_PATH = "/components";
|
|
3
|
-
export const
|
|
3
|
+
export const DEFAULT_VUELESS_CONFIG_CONTENT = `
|
|
4
4
|
export default {
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
* Global settings.
|
|
7
|
+
*/
|
|
8
8
|
strategy: "merge",
|
|
9
9
|
brand: "grayscale",
|
|
10
10
|
gray: "cool",
|
|
11
|
-
darkMode: "auto",
|
|
12
11
|
outline: 2,
|
|
13
12
|
rounding: 8,
|
|
13
|
+
colorMode: "auto",
|
|
14
|
+
baseClasses: ``,
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
* Directive settings.
|
|
18
|
+
*/
|
|
18
19
|
directives: {},
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
* Component settings.
|
|
23
|
+
*/
|
|
23
24
|
components: /*tw*/ {},
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
* Tailwind CSS theme config.
|
|
28
|
+
* https://tailwindcss.com/docs/theme
|
|
29
|
+
*/
|
|
29
30
|
tailwindTheme: {
|
|
30
31
|
extend: {
|
|
31
32
|
colors: {},
|
|
@@ -33,10 +34,10 @@ export default {
|
|
|
33
34
|
},
|
|
34
35
|
|
|
35
36
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
* Custom classes TailwindMerge settings.
|
|
38
|
+
* All lists of rules available here:
|
|
39
|
+
* https://github.com/dcastil/tailwind-merge/blob/v2.3.0/src/lib/default-config.ts
|
|
40
|
+
*/
|
|
40
41
|
tailwindMerge: {},
|
|
41
42
|
};
|
|
42
43
|
`;
|
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
|
}
|