ui-thing 0.1.28 → 0.1.30

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.
@@ -1,10 +1,32 @@
1
1
  import kleur from "kleur";
2
2
  import prompts from "prompts";
3
3
 
4
- import { CSS_THEME_OPTIONS } from "./constants";
4
+ import { CSS_THEME_OPTIONS, NUXT_VERSIONS, PACKAGE_MANAGER_CHOICES } from "./constants";
5
+
6
+ export const promptForNuxtVersion = async () => {
7
+ const response = await prompts([
8
+ {
9
+ name: "nuxtVersion",
10
+ type: "select",
11
+ message: "Which Nuxt version are you using?",
12
+ choices: NUXT_VERSIONS,
13
+ },
14
+ ]);
15
+ if (!response.nuxtVersion) {
16
+ console.log(kleur.red("No Nuxt version selected. Exiting..."));
17
+ return process.exit(0);
18
+ }
19
+ return response.nuxtVersion;
20
+ };
5
21
 
6
22
  export const initPrompts = async () => {
7
23
  const response = await prompts([
24
+ {
25
+ name: "nuxtVersion",
26
+ type: "select",
27
+ message: "Which Nuxt version are you using?",
28
+ choices: NUXT_VERSIONS,
29
+ },
8
30
  {
9
31
  name: "theme",
10
32
  type: "autocomplete",
@@ -15,7 +37,8 @@ export const initPrompts = async () => {
15
37
  name: "tailwindCSSLocation",
16
38
  type: "text",
17
39
  message: "Where is your tailwind.css file located?",
18
- initial: "assets/css/tailwind.css",
40
+ initial: (_, v) =>
41
+ v.nuxtVersion == 3 ? "assets/css/tailwind.css" : "app/assets/css/tailwind.css",
19
42
  },
20
43
  {
21
44
  name: "tailwindConfigLocation",
@@ -27,25 +50,25 @@ export const initPrompts = async () => {
27
50
  name: "componentsLocation",
28
51
  type: "text",
29
52
  message: "Where should your components be stored?",
30
- initial: "components/Ui",
53
+ initial: (_, v) => (v.nuxtVersion == 3 ? "components/Ui" : "app/components/Ui"),
31
54
  },
32
55
  {
33
56
  name: "composablesLocation",
34
57
  type: "text",
35
58
  message: "Where should your composables be stored?",
36
- initial: "composables",
59
+ initial: (_, v) => (v.nuxtVersion == 3 ? "composables" : "app/composables"),
37
60
  },
38
61
  {
39
62
  name: "pluginsLocation",
40
63
  type: "text",
41
64
  message: "Where should your plugins be stored?",
42
- initial: "plugins",
65
+ initial: (_, v) => (v.nuxtVersion == 3 ? "plugins" : "app/plugins"),
43
66
  },
44
67
  {
45
68
  name: "utilsLocation",
46
69
  type: "text",
47
70
  message: "Where should your utils be stored?",
48
- initial: "utils",
71
+ initial: (_, v) => (v.nuxtVersion == 3 ? "utils" : "app/utils"),
49
72
  },
50
73
  {
51
74
  name: "force",
@@ -63,15 +86,11 @@ export const initPrompts = async () => {
63
86
  name: "packageManager",
64
87
  type: "select",
65
88
  message: "Which package manager do you use?",
66
- choices: [
67
- { title: "NPM", value: "npm" },
68
- { title: "Yarn", value: "yarn" },
69
- { title: "PNPM", value: "pnpm" },
70
- { title: "Bun", value: "bun" },
71
- ],
89
+ choices: PACKAGE_MANAGER_CHOICES,
72
90
  },
73
91
  ]);
74
- if (!response || Object.keys(response).length < 9) {
92
+
93
+ if (!response || Object.keys(response).length < 10) {
75
94
  console.log(kleur.red("Incomplete configuration submitted. Exiting..."));
76
95
  return process.exit(0);
77
96
  }
@@ -5,6 +5,7 @@ import * as testingFn from "../../src/utils/compareUIConfig";
5
5
  import * as configModule from "../../src/utils/config";
6
6
 
7
7
  const goodConfig: UIConfig = {
8
+ nuxtVersion: 3,
8
9
  theme: "string",
9
10
  tailwindCSSLocation: "string",
10
11
  tailwindConfigLocation: "string",
package/tsconfig.json CHANGED
@@ -7,6 +7,7 @@
7
7
  "outDir": "dist",
8
8
  "rootDir": "src",
9
9
  "strict": true,
10
+ "resolveJsonModule": true,
10
11
  "esModuleInterop": true,
11
12
  "forceConsistentCasingInFileNames": true,
12
13
  "declaration": true,