ui-thing 0.2.4 → 0.2.6

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.
@@ -0,0 +1,93 @@
1
+ # Contributing to UI Thing CLI
2
+
3
+ First off, thank you for considering contributing to UI Thing CLI! It's people like you that make UI Thing CLI such a great tool.
4
+
5
+ ## Code of Conduct
6
+
7
+ By participating in this project, you are expected to uphold our code of conduct: be respectful, inclusive, and considerate in all interactions.
8
+
9
+ ## How Can I Contribute?
10
+
11
+ ### Reporting Bugs
12
+
13
+ Before creating bug reports, please check the existing issues to avoid duplicates. When you create a bug report, include as many details as possible:
14
+
15
+ - Use a clear and descriptive title
16
+ - Describe the exact steps to reproduce the problem
17
+ - Provide specific examples to demonstrate the steps
18
+ - Describe the behavior you observed and what you expected
19
+ - Include your environment details (OS, Node version, package version)
20
+
21
+ ### Suggesting Enhancements
22
+
23
+ Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, include:
24
+
25
+ - A clear and descriptive title
26
+ - A detailed description of the proposed feature
27
+ - Explain why this enhancement would be useful
28
+ - List any alternatives you've considered
29
+
30
+ ### Pull Requests
31
+
32
+ 1. Fork the repo and create your branch from `main`
33
+ 2. If you've added code, add tests
34
+ 3. Ensure the test suite passes
35
+ 4. Make sure your code follows the existing code style
36
+ 5. Write a clear commit message
37
+
38
+ ## Development Setup
39
+
40
+ 1. Clone your fork of the repository
41
+
42
+ ```bash
43
+ git clone https://github.com/YOUR_USERNAME/ui-thing-cli.git
44
+ cd ui-thing-cli
45
+ ```
46
+
47
+ 2. Install dependencies
48
+
49
+ ```bash
50
+ npm install
51
+ ```
52
+
53
+ 3. Build the project
54
+
55
+ ```bash
56
+ npm run build
57
+ ```
58
+
59
+ 4. Run tests
60
+
61
+ ```bash
62
+ npm run test
63
+ ```
64
+
65
+ ## Project Structure
66
+
67
+ - `src/commands/` - CLI command implementations
68
+ - `src/templates/` - File and code templates
69
+ - `src/utils/` - Shared utility functions
70
+ - `tests/` - Unit tests (mirrors src/ structure)
71
+
72
+ ## Coding Guidelines
73
+
74
+ - Write TypeScript with proper type annotations
75
+ - Follow the existing code style (check `eslint.config.ts`)
76
+ - Write meaningful commit messages
77
+ - Add tests for new features
78
+ - Update documentation as needed
79
+
80
+ ## Testing
81
+
82
+ - Add tests to the `tests/` directory
83
+ - Run `npm run test` to execute all tests
84
+ - Ensure all tests pass before submitting a PR
85
+
86
+ ## Need Help?
87
+
88
+ If you need help or have questions, feel free to:
89
+
90
+ - Open an issue
91
+ - Reach out via email: behon.baker@yahoo.com
92
+
93
+ Thank you for your contributions! 🎉
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: "🐛 [BUG] "
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Describe the bug
10
+
11
+ A clear and concise description of what the bug is.
12
+
13
+ ## To Reproduce
14
+
15
+ Steps to reproduce the behavior:
16
+
17
+ 1. Run command '...'
18
+ 2. See error
19
+
20
+ ## Expected behavior
21
+
22
+ A clear and concise description of what you expected to happen.
23
+
24
+ ## Screenshots
25
+
26
+ If applicable, add screenshots to help explain your problem.
27
+
28
+ ## Environment
29
+
30
+ - **OS:** [e.g. macOS, Windows, Linux]
31
+ - **Node version:** [e.g. 18.0.0]
32
+ - **Package version:** [e.g. 0.2.5]
33
+ - **Nuxt version:** [e.g. 3.12.0]
34
+
35
+ ## Additional context
36
+
37
+ Add any other context about the problem here.
38
+
39
+ ## Contact
40
+
41
+ If you need immediate assistance, feel free to reach out at behon.baker@yahoo.com
@@ -0,0 +1,8 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: 📧 Email Support
4
+ url: mailto:behon.baker@yahoo.com
5
+ about: For urgent issues or private concerns, contact the maintainer directly
6
+ - name: 💬 Discussions
7
+ url: https://github.com/BayBreezy/ui-thing-cli/discussions
8
+ about: Ask questions and discuss ideas with the community
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: "✨ [FEATURE] "
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Is your feature request related to a problem? Please describe.
10
+
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ ## Describe the solution you'd like
14
+
15
+ A clear and concise description of what you want to happen.
16
+
17
+ ## Describe alternatives you've considered
18
+
19
+ A clear and concise description of any alternative solutions or features you've considered.
20
+
21
+ ## Additional context
22
+
23
+ Add any other context or screenshots about the feature request here.
24
+
25
+ ## Contact
26
+
27
+ If you'd like to discuss this feature in more detail, feel free to reach out at behon.baker@yahoo.com
@@ -0,0 +1,54 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ We release patches for security vulnerabilities. Currently supported versions:
6
+
7
+ | Version | Supported |
8
+ | ------- | ------------------ |
9
+ | 0.2.x | :white_check_mark: |
10
+ | < 0.2.0 | :x: |
11
+
12
+ ## Reporting a Vulnerability
13
+
14
+ We take the security of UI Thing CLI seriously. If you believe you have found a security vulnerability, please report it to us as described below.
15
+
16
+ ### Please do NOT:
17
+
18
+ - Open a public GitHub issue
19
+ - Disclose the vulnerability publicly before it has been addressed
20
+
21
+ ### Please DO:
22
+
23
+ - Email your findings to **behon.baker@yahoo.com**
24
+ - Provide as much information as possible about the vulnerability:
25
+ - Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
26
+ - Full paths of source file(s) related to the manifestation of the issue
27
+ - The location of the affected source code (tag/branch/commit or direct URL)
28
+ - Any special configuration required to reproduce the issue
29
+ - Step-by-step instructions to reproduce the issue
30
+ - Proof-of-concept or exploit code (if possible)
31
+ - Impact of the issue, including how an attacker might exploit it
32
+
33
+ ### What to Expect:
34
+
35
+ - You will receive a response within 48 hours acknowledging your report
36
+ - We will investigate and keep you updated on the progress
37
+ - Once the vulnerability is confirmed, we will work on a fix and release a security patch
38
+ - We will credit you for the discovery (unless you prefer to remain anonymous)
39
+
40
+ ## Security Best Practices for Users
41
+
42
+ When using UI Thing CLI:
43
+
44
+ - Always use the latest version of the package
45
+ - Review generated code before committing to your repository
46
+ - Be cautious when running CLI commands with elevated privileges
47
+ - Keep your Node.js and npm/pnpm/yarn up to date
48
+
49
+ ## Contact
50
+
51
+ For any security-related questions or concerns, please contact:
52
+ **Behon Baker** - behon.baker@yahoo.com
53
+
54
+ Thank you for helping keep UI Thing CLI and its users safe!
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.2.6
4
+
5
+ [compare changes](https://github.com/BayBreezy/ui-thing-cli/compare/v0.2.5...v0.2.6)
6
+
7
+ ### 🚀 Enhancements
8
+
9
+ - Add issue templates for bug reports and feature requests ([906dabc](https://github.com/BayBreezy/ui-thing-cli/commit/906dabc))
10
+ - Enhance Prettier integration by prompting user for configuration and updating dependencies ([5d9f7b0](https://github.com/BayBreezy/ui-thing-cli/commit/5d9f7b0))
11
+
12
+ ### 📖 Documentation
13
+
14
+ - Update README to clarify `init` command functionality ([2353699](https://github.com/BayBreezy/ui-thing-cli/commit/2353699))
15
+ - Add CONTRIBUTING.md to guide new contributors ([3cfd3cd](https://github.com/BayBreezy/ui-thing-cli/commit/3cfd3cd))
16
+ - Add SECURITY.md to outline security policy and reporting procedures ([1213eef](https://github.com/BayBreezy/ui-thing-cli/commit/1213eef))
17
+
18
+ ### 🏡 Chore
19
+
20
+ - Update dependencies to latest versions ([fbb17d0](https://github.com/BayBreezy/ui-thing-cli/commit/fbb17d0))
21
+ - Update dependencies and devDependencies ([a6793dd](https://github.com/BayBreezy/ui-thing-cli/commit/a6793dd))
22
+
23
+ ### ❤️ Contributors
24
+
25
+ - Behon Baker ([@BayBreezy](https://github.com/BayBreezy))
26
+
27
+ ## v0.2.5
28
+
29
+ [compare changes](https://github.com/BayBreezy/ui-thing-cli/compare/v0.2.4...v0.2.5)
30
+
31
+ ### 🚀 Enhancements
32
+
33
+ - **theme:** Add theme name validation and improve theme selection process ([737acaf](https://github.com/BayBreezy/ui-thing-cli/commit/737acaf))
34
+
35
+ ### 🏡 Chore
36
+
37
+ - **deps-dev:** Bump @types/node from 24.2.1 to 24.3.0 ([858469e](https://github.com/BayBreezy/ui-thing-cli/commit/858469e))
38
+ - **deps-dev:** Bump knip from 5.62.0 to 5.63.0 ([0409d0f](https://github.com/BayBreezy/ui-thing-cli/commit/0409d0f))
39
+ - **deps-dev:** Bump @ianvs/prettier-plugin-sort-imports ([1dc849d](https://github.com/BayBreezy/ui-thing-cli/commit/1dc849d))
40
+ - Update package.json to add linting scripts and ESLint configuration ([f836ee1](https://github.com/BayBreezy/ui-thing-cli/commit/f836ee1))
41
+ - Update ESLint configuration to disable no-explicit-any rule ([112a5dd](https://github.com/BayBreezy/ui-thing-cli/commit/112a5dd))
42
+
43
+ ### 🎨 Styles
44
+
45
+ - **eslint:** Fix eslint errors ([3972b3d](https://github.com/BayBreezy/ui-thing-cli/commit/3972b3d))
46
+
47
+ ### ❤️ Contributors
48
+
49
+ - Behon Baker
50
+
3
51
  ## v0.2.4
4
52
 
5
53
  [compare changes](https://github.com/BayBreezy/ui-thing-cli/compare/v0.2.3...v0.2.4)
package/README.md CHANGED
@@ -49,7 +49,7 @@ npx ui-thing@latest add
49
49
  npx ui-thing@latest init
50
50
  ```
51
51
 
52
- This command will install the dependencies and add the required configuration to your project.
52
+ This command will install the dependencies and add the required configuration to your project. It will also add a `.prettierrc` file to your project.
53
53
 
54
54
  ### `add`
55
55
 
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import{Command as Ue}from"commander";var H="0.2.3";import E from"path";import{updateConfig as no}from"c12/update";import{Command as Jo}from"commander";import{consola as S}from"consola";import u from"kleur";import g from"lodash";import A from"prompts";import{join as Q}from"path";import{loadConfig as Fo}from"c12";import f from"fs-extra";import Ko from"lodash";import{loadFile as Ao,writeFile as Lo}from"magicast";import{addNuxtModule as Uo}from"magicast/helpers";import Po from"prompts";var b="ui-thing.config.ts",W={theme:"zinc",tailwindCSSLocation:"assets/css/tailwind.css",componentsLocation:"components/Ui",composablesLocation:"composables",pluginsLocation:"plugins",utilsLocation:"utils",force:!0,useDefaultFilename:!0,packageManager:"npm"},V={theme:"zinc",tailwindCSSLocation:"app/assets/css/tailwind.css",componentsLocation:"app/components/Ui",composablesLocation:"app/composables",pluginsLocation:"app/plugins",utilsLocation:"app/utils",force:!0,useDefaultFilename:!0,packageManager:"npm"},z=["tailwindcss","motion-v","@tailwindcss/vite","reka-ui","tailwind-variants","tailwind-merge","@nuxt/fonts","@nuxtjs/color-mode","@nuxt/icon","@vueuse/nuxt","@tailwindcss/forms"],Y=["typescript","prettier-plugin-tailwindcss","prettier","@ianvs/prettier-plugin-sort-imports","tw-animate-css"],J=["@nuxtjs/color-mode","motion-v/nuxt","@vueuse/nuxt","@nuxt/icon","@nuxt/fonts"],m=[{title:"Npm",value:"npm"},{title:"Yarn",value:"yarn"},{title:"Pnpm",value:"pnpm"},{title:"Bun",value:"bun"}],v=[{title:"Zinc",value:"zinc"},{title:"Slate",value:"slate"},{title:"Stone",value:"stone"},{title:"Gray",value:"gray"},{title:"Neutral",value:"neutral"},{title:"Red",value:"red"},{title:"Rose",value:"rose"},{title:"Orange",value:"orange"},{title:"Green",value:"green"},{title:"Blue",value:"blue"},{title:"Yellow",value:"yellow"},{title:"Violet",value:"violet"}];import Mo from"fs";function X(){try{let o=JSON.parse(Mo.readFileSync("package.json","utf-8")),r=o.dependencies?.nuxt||o.devDependencies?.nuxt;if(r)return/^[~^>=<\s]*4/.test(r)?4:3}catch{return 4}return 4}import Z from"kleur";import Oo from"prompts";var q=async o=>{let r=await Oo([{name:"theme",type:"autocomplete",message:"Which theme do you want to start with?",choices:v},{name:"tailwindCSSLocation",type:"text",message:"Where is your tailwind.css file located?",initial:(e,t)=>o==3?"assets/css/tailwind.css":"app/assets/css/tailwind.css"},{name:"componentsLocation",type:"text",message:"Where should your components be stored?",initial:(e,t)=>o==3?"components/Ui":"app/components/Ui"},{name:"composablesLocation",type:"text",message:"Where should your composables be stored?",initial:(e,t)=>o==3?"composables":"app/composables"},{name:"pluginsLocation",type:"text",message:"Where should your plugins be stored?",initial:(e,t)=>o==3?"plugins":"app/plugins"},{name:"utilsLocation",type:"text",message:"Where should your utils be stored?",initial:(e,t)=>o==3?"utils":"app/utils"},{name:"force",type:"confirm",message:"Should we just replace component files if they already exist?",initial:!0},{name:"useDefaultFilename",type:"confirm",message:"Would you like to use the default filename when adding components?",initial:!0},{name:"packageManager",type:"select",message:"Which package manager do you use?",choices:m}]);return!r||Object.keys(r).length<9?(console.log(Z.red(Z.bold("Incomplete configuration submitted. Exiting..."))),process.exit(0)):r};var oo=process.cwd(),s=async o=>{let r=f.existsSync(b),e={},t=Number(o?.nuxtVersion)||X();if(!r||o?.force){if(e=o?.yes?t===4?V:W:await q(t),await f.writeFile(b,`export default ${JSON.stringify(e,null,2)}`),e.packageManager==="pnpm"){let i=f.existsSync(".npmrc"),a=!0;if(i){let{confirmCreateNpmrc:d}=await Po({type:"confirm",name:"confirmCreateNpmrc",message:"A .npmrc file already exists. Overwrite it?",initial:!1});a=d}a&&await f.writeFile(".npmrc",`shamefully-hoist=true
2
+ import{Command as je}from"commander";var V="0.2.5";import T from"path";import{updateConfig as io}from"c12/update";import{Command as qo}from"commander";import{consola as I}from"consola";import p from"kleur";import b from"lodash";import U from"prompts";import{join as oo}from"path";import{loadConfig as Lo}from"c12";import g from"fs-extra";import Uo from"lodash";import{loadFile as Po,writeFile as Ro}from"magicast";import{addNuxtModule as jo}from"magicast/helpers";import Do from"prompts";var w="ui-thing.config.ts",W={theme:"zinc",tailwindCSSLocation:"assets/css/tailwind.css",componentsLocation:"components/Ui",composablesLocation:"composables",pluginsLocation:"plugins",utilsLocation:"utils",force:!0,useDefaultFilename:!0,packageManager:"npm"},z={theme:"zinc",tailwindCSSLocation:"app/assets/css/tailwind.css",componentsLocation:"app/components/Ui",composablesLocation:"app/composables",pluginsLocation:"app/plugins",utilsLocation:"app/utils",force:!0,useDefaultFilename:!0,packageManager:"npm"},Y=["tailwindcss","motion-v","@tailwindcss/vite","reka-ui","tailwind-variants","tailwind-merge","@nuxt/fonts","@nuxtjs/color-mode","@nuxt/icon","@vueuse/nuxt","@tailwindcss/forms"],J=["typescript","tw-animate-css"],C=["prettier-plugin-tailwindcss","prettier","@ianvs/prettier-plugin-sort-imports"],X=["@nuxtjs/color-mode","motion-v/nuxt","@vueuse/nuxt","@nuxt/icon","@nuxt/fonts"],f=[{title:"Npm",value:"npm"},{title:"Yarn",value:"yarn"},{title:"Pnpm",value:"pnpm"},{title:"Bun",value:"bun"}],y=[{title:"Zinc",value:"zinc"},{title:"Slate",value:"slate"},{title:"Stone",value:"stone"},{title:"Gray",value:"gray"},{title:"Neutral",value:"neutral"},{title:"Red",value:"red"},{title:"Rose",value:"rose"},{title:"Orange",value:"orange"},{title:"Green",value:"green"},{title:"Blue",value:"blue"},{title:"Yellow",value:"yellow"},{title:"Violet",value:"violet"}];import Ko from"fs";function Z(){try{let o=JSON.parse(Ko.readFileSync("package.json","utf-8")),r=o.dependencies?.nuxt||o.devDependencies?.nuxt;if(r)return/^[~^>=<\s]*4/.test(r)?4:3}catch{return 4}return 4}import q from"kleur";import Ao from"prompts";var Q=async o=>{let r=await Ao([{name:"theme",type:"autocomplete",message:"Which theme do you want to start with?",choices:y},{name:"tailwindCSSLocation",type:"text",message:"Where is your tailwind.css file located?",initial:(e,t)=>o==3?"assets/css/tailwind.css":"app/assets/css/tailwind.css"},{name:"componentsLocation",type:"text",message:"Where should your components be stored?",initial:(e,t)=>o==3?"components/Ui":"app/components/Ui"},{name:"composablesLocation",type:"text",message:"Where should your composables be stored?",initial:(e,t)=>o==3?"composables":"app/composables"},{name:"pluginsLocation",type:"text",message:"Where should your plugins be stored?",initial:(e,t)=>o==3?"plugins":"app/plugins"},{name:"utilsLocation",type:"text",message:"Where should your utils be stored?",initial:(e,t)=>o==3?"utils":"app/utils"},{name:"force",type:"confirm",message:"Should we just replace component files if they already exist?",initial:!0},{name:"useDefaultFilename",type:"confirm",message:"Would you like to use the default filename when adding components?",initial:!0},{name:"packageManager",type:"select",message:"Which package manager do you use?",choices:f}]);return!r||Object.keys(r).length<9?(console.log(q.red(q.bold("Incomplete configuration submitted. Exiting..."))),process.exit(0)):r};var eo=process.cwd(),l=async o=>{let r=g.existsSync(w),e={},t=Number(o?.nuxtVersion)||Z();if(!r||o?.force){if(e=o?.yes?t===4?z:W:await Q(t),await g.writeFile(w,`export default ${JSON.stringify(e,null,2)}`),e.packageManager==="pnpm"){let c=g.existsSync(".npmrc"),n=!0;if(c){let{confirmCreateNpmrc:i}=await Do({type:"confirm",name:"confirmCreateNpmrc",message:"A .npmrc file already exists. Overwrite it?",initial:!1});n=i}n&&await g.writeFile(".npmrc",`shamefully-hoist=true
3
3
  strict-peer-dependencies=false
4
- `)}}else e=(await Fo({configFile:b.replace(".ts","")})).config;return Ko.isEmpty(e)?s({force:!0}):(jo(e),e)},jo=o=>{let r=(e,t=!1)=>{e&&(t?f.ensureDirSync(e):f.ensureFileSync(e))};r(o.tailwindCSSLocation),r(o.pluginsLocation,!0),r(o.componentsLocation,!0),r(o.composablesLocation,!0),r(o.utilsLocation,!0)},eo=async o=>{if(!o)return;let r=typeof o=="string"?[o]:o,e=await Ao(Q(oo,"nuxt.config.ts"));r.forEach(t=>Uo(e,t)),await Lo(e,Q(oo,"nuxt.config.ts"))};var w=async()=>{let o=await s(),r={nuxtVersion:3,theme:"string",tailwindCSSLocation:"string",componentsLocation:"string",composablesLocation:"string",utilsLocation:"string",force:!0,useDefaultFilename:!0,packageManager:"string"},e=[];for(let t of Object.keys(r))o[t]===void 0&&e.push(t);return!(e.length>1)};import Do from"axios";import Ro from"dotenv";import $o from"ora";Ro.config();var ro=async()=>{let o=$o("Fetching components...").start(),{data:r}=await Do.get(process.env.COMPONENTS_API||"https://uithing.com/api/components");return o.succeed("Components fetched."),r};import _ from"fs";var C=async o=>{try{return await _.promises.access(o,_.constants.F_OK||_.constants.W_OK),!0}catch{return!1}};import{execa as M}from"execa";import x from"lodash";import Go from"ora";var h=async(o,r,e)=>{typeof r=="string"&&(r=[r]),typeof e=="string"&&(e=[e]);let t=Go("Installing dependencies...").start();!x.isUndefined(r)&&!x.isEmpty(r)&&await M(o,[o==="yarn"?"add":"install",...r]),t.text="Installing dev dependencies...",!x.isUndefined(e)&&!x.isEmpty(e)&&await M(o,[o==="yarn"?"add":"install","-D",...e]),t.text="Running nuxt prepare...",await M`npx -y nuxt prepare`,t.succeed("Installed dependencies!")};import Bo from"prompts";var to=async o=>{let r={yup:["yup","@vee-validate/yup"],zod:["zod","@vee-validate/zod"],joi:["joi","@vee-validate/joi"],valibot:["valibot","@vee-validate/valibot"]},{validator:e}=await Bo({type:"select",name:"validator",message:"Choose the validator package to use with Vee Validate: ",choices:[{title:"Yup",value:"yup"},{title:"Zod",value:"zod"},{title:"Joi",value:"joi"},{title:"Valibot",value:"valibot"}]});if(!e){console.log("No validator package selected");return}return console.log(`Selected ${e} as the validator package`),r[e]&&await h(o,r[e]),e};import Ho from"boxen";import Wo from"figlet";var Vo=(o,r,e={})=>{let{box:t,figletFont:i}=e,a=Wo.textSync(o,{font:i||"Standard"}),n=Ho(a,{...{borderColor:"greenBright",padding:1,borderStyle:"round",titleAlignment:"center"},...t});return r?`${n}
5
- ${r}`:n},l=(o,r,e)=>{console.log(`
6
- `+Vo(o,r,e))};import zo from"prompts";var co=async(o,r=[])=>{if(o)return r.map(t=>t.value);let{components:e}=await zo({type:"autocompleteMultiselect",name:"components",message:"Select the components you want to add",choices:r.map(t=>({title:t.name,value:t.value}))});return e};import O from"fs";import Yo from"path";var ao=async(o,r)=>{if(!await C(o)){let t=Yo.dirname(o);O.existsSync(t)||O.mkdirSync(t,{recursive:!0})}O.writeFileSync(o,r)};var L=[],y=process.cwd(),F=o=>L.find(r=>r.value.toLowerCase()===o.toLowerCase());async function io(o,r,e,t){if(await C(o)&&!e){let{value:a}=await A({type:"confirm",name:"value",message:t,initial:!1});if(!a)return S.info(`Skipped: ${u.cyan(E.basename(o))}`),!1}return await ao(o,r),!0}async function K(o,r,e,t){for(let i of r){let a=E.join(y,e,i.fileName);await io(a,i.fileContent,t,`The ${o} file ${u.bold(i.fileName)} already exists. Overwrite?`)}}var Xo=async(o,r)=>{let e=await s();await w()||(e=await s({force:!0})),g.isEmpty(e)&&(S.info("Config file not set. Exiting..."),process.exit(0)),L=await ro();let t=o;if(t.length===0){let c=await co(r.all,L);(!c||c.length===0)&&(S.info("No components selected. Exiting..."),process.exit(0)),t=c}let i=t.filter(c=>!F(c));i.length>0&&S.error(`Not found: ${u.bgRed(i.join(", "))}`);let a=t.map(c=>F(c)).filter(Boolean);for(let c of[...a])c.components&&c.components.forEach(p=>{a.find(k=>k.value===p)||a.push(F(p))});for(let c of a)for(let p of c.files){let k=e.componentsLocation,G=E.join(y,k,p.fileName);if(!e.useDefaultFilename){let{value:B}=await A({type:"text",name:"value",message:`Where should we add the file ${u.cyan(p.fileName)}?`,initial:k});B&&(k=B,G=E.join(y,k,p.fileName))}await io(G,p.fileContent,e.force,`The file ${u.bold(p.fileName)} already exists. Overwrite?`)&&((c.value==="vue-sonner"||c.value==="sonner")&&await Zo(),c.value==="datatable"&&await qo(),await K("utils",c.utils,e.utilsLocation,e.force),await K("composables",c.composables,e.composablesLocation,e.force),await K("plugins",c.plugins,e.pluginsLocation??"",e.force))}await eo(g.uniq(a.flatMap(c=>c.nuxtModules||[])));let d=g.uniq(a.flatMap(c=>c.deps||[])),n=g.uniq(a.flatMap(c=>c.devDeps||[]));if(d.length>0||n.length>0)if(r.all)await h(e.packageManager,d,n);else{let{confirmInstall:c}=await A({type:"confirm",name:"confirmInstall",message:`Install packages: ${u.cyan([...d,...n].join(", "))}?`,initial:!0});c&&await h(e.packageManager,d,n)}a.some(c=>c.askValidator)&&await to(e.packageManager),l("All Done!",`Run the ${u.cyan("ui-thing@latest --help")} command to learn more.
7
- `,{box:{title:"Components Added"}});let $=g.compact(a.flatMap(c=>c.instructions));$.length>0&&(console.log(""),console.log(u.bgCyan(" Instructions ")),$.forEach(c=>console.log(`${u.cyan("-")} ${c}`)))},so=new Jo().name("add").command("add").description("Add a list of components to your project.").option("-a --all","Add all components to your project.",!1).argument("[componentNames...]","Components that you want to add.").action(Xo);async function Zo(){await no({configFile:"nuxt.config",cwd:y,onUpdate(o){o.imports||={imports:[]},o.imports.imports.find(r=>r.from==="vue-sonner"&&r.name==="toast")||o.imports.imports.push({from:"vue-sonner",name:"toast",as:"useSonner"})}})}async function qo(){await no({configFile:"nuxt.config",cwd:y,onUpdate(o){o.app||={head:{script:[]}},["https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.12/pdfmake.min.js","https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.12/vfs_fonts.min.js"].forEach(e=>{o.app.head.script.find(t=>t.src===e)||o.app.head.script.push({src:e,defer:!0})})}})}import Se from"path";import{updateConfig as Ee}from"c12/update";import{Command as Ie}from"commander";import fo from"fs-extra";import D from"kleur";import Ne from"ora";var Qo=`@import "tailwindcss";
4
+ `)}}else e=(await Lo({configFile:w.replace(".ts","")})).config;return Uo.isEmpty(e)?l({force:!0}):($o(e),e)},$o=o=>{let r=(e,t=!1)=>{e&&(t?g.ensureDirSync(e):g.ensureFileSync(e))};r(o.tailwindCSSLocation),r(o.pluginsLocation,!0),r(o.componentsLocation,!0),r(o.composablesLocation,!0),r(o.utilsLocation,!0)},ro=async o=>{if(!o)return;let r=typeof o=="string"?[o]:o,e=await Po(oo(eo,"nuxt.config.ts"));r.forEach(t=>jo(e,t)),await Ro(e,oo(eo,"nuxt.config.ts"))};var x=async()=>{let o=await l(),r={nuxtVersion:3,theme:"string",tailwindCSSLocation:"string",componentsLocation:"string",composablesLocation:"string",utilsLocation:"string",force:!0,useDefaultFilename:!0,packageManager:"string"},e=[];for(let t of Object.keys(r))o[t]===void 0&&e.push(t);return!(e.length>1)};import Go from"axios";import Bo from"dotenv";import Ho from"ora";Bo.config();var to=async()=>{let o=Ho("Fetching components...").start(),{data:r}=await Go.get(process.env.COMPONENTS_API||"https://uithing.com/api/components");return o.succeed("Components fetched."),r};import O from"fs";var S=async o=>{try{return await O.promises.access(o,O.constants.F_OK||O.constants.W_OK),!0}catch{return!1}};import{execa as F}from"execa";import E from"lodash";import Vo from"ora";var u=async(o,r,e)=>{typeof r=="string"&&(r=[r]),typeof e=="string"&&(e=[e]);let t=Vo("Installing dependencies...").start();!E.isUndefined(r)&&!E.isEmpty(r)&&await F(o,[o==="yarn"?"add":"install",...r]),t.text="Installing dev dependencies...",!E.isUndefined(e)&&!E.isEmpty(e)&&await F(o,[o==="yarn"?"add":"install","-D",...e]),t.text="Running nuxt prepare...",await F`npx -y nuxt prepare`,t.succeed("Installed dependencies!")};import Wo from"prompts";var co=async o=>{let r={yup:["yup","@vee-validate/yup"],zod:["zod","@vee-validate/zod"],joi:["joi","@vee-validate/joi"],valibot:["valibot","@vee-validate/valibot"]},{validator:e}=await Wo({type:"select",name:"validator",message:"Choose the validator package to use with Vee Validate: ",choices:[{title:"Yup",value:"yup"},{title:"Zod",value:"zod"},{title:"Joi",value:"joi"},{title:"Valibot",value:"valibot"}]});if(!e){console.log("No validator package selected");return}return console.log(`Selected ${e} as the validator package`),r[e]&&await u(o,r[e]),e};import zo from"boxen";import Yo from"figlet";var Jo=(o,r,e={})=>{let{box:t,figletFont:c}=e,n=Yo.textSync(o,{font:c||"Standard"}),h=zo(n,{...{borderColor:"greenBright",padding:1,borderStyle:"round",titleAlignment:"center"},...t});return r?`${h}
5
+ ${r}`:h},d=(o,r,e)=>{console.log(`
6
+ `+Jo(o,r,e))};import Xo from"prompts";var ao=async(o,r=[])=>{if(o)return r.map(t=>t.value);let{components:e}=await Xo({type:"autocompleteMultiselect",name:"components",message:"Select the components you want to add",choices:r.map(t=>({title:t.name,value:t.value}))});return e};import K from"fs";import Zo from"path";var no=async(o,r)=>{if(!await S(o)){let t=Zo.dirname(o);K.existsSync(t)||K.mkdirSync(t,{recursive:!0})}K.writeFileSync(o,r)};var P=[],v=process.cwd(),A=o=>P.find(r=>r.value.toLowerCase()===o.toLowerCase());async function so(o,r,e,t){if(await S(o)&&!e){let{value:n}=await U({type:"confirm",name:"value",message:t,initial:!1});if(!n)return I.info(`Skipped: ${p.cyan(T.basename(o))}`),!1}return await no(o,r),!0}async function L(o,r,e,t){for(let c of r){let n=T.join(v,e,c.fileName);await so(n,c.fileContent,t,`The ${o} file ${p.bold(c.fileName)} already exists. Overwrite?`)}}var Qo=async(o,r)=>{let e=await l();await x()||(e=await l({force:!0})),b.isEmpty(e)&&(I.info("Config file not set. Exiting..."),process.exit(0)),P=await to();let t=o;if(t.length===0){let a=await ao(r.all,P);(!a||a.length===0)&&(I.info("No components selected. Exiting..."),process.exit(0)),t=a}let c=t.filter(a=>!A(a));c.length>0&&I.error(`Not found: ${p.bgRed(c.join(", "))}`);let n=t.map(a=>A(a)).filter(Boolean);for(let a of[...n])a.components&&a.components.forEach(k=>{n.find(m=>m.value===k)||n.push(A(k))});for(let a of n)for(let k of a.files){let m=e.componentsLocation,B=T.join(v,m,k.fileName);if(!e.useDefaultFilename){let{value:H}=await U({type:"text",name:"value",message:`Where should we add the file ${p.cyan(k.fileName)}?`,initial:m});H&&(m=H,B=T.join(v,m,k.fileName))}await so(B,k.fileContent,e.force,`The file ${p.bold(k.fileName)} already exists. Overwrite?`)&&((a.value==="vue-sonner"||a.value==="sonner")&&await oe(),a.value==="datatable"&&await ee(),await L("utils",a.utils,e.utilsLocation,e.force),await L("composables",a.composables,e.composablesLocation,e.force),await L("plugins",a.plugins,e.pluginsLocation??"",e.force))}await ro(b.uniq(n.flatMap(a=>a.nuxtModules||[])));let i=b.uniq(n.flatMap(a=>a.deps||[])),h=b.uniq(n.flatMap(a=>a.devDeps||[]));if(i.length>0||h.length>0)if(r.all)await u(e.packageManager,i,h);else{let{confirmInstall:a}=await U({type:"confirm",name:"confirmInstall",message:`Install packages: ${p.cyan([...i,...h].join(", "))}?`,initial:!0});a&&await u(e.packageManager,i,h)}n.some(a=>a.askValidator)&&await co(e.packageManager),d("All Done!",`Run the ${p.cyan("ui-thing@latest --help")} command to learn more.
7
+ `,{box:{title:"Components Added"}});let s=b.compact(n.flatMap(a=>a.instructions));s.length>0&&(console.log(""),console.log(p.bgCyan(" Instructions ")),s.forEach(a=>console.log(`${p.cyan("-")} ${a}`)))},lo=new qo().name("add").command("add").description("Add a list of components to your project.").option("-a --all","Add all components to your project.",!1).argument("[componentNames...]","Components that you want to add.").action(Qo);async function oe(){await io({configFile:"nuxt.config",cwd:v,onUpdate(o){o.imports||={imports:[]},o.imports.imports.find(r=>r.from==="vue-sonner"&&r.name==="toast")||o.imports.imports.push({from:"vue-sonner",name:"toast",as:"useSonner"})}})}async function ee(){await io({configFile:"nuxt.config",cwd:v,onUpdate(o){o.app||={head:{script:[]}},["https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.12/pdfmake.min.js","https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.12/vfs_fonts.min.js"].forEach(e=>{o.app.head.script.find(t=>t.src===e)||o.app.head.script.push({src:e,defer:!0})})}})}import Ie from"path";import{updateConfig as Te}from"c12/update";import{Command as _e}from"commander";import bo from"fs-extra";import $ from"kleur";import Ne from"ora";var re=`@import "tailwindcss";
8
8
  @import "tw-animate-css";
9
9
 
10
10
  @plugin "@tailwindcss/forms" {
@@ -129,7 +129,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
129
129
  --gradient-rust: oklch(55.695% 0.19944 34.155);
130
130
  }
131
131
 
132
- `,oe=`@layer base {
132
+ `,te=`@layer base {
133
133
  * {
134
134
  @apply border-border outline-ring/50;
135
135
  }
@@ -158,7 +158,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
158
158
  cursor: pointer;
159
159
  }
160
160
  }
161
- `,I=o=>(lo[o]||(o="ZINC"),`${Qo}${lo[o]}${oe}`),ee=`
161
+ `,_=o=>(ho[o]||(o="ZINC"),`${re}${ho[o]}${te}`),ce=`
162
162
  :root {
163
163
  --radius: 0.65rem;
164
164
  --background: oklch(1 0 0);
@@ -228,7 +228,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
228
228
  --sidebar-ring: oklch(0.556 0 0);
229
229
  }
230
230
 
231
- `,re=`
231
+ `,ae=`
232
232
  :root {
233
233
  --radius: 0.625rem;
234
234
  --background: oklch(1 0 0);
@@ -298,7 +298,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
298
298
  --sidebar-ring: oklch(0.551 0.027 264.364);
299
299
  }
300
300
 
301
- `,te=`
301
+ `,ne=`
302
302
  :root {
303
303
  --radius: 0.625rem;
304
304
  --background: oklch(1 0 0);
@@ -367,7 +367,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
367
367
  --sidebar-ring: oklch(0.553 0.013 58.071);
368
368
  }
369
369
 
370
- `,ce=`
370
+ `,ie=`
371
371
  :root {
372
372
  --radius: 0.625rem;
373
373
  --background: oklch(1 0 0);
@@ -437,7 +437,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
437
437
  --sidebar-ring: oklch(0.551 0.027 264.364);
438
438
  }
439
439
 
440
- `,ae=`
440
+ `,se=`
441
441
  :root {
442
442
  --radius: 0.625rem;
443
443
  --background: oklch(1 0 0);
@@ -507,7 +507,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
507
507
  --sidebar-ring: oklch(0.556 0 0);
508
508
  }
509
509
 
510
- `,ne=`
510
+ `,le=`
511
511
  :root {
512
512
  --radius: 0.65rem;
513
513
  --background: oklch(1 0 0);
@@ -577,7 +577,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
577
577
  --sidebar-ring: oklch(0.637 0.237 25.331);
578
578
  }
579
579
 
580
- `,ie=`
580
+ `,de=`
581
581
  :root {
582
582
  --radius: 0.65rem;
583
583
  --background: oklch(1 0 0);
@@ -647,7 +647,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
647
647
  --sidebar-ring: oklch(0.645 0.246 16.439);
648
648
  }
649
649
 
650
- `,se=`
650
+ `,he=`
651
651
  :root {
652
652
  --radius: 0.65rem;
653
653
  --background: oklch(1 0 0);
@@ -717,7 +717,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
717
717
  --sidebar-ring: oklch(0.646 0.222 41.116);
718
718
  }
719
719
 
720
- `,le=`
720
+ `,ue=`
721
721
  :root {
722
722
  --radius: 0.65rem;
723
723
  --background: oklch(1 0 0);
@@ -787,7 +787,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
787
787
  --sidebar-ring: oklch(0.527 0.154 150.069);
788
788
  }
789
789
 
790
- `,de=`
790
+ `,pe=`
791
791
  :root {
792
792
  --radius: 0.65rem;
793
793
  --background: oklch(1 0 0);
@@ -857,7 +857,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
857
857
  --sidebar-ring: oklch(0.488 0.243 264.376);
858
858
  }
859
859
 
860
- `,he=`
860
+ `,ke=`
861
861
  :root {
862
862
  --radius: 0.65rem;
863
863
  --background: oklch(1 0 0);
@@ -927,7 +927,7 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
927
927
  --sidebar-ring: oklch(0.554 0.135 66.442);
928
928
  }
929
929
 
930
- `,ue=`
930
+ `,me=`
931
931
  :root {
932
932
  --radius: 0.65rem;
933
933
  --background: oklch(1 0 0);
@@ -997,16 +997,16 @@ ${r}`:n},l=(o,r,e)=>{console.log(`
997
997
  --sidebar-ring: oklch(0.541 0.281 293.009);
998
998
  }
999
999
 
1000
- `,lo={ZINC:ee,SLATE:re,STONE:te,GRAY:ce,NEUTRAL:ae,RED:ne,ROSE:ie,ORANGE:se,GREEN:le,BLUE:de,YELLOW:he,VIOLET:ue};var ho=`/**
1000
+ `,ho={ZINC:ce,SLATE:ae,STONE:ne,GRAY:ie,NEUTRAL:se,RED:le,ROSE:de,ORANGE:he,GREEN:ue,BLUE:pe,YELLOW:ke,VIOLET:me};var uo=`/**
1001
1001
  * Utility function to return Tailwind CSS classes.
1002
1002
  */
1003
1003
  export const tw = <T extends TemplateStringsArray | string>(tailwindClasses: T) => tailwindClasses;
1004
- `;import{join as pe}from"path";import{$ as ke}from"execa";import U from"fs-extra";import me from"ora";import fe from"prompts";var N={arrowParens:"always",endOfLine:"lf",plugins:["@ianvs/prettier-plugin-sort-imports","prettier-plugin-tailwindcss"],printWidth:100,semi:!0,singleQuote:!1,tabWidth:2,trailingComma:"es5",useTabs:!1,vueIndentScriptAndStyle:!0,tailwindFunctions:["tv"],importOrder:["<BUILTIN_MODULES>","<THIRD_PARTY_MODULES>","<TYPES>","","^[.]"]};var T=async(o=process.cwd(),r=!0)=>{let e=pe(o,".prettierrc"),t=N;if(U.existsSync(e)){let a=await U.readFile(e,"utf-8"),d={};try{d=JSON.parse(a)}catch{console.warn("\u26A0\uFE0F Existing .prettierrc is not valid JSON \u2014 will prompt for overwrite.")}let n=await fe({name:"merge",type:"select",message:"A prettier config file already exists. What would you like to do?",choices:[{title:"Merge configs",value:"merge"},{title:"Overwrite with new config",value:"overwrite"},{title:"Cancel",value:"cancel"}],initial:0});if(n.merge==="merge")t={...d,...N};else if(n.merge==="overwrite")t=N;else return!1}if(await U.writeFile(e,JSON.stringify(t,null,2),"utf-8"),!r)return!0;let i=me("Formatting files with prettier...").start();return await ke`npx prettier --write .`,i.succeed("Files formatted with prettier"),!0};import{join as ge}from"path";import{builders as ye,loadFile as be,writeFile as ve}from"magicast";import{getDefaultExportOptions as we}from"magicast/helpers";var uo=async()=>{let o=ge(process.cwd(),"nuxt.config.ts"),r=await be(o);if(!r.$code.includes("tailwindcss()")){let e=we(r);e.vite||={},e.vite.plugins||=[],e.vite.plugins.push(ye.functionCall("tailwindcss"))}r.imports.$items.find(e=>e.local==="tailwindcss")||r.imports.$prepend({from:"@tailwindcss/vite",local:"tailwindcss",imported:"default"}),await ve(r,o)};import xe from"fs-extra";var po={recommendations:["vue.volar","bradlc.vscode-tailwindcss","esbenp.prettier-vscode","antfu.iconify","formulahendry.auto-close-tag","formulahendry.auto-rename-tag"]},ko={"editor.formatOnSave":!0,"editor.quickSuggestions":{strings:"on"},"files.associations":{"*.css":"tailwindcss"},"tailwindCSS.classFunctions":["tw","clsx","tw\\.[a-z-]+"],"tailwindCSS.experimental.classRegex":[["([\"'`][^\"'`]*.*?[\"'`])","[\"'`]([^\"'`]*)[\"'`]"]]};import{merge as Ce}from"es-toolkit";import P from"fs-extra";function j(o,r){let e={};if(P.existsSync(o))try{e=P.readJsonSync(o)}catch{console.warn(`\u26A0\uFE0F Could not parse ${o}, starting fresh.`)}let t=Ce(e,r);P.writeJsonSync(o,t,{spaces:2})}var mo=(o=".vscode")=>{xe.ensureDirSync(o),j(`${o}/extensions.json`,po),j(`${o}/settings.json`,ko)};var Te=async o=>{let r=await s(o),e=Ne("Updating nuxt.config...").start();await Ee({cwd:process.cwd(),configFile:"nuxt.config",async onUpdate(t){t.modules||(t.modules=[]),t.imports||(t.imports={imports:[]});for(let n of J)t.modules.includes(n)||t.modules.push(n);if(!t.colorMode){let n=Se.basename(process.cwd());t.colorMode={storageKey:`${n}-color-mode`,classSuffix:""}}t.icon||(t.icon={clientBundle:{scan:!0,sizeLimitKb:0},mode:"svg",class:"shrink-0",fetchTimeout:2e3,serverBundle:"local"}),t.imports.imports.find(n=>n.from==="tailwind-variants"&&n.name==="tv")||t.imports.imports.push({from:"tailwind-variants",name:"tv"}),t.imports.imports.find(n=>n.from==="tailwind-variants"&&n.name==="VariantProps")||t.imports.imports.push({from:"tailwind-variants",name:"VariantProps",type:!0}),t.css||=[];let i=r.tailwindCSSLocation?.split("app/")[1],a=`~/${i}`,d=`@/${i}`;!t.css.includes(a)&&!t.css.includes(d)&&t.css.push(a)}}),await uo(),e.succeed("Updated nuxt.config!"),e.start("Adding initial Tailwind CSS file..."),fo.writeFileSync(r.tailwindCSSLocation,I(r.theme.toUpperCase()),"utf-8"),e.succeed("Added initial Tailwind CSS file!"),e.start("Adding Autocomplete helper..."),fo.writeFileSync(r.utilsLocation+"/tw-helper.ts",ho,"utf-8"),e.succeed("Added Autocomplete helper!"),e.start("Merging VS Code settings..."),mo(),e.succeed("Merged VS Code settings!"),await h(r.packageManager,z,Y),await T(),l("Initialized",`Feel free to start adding components with the ${D.bgWhite(" add ")} command.`,{box:{title:"Complete"}})},go=new Ie().command("init").name("init").summary("Initialize UI Thing in your Nuxt project.").description(`${D.bold("Initialize UI Thing in your Nuxt project.")}
1004
+ `;import{join as fe}from"path";import{$ as ge}from"execa";import R from"fs-extra";import ye from"ora";import po from"prompts";var N={arrowParens:"always",endOfLine:"lf",plugins:["@ianvs/prettier-plugin-sort-imports","prettier-plugin-tailwindcss"],printWidth:100,semi:!0,singleQuote:!1,tabWidth:2,trailingComma:"es5",useTabs:!1,vueIndentScriptAndStyle:!0,tailwindFunctions:["tv"],importOrder:["<BUILTIN_MODULES>","<THIRD_PARTY_MODULES>","<TYPES>","","^[.]"]};var M=async(o=process.cwd(),r=!0)=>{let e=fe(o,".prettierrc"),t=N;if(R.existsSync(e)){let n=await R.readFile(e,"utf-8"),i={};try{i=JSON.parse(n)}catch{console.warn("\u26A0\uFE0F Existing .prettierrc is not valid JSON \u2014 will prompt for overwrite.")}let h=await po({name:"merge",type:"select",message:"A prettier config file already exists. What would you like to do?",choices:[{title:"Merge configs",value:"merge"},{title:"Overwrite with new config",value:"overwrite"},{title:"Cancel",value:"cancel"}],initial:0});if(h.merge==="merge")t={...i,...N};else if(h.merge==="overwrite")t=N;else return!1}if(await R.writeFile(e,JSON.stringify(t,null,2),"utf-8"),!r)return!0;let c=ye("Formatting files with prettier...").start();return await ge`npx prettier --write .`,c.succeed("Files formatted with prettier"),!0},ko=async()=>{let{addPrettier:o}=await po({name:"addPrettier",type:"confirm",message:"Would you like to add a Prettier configuration to your project?",initial:!0});return o};import{join as be}from"path";import{builders as ve,loadFile as we,writeFile as Ce}from"magicast";import{getDefaultExportOptions as xe}from"magicast/helpers";var mo=async()=>{let o=be(process.cwd(),"nuxt.config.ts"),r=await we(o);if(!r.$code.includes("tailwindcss()")){let e=xe(r);e.vite||={},e.vite.plugins||=[],e.vite.plugins.push(ve.functionCall("tailwindcss"))}r.imports.$items.find(e=>e.local==="tailwindcss")||r.imports.$prepend({from:"@tailwindcss/vite",local:"tailwindcss",imported:"default"}),await Ce(r,o)};import Ee from"fs-extra";var fo={recommendations:["vue.volar","bradlc.vscode-tailwindcss","esbenp.prettier-vscode","antfu.iconify","formulahendry.auto-close-tag","formulahendry.auto-rename-tag"]},go={"editor.formatOnSave":!0,"editor.quickSuggestions":{strings:"on"},"files.associations":{"*.css":"tailwindcss"},"tailwindCSS.classFunctions":["tw","clsx","tw\\.[a-z-]+"],"tailwindCSS.experimental.classRegex":[["([\"'`][^\"'`]*.*?[\"'`])","[\"'`]([^\"'`]*)[\"'`]"]]};import{merge as Se}from"es-toolkit";import j from"fs-extra";function D(o,r){let e={};if(j.existsSync(o))try{e=j.readJsonSync(o)}catch{console.warn(`\u26A0\uFE0F Could not parse ${o}, starting fresh.`)}let t=Se(e,r);j.writeJsonSync(o,t,{spaces:2})}var yo=(o=".vscode")=>{Ee.ensureDirSync(o),D(`${o}/extensions.json`,fo),D(`${o}/settings.json`,go)};var Me=async o=>{let r=await l(o),e=Ne("Updating nuxt.config...").start();await Te({cwd:process.cwd(),configFile:"nuxt.config",async onUpdate(c){c.modules||(c.modules=[]),c.imports||(c.imports={imports:[]});for(let s of X)c.modules.includes(s)||c.modules.push(s);if(!c.colorMode){let s=Ie.basename(process.cwd());c.colorMode={storageKey:`${s}-color-mode`,classSuffix:""}}c.icon||(c.icon={clientBundle:{scan:!0,sizeLimitKb:0},mode:"svg",class:"shrink-0",fetchTimeout:2e3,serverBundle:"local"}),c.imports.imports.find(s=>s.from==="tailwind-variants"&&s.name==="tv")||c.imports.imports.push({from:"tailwind-variants",name:"tv"}),c.imports.imports.find(s=>s.from==="tailwind-variants"&&s.name==="VariantProps")||c.imports.imports.push({from:"tailwind-variants",name:"VariantProps",type:!0}),c.css||=[];let n=r.tailwindCSSLocation?.split("app/")[1],i=`~/${n}`,h=`@/${n}`;!c.css.includes(i)&&!c.css.includes(h)&&c.css.push(i)}}),await mo(),e.succeed("Updated nuxt.config!"),e.start("Adding initial Tailwind CSS file..."),bo.writeFileSync(r.tailwindCSSLocation,_(r.theme.toUpperCase()),"utf-8"),e.succeed("Added initial Tailwind CSS file!"),e.start("Adding Autocomplete helper..."),bo.writeFileSync(r.utilsLocation+"/tw-helper.ts",uo,"utf-8"),e.succeed("Added Autocomplete helper!"),e.start("Merging VS Code settings..."),yo(),e.succeed("Merged VS Code settings!"),await u(r.packageManager,Y,J),await ko()&&(await u(r.packageManager,[],C),await M()),d("Initialized",`Feel free to start adding components with the ${$.bgWhite(" add ")} command.`,{box:{title:"Complete"}})},vo=new _e().command("init").name("init").summary("Initialize UI Thing in your Nuxt project.").description(`${$.bold("Initialize UI Thing in your Nuxt project.")}
1005
1005
 
1006
1006
  \u2705 Add tailwindcss to your project
1007
1007
  \u2705 Update your nuxt.config file
1008
1008
  \u2705 Add the necessary dependencies
1009
- \u2705 Create a ${D.bold("ui-thing.config")} file with the default configuration`).option("-f --force","Overwrite config file if it exists.",!1).option("-y --yes","Skip prompts and use default values.",!1).option("-n --nuxtVersion <number>","Specify the Nuxt version you are using.").action(Te);import{Command as _e}from"commander";import Me from"prompts";var yo=new _e().command("prettier").name("prettier").description("Adds prettier config to your project.").action(async()=>{if(!await T(void 0,!1)){l("Not Added","Prettier config was not added.",{box:{title:"Prettier Not Added",borderColor:"red"}});return}let{pkgManager:r}=await Me({name:"pkgManager",type:"select",message:"Which package manager are you using?",choices:m});if(!r)return process.exit(0);await h(r,void 0,["prettier","prettier-plugin-tailwindcss","@ianvs/prettier-plugin-sort-imports"]),l("All Done!","A .prettierrc file has been added to your project and the code formatted. Enjoy!",{box:{title:"Prettier Added"}})});import{Command as Oe}from"commander";import{execa as Fe}from"execa";import Ke from"ora";import Ae from"prompts";import{join as vo}from"path";import wo from"fs-extra";var bo=`import {
1009
+ \u2705 Create a ${$.bold("ui-thing.config")} file with the default configuration`).option("-f --force","Overwrite config file if it exists.",!1).option("-y --yes","Skip prompts and use default values.",!1).option("-n --nuxtVersion <number>","Specify the Nuxt version you are using.").action(Me);import{Command as Oe}from"commander";import Fe from"prompts";var wo=new Oe().command("prettier").name("prettier").description("Adds prettier config to your project.").action(async()=>{if(!await M(void 0,!1)){d("Not Added","Prettier config was not added.",{box:{title:"Prettier Not Added",borderColor:"red"}});return}let{pkgManager:r}=await Fe({name:"pkgManager",type:"select",message:"Which package manager are you using?",choices:f});if(!r)return process.exit(0);await u(r,void 0,C),d("All Done!","A .prettierrc file has been added to your project and the code formatted. Enjoy!",{box:{title:"Prettier Added"}})});import{Command as Ke}from"commander";import{execa as Ae}from"execa";import Le from"ora";import Ue from"prompts";import{join as xo}from"path";import So from"fs-extra";var Co=`import {
1010
1010
  createSharedComposable,
1011
1011
  useActiveElement,
1012
1012
  useDebounceFn,
@@ -1326,5 +1326,5 @@ export function defineShortcuts(config: MaybeRef<ShortcutsConfig>, options: Shor
1326
1326
  return useEventListener("keydown", onKeyDown);
1327
1327
  }
1328
1328
 
1329
- `;var Co=async(o=process.cwd())=>{let r=await s(),e=vo(o,r.composablesLocation);await wo.ensureDir(e),await wo.writeFile(vo(e,"shortcuts.ts"),bo,"utf-8")};var xo=new Oe().command("shortcuts").name("shortcuts").description("Add the shortcuts composables to your project.").action(async()=>{await Co();let{pkgManager:o}=await Ae({name:"pkgManager",type:"select",message:"Which package manager are you using?",choices:m});if(!o)return process.exit(0);let r=Ke("Installing vueuse module...").start();await Fe`npx -y nuxi@latest module add vueuse`,r.succeed("VueUse module installed successfully!"),l("All Done!","Check the composables folder for the shortcuts composables.",{box:{title:"Composable Added"}})});import{Command as Le}from"commander";import So from"fs-extra";import Eo from"kleur";import R from"lodash";import Io from"prompts";var No=new Le().command("theme").name("theme").description("Add a new theme to your project.").action(async()=>{let o=await s();await w()||(o=await s({force:!0})),R.isEmpty(o)&&(console.log(Eo.red("Config file not set. Exiting...")),process.exit(0));let{theme:e}=await Io([{name:"theme",type:"autocomplete",message:"Which theme do you want to add?",choices:v}]);if(e||(console.log(Eo.red("No theme selected. Exiting...")),process.exit(0)),So.existsSync(o.tailwindCSSLocation)){let{force:t}=await Io([{name:"force",type:"confirm",message:"Do you want to overwrite your current css file?",initial:!0}]);if(!t)return console.log("Exiting..."),process.exit(0)}So.writeFileSync(o.tailwindCSSLocation,I(e.toUpperCase()),"utf-8"),l(`${R.capitalize(e)}`,`${R.capitalize(e)} theme has been added to ${o.tailwindCSSLocation}`,{box:{title:"New Theme Added"}})});process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));process.on("SIGTSTP",()=>process.exit(0));var To=new Ue;console.clear();l("UI Thing",void 0,{box:{title:"Welcome"}});console.log();To.name("ui-thing").description("CLI for adding ui-thing components to your Nuxt application").version(H).addCommand(go).addCommand(so).addCommand(No).addCommand(xo).addCommand(yo);To.parse(process.argv);
1329
+ `;var Eo=async(o=process.cwd())=>{let r=await l(),e=xo(o,r.composablesLocation);await So.ensureDir(e),await So.writeFile(xo(e,"shortcuts.ts"),Co,"utf-8")};var Io=new Ke().command("shortcuts").name("shortcuts").description("Add the shortcuts composables to your project.").action(async()=>{await Eo();let{pkgManager:o}=await Ue({name:"pkgManager",type:"select",message:"Which package manager are you using?",choices:f});if(!o)return process.exit(0);let r=Le("Installing vueuse module...").start();await Ae`npx -y nuxi@latest module add vueuse`,r.succeed("VueUse module installed successfully!"),d("All Done!","Check the composables folder for the shortcuts composables.",{box:{title:"Composable Added"}})});import{Command as Pe}from"commander";import To from"fs-extra";import _o from"kleur";import G from"lodash";import No from"prompts";var Re=o=>y.some(r=>r.value===o?.toLowerCase()),Mo=new Pe().command("theme").name("theme").description("Add a new theme to your project.").argument("[themeName]","The name of the theme you would like to add").action(async o=>{let r=await l();await x()||(r=await l({force:!0})),G.isEmpty(r)&&(console.log(_o.red("Config file not set. Exiting...")),process.exit(0));let t=o&&Re(o)?o.toLowerCase():void 0;if(!t){let{theme:c}=await No([{name:"theme",type:"autocomplete",message:"Which theme do you want to add?",choices:y}]);c||(console.log(_o.red("No theme selected. Exiting...")),process.exit(0)),t=c}if(To.existsSync(r.tailwindCSSLocation)){let{force:c}=await No([{name:"force",type:"confirm",message:"The Tailwind CSS file already exists. Overwrite?",initial:!1}]);if(!c)return console.log("Exiting..."),process.exit(0)}To.writeFileSync(r.tailwindCSSLocation,_(t.toUpperCase()),"utf-8"),d(`${G.capitalize(t)}`,`${G.capitalize(t)} theme has been added to ${r.tailwindCSSLocation}`,{box:{title:"New Theme Added"}})});process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));process.on("SIGTSTP",()=>process.exit(0));var Oo=new je;console.clear();d("UI Thing",void 0,{box:{title:"Welcome"}});console.log();Oo.name("ui-thing").description("CLI for adding ui-thing components to your Nuxt application").version(V).addCommand(vo).addCommand(lo).addCommand(Mo).addCommand(Io).addCommand(wo);Oo.parse(process.argv);
1330
1330
  //# sourceMappingURL=index.js.map