@alignui/cli 0.0.1-alpha.2 → 0.0.1-alpha.4

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 CHANGED
@@ -579,5 +579,5 @@ in order for it to be formatted.`,cliCategory:"Other"},tabWidth:{type:"int",cate
579
579
  `)return!0;return!1}var JF=QF;function ZF(e,t,r={}){return jt(e,r.backwards?t-1:t,r)!==t}var e1=ZF;function t1(e,t,r){let u=t==='"'?"'":'"',i=eu(!1,e,/\\(.)|(["'])/gsu,(a,s,o)=>s===u?s:o===t?"\\"+o:o||(r&&/^[^\n\r"'0-7\\bfnrt-vx\u2028\u2029]$/u.test(s)?s:"\\"+s));return t+i+t}var r1=t1;function u1(e,t,r){return Hi(e,r(t))}function n1(e,t){return arguments.length===2||typeof t=="number"?Hi(e,t):u1(...arguments)}function i1(e,t,r){return ji(e,r(t))}function a1(e,t){return arguments.length===2||typeof t=="number"?ji(e,t):i1(...arguments)}function s1(e,t,r){return Gi(e,r(t))}function o1(e,t){return arguments.length===2||typeof t=="number"?Gi(e,t):s1(...arguments)}function It(e,t=1){return async(...r)=>{let u=r[t]??{},{plugins:n=[]}=u;return r[t]={...u,plugins:(await Promise.all([BF(),LF(n)])).flat()},e(...r)}}var Vl=It(Hl);async function Ju(e,t){let{formatted:r}=await Vl(e,{...t,cursorOffset:-1});return r}async function l1(e,t){return await Ju(e,t)===e}async function c1(){Ym(),NF()}var f1=It(dg),D1=It(Mi,0),h1={errors:_o,optionCategories:Gl,createIsIgnoredFunction:hl,formatOptionsHiddenDefaults:ii,normalizeOptions:Il,getSupportInfoWithoutPlugins:Mi,normalizeOptionSettings:Tl,vnopts:{ChoiceSchema:yo,apiDescriptor:nr},fastGlob:C0.default,createTwoFilesPatch:F0,utils:{isNonEmptyArray:wl,partition:Bo,omit:jF},mockable:vi},p1={parse:It(GE),formatAST:It(WE),formatDoc:It(qE),printToDoc:It(VE),printDocToString:It(YE),mockable:vi};var Yl=e=>Ju(e,{singleQuote:!0,jsxSingleQuote:!0,tabWidth:2,semi:!0,parser:"typescript"});import{converter as Kl,formatHsl as m1,formatRgb as g1}from"culori";var E1=Kl("rgb"),F1=Kl("hsl"),zl=new Intl.NumberFormat("en-US",{style:"percent"}).format;function Xl(e){let t=F1(e),r=m1(t),[u,n,i]=r.replace("hsla(","").replace("hsl(","").replace(")","").split(", ");return t?.alpha?`${u} ${n}% ${i}% / ${zl(t.alpha)}`:`${u} ${n}% ${i}%`}function Ql(e){let t=E1(e),r=g1(t),[u,n,i]=r.replace("rgba(","").replace("rgb(","").replace(")","").split(", ");return t?.alpha?`${u} ${n} ${i} / ${zl(t.alpha)}`:`${u} ${n} ${i}`}var rc=["tailwindcss-animate"],nu=e=>C1.hex("#8c71f6")(e),_1=ec.object({cwd:ec.string()}),uc=new v1().name("tailwind").description("Initialize AlignUI tailwind tokens for your project.").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).action(async e=>{try{let t=_1.parse(e),r=Zu.resolve(t.cwd);tc(r)||(Ke.error(`The path ${r} does not exist. Please try again.`),process.exit(1)),Da(r);let u=await fa(r);if(u){let n=await b1(r,u);await w1(r,n)}Ke.break(),Ke.success("Project initialization completed!"),Ke.break(),Ke.white(`Installed the following packages:
580
580
 
581
581
  ${rc.map(n=>` - ${n}`).join(`
582
- `)}`),Ke.break()}catch(t){ea(t)}});async function b1(e,t){let r=await y1([{type:"select",name:"primaryColor",message:`Which color would you like to use as ${nu("primary color")}?`,choices:[{title:"Blue",value:"blue"},{title:"Purple",value:"purple"},{title:"Orange",value:"orange"},{title:"Sky",value:"sky"}],initial:0},{type:"select",name:"colorFormat",message:`Which ${nu("color format")} would you like to use?`,choices:[{title:"hex",value:"hex"},{title:"rgb",value:"rgb"},{title:"hsl",value:"hsl"}],initial:0},{type:"text",name:"tailwindPrefix",message:`Would you like to use a custom prefix for AlignUI specific classes? ${nu("eg. an-")} (Recommended if you want to keep tailwind's default colors, shadows and font-sizes. Leave blank if not)`,initial:""},{type:"text",name:"tailwindConfig",message:`Where is your ${nu("tailwind config")} file?`,initial:t?.tailwind.config??aa},{type:"text",name:"tailwindCss",message:`Where is your ${nu("global CSS")} file?`,initial:t?.tailwind.css??ia}]),u=cn.parse({tailwind:{config:r.tailwindConfig,css:r.tailwindCss,primaryColor:r.primaryColor,colorFormat:r.colorFormat,prefix:r.tailwindPrefix}});return await au(e,u)}function qi(e,t){return t?Object.fromEntries(Object.entries(e).map(([r,u])=>[`${t}${r}`,u])):e}async function w1(e,t){let r=Zl("Initializing project...")?.start();for(let[f,c]of Object.entries(t.resolvedPaths)){let h=Zu.extname(c)?Zu.dirname(c):c;tc(h)||await Wi.mkdir(h,{recursive:!0})}let u=Zu.extname(t.resolvedPaths.tailwindConfig)===".ts"?ra:ta,n=t.tailwind.colorFormat==="rgb"?pa:t.tailwind.colorFormat==="hsl"?da:su,i=ou,a=ga;t.tailwind.prefix&&(n=qi(n,t.tailwind.prefix),i=qi(ou,t.tailwind.prefix),a=qi(ou,t.tailwind.prefix)),await Wi.writeFile(t.resolvedPaths.tailwindConfig,await Yl(Jl(u)({prefix:t.tailwind.prefix,colors:JSON.stringify(n,null,2),borderRadii:JSON.stringify(ma,null,2),texts:JSON.stringify(i,null,2),shadows:JSON.stringify(a,null,2),animations:JSON.stringify(Ea,null,2)})),"utf8");let s=Object.fromEntries(Object.entries(ha).map(([f,c])=>[f,Object.fromEntries(Object.entries(c).map(([h,p])=>t.tailwind.colorFormat==="hsl"?[h,Xl(p)]:t.tailwind.colorFormat==="rgb"?[h,Ql(p)]:[h,p]))]));await Wi.writeFile(t.resolvedPaths.tailwindCss,Jl(ua)({primaryColor:t.tailwind.primaryColor,...s}),"utf8"),r?.succeed();let o=Zl("Installing dependencies...")?.start(),l=await sa(e);await A1(l,[l==="npm"?"i":"add",...rc],{cwd:e}),o?.succeed()}import{Command as R1}from"commander";import B1 from"path";import S1 from"fs-extra";function nc(){let e=B1.join("package.json");return S1.readJSONSync(e)}process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function O1(){let e=await nc(),t=new R1().name("alignui-cli").description(e.description||"").version(e.version||"0.0.1","-v, --version","display the version number");t.addCommand(uc),t.parse()}O1();
582
+ `)}`),Ke.break()}catch(t){ea(t)}});async function b1(e,t){let r=await y1([{type:"select",name:"primaryColor",message:`Which color would you like to use as ${nu("primary color")}?`,choices:[{title:"Blue",value:"blue"},{title:"Purple",value:"purple"},{title:"Orange",value:"orange"},{title:"Sky",value:"sky"}],initial:0},{type:"select",name:"colorFormat",message:`Which ${nu("color format")} would you like to use?`,choices:[{title:"hex",value:"hex"},{title:"rgb",value:"rgb"},{title:"hsl",value:"hsl"}],initial:0},{type:"text",name:"tailwindPrefix",message:`Would you like to use a custom prefix for AlignUI specific classes? ${nu("eg. an-")} (Recommended if you want to keep tailwind's default colors, shadows and font-sizes. Leave blank if not)`,initial:""},{type:"text",name:"tailwindConfig",message:`Where is your ${nu("tailwind config")} file?`,initial:t?.tailwind.config??aa},{type:"text",name:"tailwindCss",message:`Where is your ${nu("global CSS")} file?`,initial:t?.tailwind.css??ia}]),u=cn.parse({tailwind:{config:r.tailwindConfig,css:r.tailwindCss,primaryColor:r.primaryColor,colorFormat:r.colorFormat,prefix:r.tailwindPrefix}});return await au(e,u)}function qi(e,t){return t?Object.fromEntries(Object.entries(e).map(([r,u])=>[`${t}${r}`,u])):e}async function w1(e,t){let r=Zl("Initializing project...")?.start();for(let[f,c]of Object.entries(t.resolvedPaths)){let h=Zu.extname(c)?Zu.dirname(c):c;tc(h)||await Wi.mkdir(h,{recursive:!0})}let u=Zu.extname(t.resolvedPaths.tailwindConfig)===".ts"?ra:ta,n=t.tailwind.colorFormat==="rgb"?pa:t.tailwind.colorFormat==="hsl"?da:su,i=ou,a=ga;t.tailwind.prefix&&(n=qi(n,t.tailwind.prefix),i=qi(ou,t.tailwind.prefix),a=qi(ou,t.tailwind.prefix)),await Wi.writeFile(t.resolvedPaths.tailwindConfig,await Yl(Jl(u)({prefix:t.tailwind.prefix,colors:JSON.stringify(n,null,2),borderRadii:JSON.stringify(ma,null,2),texts:JSON.stringify(i,null,2),shadows:JSON.stringify(a,null,2),animations:JSON.stringify(Ea,null,2)})),"utf8");let s=Object.fromEntries(Object.entries(ha).map(([f,c])=>[f,Object.fromEntries(Object.entries(c).map(([h,p])=>t.tailwind.colorFormat==="hsl"?[h,Xl(p)]:t.tailwind.colorFormat==="rgb"?[h,Ql(p)]:[h,p]))]));await Wi.writeFile(t.resolvedPaths.tailwindCss,Jl(ua)({primaryColor:t.tailwind.primaryColor,...s}),"utf8"),r?.succeed();let o=Zl("Installing dependencies...")?.start(),l=await sa(e);await A1(l,[l==="npm"?"i":"add",l==="npm"?"--save-dev":"-D",...rc],{cwd:e}),o?.succeed()}import{Command as R1}from"commander";import B1 from"path";import S1 from"fs-extra";function nc(){let e=B1.join("package.json");return S1.readJSONSync(e)}process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function O1(){let e=await nc(),t=new R1().name("alignui-cli").description(e.description||"").version(e.version||"0.0.1","-v, --version","display the version number");t.addCommand(uc),t.parse()}O1();
583
583
  //# sourceMappingURL=index.js.map