simpyui 0.2.4 → 0.2.5
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/index.js +13 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{existsSync as ne,mkdirSync as
|
|
3
|
-
`)}function ae(){return g(a(process.cwd(),"package.json"))}function G(){ae()||(console.log(
|
|
2
|
+
import{existsSync as ne,mkdirSync as ye,writeFileSync as xe,readFileSync as $e}from"node:fs";import{join as H,dirname as we}from"node:path";import{existsSync as g,readFileSync as I,writeFileSync as S,mkdirSync as ce}from"node:fs";import{execSync as re}from"node:child_process";import{join as a,dirname as le}from"node:path";var p=e=>`\x1B[1m${e}\x1B[0m`,f=e=>`\x1B[32m${e}\x1B[0m`,c=e=>`\x1B[36m${e}\x1B[0m`,b=e=>`\x1B[33m${e}\x1B[0m`,x=e=>`\x1B[31m${e}\x1B[0m`,t=e=>`\x1B[2m${e}\x1B[0m`;var z="components.json";function k(){let e=process.cwd();return g(a(e,"next.config.js"))||g(a(e,"next.config.mjs"))||g(a(e,"next.config.ts"))?"nextjs":g(a(e,"vite.config.js"))||g(a(e,"vite.config.ts"))||g(a(e,"vite.config.mjs"))?"vite":"unknown"}function L(){switch(k()){case"nextjs":return{componentDir:"src/components/ui",utilsDir:"src/lib",typescript:!0};case"vite":return{componentDir:"src/components/ui",utilsDir:"src/lib",typescript:!0};default:return{componentDir:"src/components/ui",utilsDir:"src/lib",typescript:!0}}}function E(){let e=a(process.cwd(),z);if(!g(e))return null;try{let o=JSON.parse(I(e,"utf-8"));if(!o.utilsDir){let n=k();o.utilsDir="src/lib"}return o}catch{return null}}function M(e){let o=a(process.cwd(),z);S(o,JSON.stringify(e,null,2)+`
|
|
3
|
+
`)}function ae(){return g(a(process.cwd(),"package.json"))}function G(){ae()||(console.log(x(" \u2717 No package.json found in current directory.")),console.log(),console.log(t(" Run this inside a React project:")),console.log(c(" npx create-next-app@latest my-app")),console.log(t(" or")),console.log(c(" npm create vite@latest my-app")),console.log(),process.exit(1));let e=E();if(!e){let o=k(),n=L();return console.log(t(` Detected ${o==="nextjs"?"Next.js":o==="vite"?"Vite":"React"} project`)),console.log(t(" Creating components.json with defaults:")),console.log(t(` components \u2192 ${n.componentDir}`)),console.log(t(` utils \u2192 ${n.utilsDir}`)),console.log(t(` typescript \u2192 ${n.typescript}`)),console.log(),M(n),n}return e}var pe=`import { clsx, type ClassValue } from "clsx"
|
|
4
4
|
import { twMerge } from "tailwind-merge"
|
|
5
5
|
|
|
6
6
|
export function cn(...inputs: ClassValue[]) {
|
|
@@ -12,14 +12,14 @@ import { twMerge } from "tailwind-merge"
|
|
|
12
12
|
export function cn(...inputs) {
|
|
13
13
|
return twMerge(clsx(inputs))
|
|
14
14
|
}
|
|
15
|
-
`;function V(e){let o=e.typescript?"ts":"js",n=a(process.cwd(),e.utilsDir,`utils.${o}`),i=[];if(!g(n)){ce(le(n),{recursive:!0}),S(n,e.typescript?pe:de),console.log(f(" \u2713 Created ")+t(`${e.utilsDir}/utils.${o}`));let s=
|
|
16
|
-
`);
|
|
15
|
+
`;function V(e){let o=e.typescript?"ts":"js",n=a(process.cwd(),e.utilsDir,`utils.${o}`),i=[];if(!g(n)){ce(le(n),{recursive:!0}),S(n,e.typescript?pe:de),console.log(f(" \u2713 Created ")+t(`${e.utilsDir}/utils.${o}`));let s=P();s.has("clsx")||i.push("clsx"),s.has("tailwind-merge")||i.push("tailwind-merge")}return i}var ge={brand:{50:"#f0f4ff",100:"#dbe4ff",200:"#bac8ff",300:"#91a7ff",400:"#748ffc",500:"#5c7cfa",600:"#4c6ef5",700:"#4263eb",800:"#3b5bdb",900:"#364fc7"},dark:{50:"#C1C2C5",100:"#A6A7AB",200:"#909296",300:"#5C5F66",400:"#373A40",500:"#2C2E33",600:"#25262B",700:"#1A1B1E",800:"#141517",900:"#101113"}};function Y(){let e=process.cwd(),o=["tailwind.config.js","tailwind.config.ts","tailwind.config.mjs","tailwind.config.cjs"],n="";for(let d of o)if(g(a(e,d))){n=d;break}if(!n){console.log(b(" \u26A0 No tailwind.config found \u2014 skipping color injection")),console.log(t(" Add brand & dark color scales manually (see docs)"));return}let i=a(e,n),s=I(i,"utf-8");if(s.includes("brand:")&&s.includes("dark:"))return;let l=[];s.includes("brand:")||l.push("brand"),s.includes("dark:")||l.push("dark");let y="";for(let d of l){let $=ge[d],R=Object.entries($).map(([h,D])=>` ${h}: '${D}'`).join(`,
|
|
16
|
+
`);y+=` ${d}: {
|
|
17
17
|
${R},
|
|
18
18
|
},
|
|
19
19
|
`}if(s.includes("colors:")&&s.includes("extend:")){let d=s.replace(/(colors\s*:\s*\{)/,`$1
|
|
20
|
-
${
|
|
20
|
+
${y}`);S(i,d),console.log(f(" \u2713 Added ")+t(`${l.join(" & ")} colors \u2192 ${n}`))}else if(s.includes("extend:")){let d=s.replace(/(extend\s*:\s*\{)/,`$1
|
|
21
21
|
colors: {
|
|
22
|
-
${
|
|
22
|
+
${y} },`);S(i,d),console.log(f(" \u2713 Added ")+t(`${l.join(" & ")} colors \u2192 ${n}`))}else console.log(b(" \u26A0 Could not auto-inject colors into "+n)),console.log(t(" Add brand & dark color scales manually (see docs)"))}var me=`
|
|
23
23
|
/* ============ SimpyUI Glow Effects ============ */
|
|
24
24
|
.glow {
|
|
25
25
|
box-shadow: 0 0 60px rgba(0, 150, 255, 0.15);
|
|
@@ -28,14 +28,14 @@ ${x} },`);S(i,d),console.log(f(" \u2713 Added ")+t(`${l.join(" & ")} color
|
|
|
28
28
|
.glow-sm {
|
|
29
29
|
box-shadow: 0 0 30px rgba(0, 150, 255, 0.1);
|
|
30
30
|
}
|
|
31
|
-
`;function Z(){let e=process.cwd(),o=["src/index.css","src/globals.css","src/app/globals.css","app/globals.css","styles/globals.css","src/styles/globals.css"],n="";for(let l of o)if(g(a(e,l))){n=l;break}if(!n)return;let i=a(e,n),s=
|
|
32
|
-
`)}}}async function U(e,o=""){let n=o?` ${t(`(${o})`)}`:"";return process.stdout.write(`${e}${n}: `),new Promise(i=>{let s="";process.stdin.setEncoding("utf-8"),process.stdin.resume(),process.stdin.once("data",l=>{s=l.trim(),process.stdin.pause(),i(s||o)})})}async function B(e,o=!0){let i=await U(`${e} ${t(`[${o?"Y/n":"y/N"}]`)}`);return i?i.toLowerCase().startsWith("y"):o}var X="https://raw.githubusercontent.com/AbhishekS04/SimpyUI/main/src/registry",u={button:{name:"Button",slug:"button",files:["button/button.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated button with multiple variants and sizes."},card:{name:"Card",slug:"card",files:["card/card.tsx"],dependencies:["framer-motion"],internal:[],description:"Versatile card container with hover and glow effects."},badge:{name:"Badge",slug:"badge",files:["badge/badge.tsx"],dependencies:["framer-motion"],internal:[],description:"Small status indicators with colorful variants."},avatar:{name:"Avatar",slug:"avatar",files:["avatar/avatar.tsx"],dependencies:["framer-motion"],internal:[],description:"User avatar with image support and fallback initials."},input:{name:"Input",slug:"input",files:["input/input.tsx"],dependencies:[],internal:[],description:"Styled text input with label and error states."},toggle:{name:"Toggle",slug:"toggle",files:["toggle/toggle.tsx"],dependencies:["framer-motion"],internal:[],description:"Smooth animated toggle switch."},accordion:{name:"Accordion",slug:"accordion",files:["accordion/accordion.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Collapsible content sections with smooth animations."},tabs:{name:"Tabs",slug:"tabs",files:["tabs/tabs.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated tab navigation with smooth underline indicator."},progress:{name:"Progress",slug:"progress",files:["progress/progress.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated progress bar with multiple colors and sizes."},skeleton:{name:"Skeleton",slug:"skeleton",files:["skeleton/skeleton.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated loading placeholder with pulsing effect."},modal:{name:"Modal",slug:"modal",files:["modal/modal.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Animated dialog with backdrop blur."},toast:{name:"Toast",slug:"toast",files:["toast/toast.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Notification toast with animated entrance."},alert:{name:"Alert",slug:"alert",files:["alert/alert.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Contextual alert banners with icons."},tooltip:{name:"Tooltip",slug:"tooltip",files:["tooltip/tooltip.tsx"],dependencies:[],internal:[],description:"Hover tooltip with multiple positions."},"social-stories":{name:"Social Stories",slug:"social-stories",files:["social-stories/social-stories.tsx"],dependencies:["framer-motion","lucide-react"],internal:[],description:"Instagram/LinkedIn-style stories viewer with progress bars and video support."}},_=Object.keys(u);function C(){console.log(),console.log(p(c(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"))),console.log(p(c(" \u2502 SimpyUI CLI \u2502"))),console.log(p(c(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"))),console.log()}async function be(){C(),E()&&(await B(b(" components.json already exists. Overwrite?"),!1)||(console.log(t(" Cancelled.")),process.exit(0)));let o=k(),n=L();console.log(t(` Detected ${p(o==="nextjs"?"Next.js":o==="vite"?"Vite":"React")} project
|
|
33
|
-
`));let s=await U(` ${p("Component directory")}`,n.componentDir),l=await U(` ${p("Utils directory")}`,n.utilsDir),
|
|
34
|
-
`);let e={};for(let o of Object.values(u)){let n=je(o.slug);e[n]||(e[n]=[]),e[n].push(o)}for(let[o,n]of Object.entries(e)){console.log(` ${p(c(o))}`);for(let i of n){let s=i.dependencies.length?t(` \u2192 ${i.dependencies.join(", ")}`):"";console.log(` ${f("\u2022")} ${p(i.slug.padEnd(16))} ${t(i.description)}${s}`)}console.log()}console.log(t(` Total: ${_.length} components`)),console.log(),console.log(` ${t("Usage:")} ${c("npx simpyui add <name>")}`),console.log()}function je(e){return{button:"General",card:"General",badge:"General",avatar:"General",input:"Inputs",toggle:"Inputs",accordion:"Data Display",tabs:"Data Display",progress:"Data Display",skeleton:"Data Display",modal:"Feedback",toast:"Feedback",alert:"Feedback",tooltip:"Overlay","social-stories":"Animation"}[e]||"Other"}async function ee(e){C();let o=G(),n=e.includes("--all"),i=e.filter(r=>!r.startsWith("-")),s=[];if(n)s=[..._],console.log(` Adding ${p("all")} ${c(String(s.length))} components...
|
|
35
|
-
`);else if(i.length===0)console.log(
|
|
31
|
+
`;function Z(){let e=process.cwd(),o=["src/index.css","src/globals.css","src/app/globals.css","app/globals.css","styles/globals.css","src/styles/globals.css"],n="";for(let l of o)if(g(a(e,l))){n=l;break}if(!n)return;let i=a(e,n),s=I(i,"utf-8");s.includes(".glow-sm")||s.includes("SimpyUI Glow Effects")||(S(i,s+me),console.log(f(" \u2713 Added ")+t(`glow utilities \u2192 ${n}`)))}function fe(){let e=process.cwd();return g(a(e,"bun.lockb"))||g(a(e,"bun.lock"))?"bun":g(a(e,"pnpm-lock.yaml"))?"pnpm":g(a(e,"yarn.lock"))?"yarn":"npm"}function ue(e,o){let n=o.join(" ");switch(e){case"bun":return`bun add ${n}`;case"pnpm":return`pnpm add ${n}`;case"yarn":return`yarn add ${n}`;default:return`npm install ${n}`}}function q(e){if(e.length===0)return;let o=fe(),n=ue(o,e);console.log(t(` $ ${n}`));try{re(n,{stdio:"pipe",cwd:process.cwd()})}catch{console.log(b(` \u26A0 Failed to install. Run manually: ${n}`))}}function P(){let e=a(process.cwd(),"package.json");if(!g(e))return new Set;try{let o=JSON.parse(I(e,"utf-8"));return new Set([...Object.keys(o.dependencies||{}),...Object.keys(o.devDependencies||{})])}catch{return new Set}}async function K(e){let o=await fetch(e);if(!o.ok)throw new Error(`Failed to fetch ${e} (${o.status})`);return o.text()}function Q(e){let o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=0,i=setInterval(()=>{process.stdout.write(`\r${c(o[n++%o.length])} ${e}`)},80);return{stop(s){clearInterval(i),process.stdout.write(`\r${s||""}
|
|
32
|
+
`)}}}async function U(e,o=""){let n=o?` ${t(`(${o})`)}`:"";return process.stdout.write(`${e}${n}: `),new Promise(i=>{let s="";process.stdin.setEncoding("utf-8"),process.stdin.resume(),process.stdin.once("data",l=>{s=l.trim(),process.stdin.pause(),i(s||o)})})}async function B(e,o=!0){let i=await U(`${e} ${t(`[${o?"Y/n":"y/N"}]`)}`);return i?i.toLowerCase().startsWith("y"):o}var X="https://raw.githubusercontent.com/AbhishekS04/SimpyUI/main/src/registry",u={button:{name:"Button",slug:"button",files:["button/button.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated button with multiple variants and sizes."},card:{name:"Card",slug:"card",files:["card/card.tsx"],dependencies:["framer-motion"],internal:[],description:"Versatile card container with hover and glow effects."},badge:{name:"Badge",slug:"badge",files:["badge/badge.tsx"],dependencies:["framer-motion"],internal:[],description:"Small status indicators with colorful variants."},avatar:{name:"Avatar",slug:"avatar",files:["avatar/avatar.tsx"],dependencies:["framer-motion"],internal:[],description:"User avatar with image support and fallback initials."},input:{name:"Input",slug:"input",files:["input/input.tsx"],dependencies:[],internal:[],description:"Styled text input with label and error states."},toggle:{name:"Toggle",slug:"toggle",files:["toggle/toggle.tsx"],dependencies:["framer-motion"],internal:[],description:"Smooth animated toggle switch."},accordion:{name:"Accordion",slug:"accordion",files:["accordion/accordion.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Collapsible content sections with smooth animations."},tabs:{name:"Tabs",slug:"tabs",files:["tabs/tabs.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated tab navigation with smooth underline indicator."},progress:{name:"Progress",slug:"progress",files:["progress/progress.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated progress bar with multiple colors and sizes."},skeleton:{name:"Skeleton",slug:"skeleton",files:["skeleton/skeleton.tsx"],dependencies:["framer-motion"],internal:[],description:"Animated loading placeholder with pulsing effect."},modal:{name:"Modal",slug:"modal",files:["modal/modal.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Animated dialog with backdrop blur."},toast:{name:"Toast",slug:"toast",files:["toast/toast.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Notification toast with animated entrance."},alert:{name:"Alert",slug:"alert",files:["alert/alert.tsx"],dependencies:["framer-motion","react-icons"],internal:[],description:"Contextual alert banners with icons."},tooltip:{name:"Tooltip",slug:"tooltip",files:["tooltip/tooltip.tsx"],dependencies:[],internal:[],description:"Hover tooltip with multiple positions."},"social-stories":{name:"Social Stories",slug:"social-stories",files:["social-stories/social-stories.tsx"],dependencies:["framer-motion","lucide-react"],internal:[],description:"Instagram/LinkedIn-style stories viewer with progress bars and video support."},"dynamic-island":{name:"Dynamic Island",slug:"dynamic-island",files:["dynamic-island/dynamic-island.tsx"],dependencies:["framer-motion","lucide-react"],internal:[],description:"Apple-style Dynamic Island with ring, timer, music, call, screen record, and battery modes."}},_=Object.keys(u);function C(){console.log(),console.log(p(c(" \u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E"))),console.log(p(c(" \u2502 SimpyUI CLI \u2502"))),console.log(p(c(" \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F"))),console.log()}async function be(){C(),E()&&(await B(b(" components.json already exists. Overwrite?"),!1)||(console.log(t(" Cancelled.")),process.exit(0)));let o=k(),n=L();console.log(t(` Detected ${p(o==="nextjs"?"Next.js":o==="vite"?"Vite":"React")} project
|
|
33
|
+
`));let s=await U(` ${p("Component directory")}`,n.componentDir),l=await U(` ${p("Utils directory")}`,n.utilsDir),y=await B(` ${p("Use TypeScript?")}`,!0);M({componentDir:s,utilsDir:l,typescript:y}),console.log(),console.log(f(" \u2713 Created components.json")),console.log(t(` Components \u2192 ${s}/`)),console.log(t(` Utils \u2192 ${l}/`)),console.log(),console.log(` ${p("Next step:")} Run ${c("npx simpyui@latest add button")} to add your first component.`),console.log()}function he(){C(),console.log(` ${p("Available components:")}
|
|
34
|
+
`);let e={};for(let o of Object.values(u)){let n=je(o.slug);e[n]||(e[n]=[]),e[n].push(o)}for(let[o,n]of Object.entries(e)){console.log(` ${p(c(o))}`);for(let i of n){let s=i.dependencies.length?t(` \u2192 ${i.dependencies.join(", ")}`):"";console.log(` ${f("\u2022")} ${p(i.slug.padEnd(16))} ${t(i.description)}${s}`)}console.log()}console.log(t(` Total: ${_.length} components`)),console.log(),console.log(` ${t("Usage:")} ${c("npx simpyui add <name>")}`),console.log()}function je(e){return{button:"General",card:"General",badge:"General",avatar:"General",input:"Inputs",toggle:"Inputs",accordion:"Data Display",tabs:"Data Display",progress:"Data Display",skeleton:"Data Display",modal:"Feedback",toast:"Feedback",alert:"Feedback",tooltip:"Overlay","social-stories":"Animation","dynamic-island":"Animation"}[e]||"Other"}async function ee(e){C();let o=G(),n=e.includes("--all"),i=e.filter(r=>!r.startsWith("-")),s=[];if(n)s=[..._],console.log(` Adding ${p("all")} ${c(String(s.length))} components...
|
|
35
|
+
`);else if(i.length===0)console.log(x(" \u2717 Please specify component name(s).")),console.log(),console.log(` ${t("Usage:")} ${c("npx simpyui add button card modal")}`),console.log(` ${t(" ")} ${c("npx simpyui add --all")}`),console.log(),console.log(` ${t("Run")} ${c("npx simpyui list")} ${t("to see all available components.")}`),console.log(),process.exit(1);else{let r=i.filter(m=>!u[m]);r.length>0&&(console.log(x(` \u2717 Unknown component(s): ${r.join(", ")}`)),console.log(),console.log(` ${t("Run")} ${c("npx simpyui list")} ${t("to see all available components.")}`),console.log(),process.exit(1)),s=i}let l=new Set;function y(r){if(l.has(r))return;let m=u[r];if(m){for(let w of m.internal)y(w);l.add(r)}}for(let r of s)y(r);s=[...l];let d=new Set;for(let r of s)for(let m of u[r].dependencies)d.add(m);let $=V(o);for(let r of $)d.add(r);Y(),Z();let R=P(),h=[...d].filter(r=>!R.has(r)),D=Q("Downloading components..."),J=0,F=0;for(let r of s){let m=u[r];for(let w of m.files){let se=`${X}/${w}`,O=w.split("/").pop(),De=o.typescript?"":O.replace(".tsx",".jsx"),ie=o.typescript?O:O.replace(".tsx",".jsx"),T=H(process.cwd(),o.componentDir,ie);if(ne(T)){F++;continue}try{let j=await K(se);o.typescript||(j=Se(j)),ye(we(T),{recursive:!0}),xe(T,j),J++}catch(j){D.stop(x(` \u2717 Failed to download ${w}`)),console.log(t(` ${j.message}`))}}}D.stop(f(` \u2713 Downloaded ${J} file(s)`)+(F?t(` (${F} already existed)`):"")),h.length>0?(console.log(),console.log(` ${p("Installing dependencies:")} ${c(h.join(", "))}`),q(h),console.log(f(" \u2713 Dependencies installed"))):d.size>0&&console.log(t(" \u2713 All dependencies already installed")),console.log(),console.log(f(" Done! ")+t("Components added:"));for(let r of s){let m=u[r],w=m.files[0].split("/").pop();console.log(` ${f("\u2022")} ${p(m.name)} \u2192 ${t(`${o.componentDir}/${w}`)}`)}console.log();let W=s[0],v=u[W],N=v.files[0].split("/").pop().replace(".tsx","").replace(".jsx",""),te=H(process.cwd(),o.componentDir,v.files[0].split("/").pop()),A="";try{let r=$e(te,"utf-8"),m=v.name.replace(/\s+/g,"");r.includes("export default")?A=`import ${m} from "@/${o.componentDir}/${N}"`:A=`import { ${m} } from "@/${o.componentDir}/${N}"`}catch{A=`import ${v.name.replace(/\s+/g,"")} from "@/${o.componentDir}/${N}"`}console.log(t(" Import:")),console.log(c(` ${A}`)),console.log(),console.log(t(` Docs \u2192 ${c(`https://simpyui.vercel.app/components/${W}`)}`)),console.log()}function Se(e){return e.replace(/: string/g,"").replace(/: number/g,"").replace(/: boolean/g,"").replace(/: ReactNode/g,"").replace(/: React\.ReactNode/g,"").replace(/<[A-Z]\w+Props>/g,"").replace(/interface \w+ \{[^}]*\}/gs,"").replace(/type \w+ = [^;\n]+;?/g,"").replace(/export type \w+ = [^;\n]+;?/g,"").replace(/export interface \w+ \{[^}]*\}/gs,"").replace(/import \{ type \w+[\s\S]*?\} from/g,"import {").replace(/import type \{[^}]*\} from '[^']+'\n?/g,"").replace(/, type \w+/g,"").replace(/as const/g,"").replace(/<HTMLMotionProps<'[^']*'>>/g,"").replace(/Omit<\w+<'[^']*'>,\s*'[^']*'>/g,"").replace(/Record<\w+,\s*\w+>/g,"").replace(/\.tsx/g,".jsx").replace(/\n{3,}/g,`
|
|
36
36
|
|
|
37
|
-
`)}function ke(e){C();let o=G(),n=e.filter(i=>!i.startsWith("-"));n.length===0&&(console.log(
|
|
37
|
+
`)}function ke(e){C();let o=G(),n=e.filter(i=>!i.startsWith("-"));n.length===0&&(console.log(x(" \u2717 Specify a component name.")),process.exit(1));for(let i of n){let s=u[i];if(!s){console.log(x(` \u2717 Unknown component: ${i}`));continue}let l=s.files[0].split("/").pop(),y=H(process.cwd(),o.componentDir,l);if(ne(y)?console.log(b(` \u25CF ${s.name}`),t("\u2014 already exists")):console.log(f(` + ${s.name}`),t(`\u2192 ${o.componentDir}/${l}`)),s.dependencies.length>0){let d=P();for(let $ of s.dependencies)d.has($)?console.log(t(` \u2713 ${$} (installed)`)):console.log(c(` + ${$} (will install)`))}console.log()}}function oe(){C(),console.log(` ${p("Usage:")} simpyui ${c("<command>")} ${t("[options]")}`),console.log(),console.log(` ${p("Commands:")}`),console.log(` ${c("init")} Configure SimpyUI for your project`),console.log(` ${c("add")} ${t("<name>")} Add component(s) to your project`),console.log(` ${c("add --all")} Add all components at once`),console.log(` ${c("list")} List all available components`),console.log(` ${c("diff")} ${t("<name>")} Preview what would be added`),console.log(` ${c("help")} Show this help message`),console.log(),console.log(` ${p("Examples:")}`),console.log(t(" $ npx simpyui init")),console.log(t(" $ npx simpyui add button")),console.log(t(" $ npx simpyui add button card modal toast")),console.log(t(" $ npx simpyui add --all")),console.log()}async function Ce(){let e=process.argv.slice(2),o=e[0];switch(o){case"init":await be();break;case"add":await ee(e.slice(1));break;case"list":case"ls":he();break;case"diff":ke(e.slice(1));break;case"help":case"--help":case"-h":case void 0:oe();break;default:u[o]?await ee(e):(console.log(x(`
|
|
38
38
|
Unknown command: ${o}
|
|
39
|
-
`)),oe())}}Ce().catch(e=>{console.error(
|
|
39
|
+
`)),oe())}}Ce().catch(e=>{console.error(x(`
|
|
40
40
|
Error: ${e.message}
|
|
41
41
|
`)),process.exit(1)});
|