untitledui 0.1.42 → 0.1.43-beta.1
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.mjs +27 -27
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as
|
|
3
|
-
`),process.exit(1)},
|
|
2
|
+
import{Command as p0}from"commander";import o3 from"async-retry";import N from"chalk";import{Command as I0}from"commander";import{execa as L3}from"execa";import*as F from"fs";import Z3 from"ora";import N0 from"os";import*as T from"path";import Q3 from"prompts";import{Project as A0}from"ts-morph";import f3 from"node-fetch";import{Readable as J0,pipeline as K0}from"stream";import{x as U0}from"tar";import{promisify as V0}from"util";var b0=V0(K0);async function m3(W,Q){try{let z=await L0(Q);await b0(z,U0({cwd:W,strip:1}))}catch(z){throw new Error(`Failed to download or extract repository from API: ${z instanceof Error?z.message:z}`)}}async function L0(W){let Q=`https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/download-repo?template=${W.template}`;try{let z=await f3(Q,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/octet-stream"}});if(z.status===403||z.status===404)throw new Error("Repository not found");if(!z.ok)throw new Error(`Failed to download from API. Status: ${z.status} ${z.statusText}`);if(!z.body)throw new Error("Response body is empty");return J0.from(z.body)}catch(z){throw new Error(`Error downloading tarball: ${z instanceof Error?z.message:z}`)}}async function B3(W){let Q=`https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/validate-key?key=${W}`;try{return(await f3(Q)).status===200}catch{return!1}}import M0 from"node-fetch";var c3={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function J3(W,Q,z){let $=Q.map((q)=>{if(q.includes("modals/"))if(q.includes("-modal"))return q;else return q+"-modal";return q});try{let q=await M0("https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/components",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({type:W,components:$,key:z})});if(!q.ok)console.log(c3?.[q.statusText]||c3.no_components_found),process.exit(1);return await q.json()}catch(q){return null}}import N3 from"node-fetch";var p={invalid_key:"Invalid key provided",no_components_found:"No components found",no_components_provided:"No components provided"};async function l3(W,Q=""){let z=`https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/components/list?key=${Q}&type=${W}`;try{let X=await N3(z),$=await X.json();if(!X.ok)console.log(p?.[X.statusText]||p.no_components_found),process.exit(1);if(!$?.components?.length)return null;return $}catch(X){return console.error(X),null}}async function a3(W,Q="",z){let X=`https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/components/list?key=${Q}&type=${W}&subfolders=${z.join(",")}`;try{let $=await N3(X);if(!$.ok)console.log(p?.[$.statusText]||p.no_components_found),process.exit(1);let q=await $.json();if(!q?.components?.length)return null;return q}catch($){return console.error($),null}}async function s3(W=""){let Q=`https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/components/list?key=${W}`;try{let z=await N3(Q);if(!z.ok)console.log(p?.[z.statusText]||p.no_components_found),process.exit(1);let X=await z.json();if(!X?.types?.length)return null;return X}catch(z){return console.error(z),null}}import n3 from"fast-glob";import*as y3 from"fs";import*as A3 from"path";import{Project as j1}from"ts-morph";import{loadConfig as R0}from"tsconfig-paths";import B1 from"prettier";import V3 from"fast-glob";import*as K3 from"fs";import*as U3 from"path";import{loadConfig as j0}from"tsconfig-paths";var d=["**/node_modules/**",".next","public","dist","build"],r3={"next-app":"Next.js (App)","next-pages":"Next.js (Pages)",vite:"Vite",other:"Other"};async function o(W){let Q=K3.existsSync(U3.resolve(W,"src")),z=K3.existsSync(U3.resolve(W,`${Q?"src/":""}app`)),[X,$,q,L]=await Promise.all([V3.glob("**/{next,vite,astro}.config.*|gatsby-config.*",{cwd:W,deep:2,ignore:d}),H0(W),v0(W),G0(W)]),j={framework:"other",isTsx:$,tailwindFile:q||null,aliasPrefix:L,isSrcDir:Q,isUsingAppDir:z};if(X.find((b)=>b.startsWith("next.config."))?.length)return j.framework=z?"next-app":"next-pages",j;else if(X.find((b)=>b.startsWith("vite.config."))?.length)return j.framework="vite",j;else if(X?.length||K3.existsSync(U3.resolve(W,"package.json")))return j.framework="other",j;return null}async function H0(W){return(await V3.glob("tsconfig.*",{cwd:W,deep:2,ignore:d})).length>0}async function v0(W){let Q=await V3.glob("tailwind.config.*",{cwd:W,deep:2,ignore:d});if(!Q.length)return null;return Q[0]}async function G0(W){let Q=await j0(W);if(Q?.resultType==="failed"||!Object.keys(Q.paths).length)return null;let z={};for(let[X,$]of Object.entries(Q.paths)){let q=X.replace(/\/\*$/,"/");if($.some((L)=>L.includes("/app/*")))z.appPrefix=q;else if($.some((L)=>L.includes("/components/*")))z.componentsPrefix=q;else if($.some((L)=>L.includes("/utils/*")))z.utilsPrefix=q;else if($.some((L)=>L.includes("/styles/*")))z.stylesPrefix=q;else if($.some((L)=>L.includes("./*")||L.includes("/src/*")))z.srcPrefix=q}return z||null}function t(W){let Q=R0(W),z=n3.sync(["tailwind.config.*","**/globals.css","**/{layout,_app,main}.tsx","package.json"],{cwd:W,deep:4,absolute:!0,onlyFiles:!0,ignore:d}),X={tailwindFile:z.find(($)=>$.includes("tailwind.config.")),cssFile:z.find(($)=>$.includes("globals.css")),layoutFile:z.find(($)=>$.includes("layout")),appFile:z.find(($)=>$.includes("_app")),mainFile:z.find(($)=>$.includes("main")),packageJson:z.find(($)=>$.includes("package.json")),tsConfig:Q?.resultType==="success"?Q?.configFileAbsolutePath:void 0};if(Q.resultType==="failed")throw new Error(`Failed to load tsconfig.json. ${Q.message??""}`.trim());return X}function e(W,Q,z={},X=""){if(W.includes("components")){if(z?.componentsPrefix)return W.replace(/@\/components\//,A3.posix.join(z?.componentsPrefix,Q?Q.replace(/components\//,""):"","/"));if(Q){let $=z?.srcPrefix?A3.posix.join(z?.srcPrefix,Q,"/"):X;return W.replace(/@\/components\//,$)}}if(W.includes("app")&&z?.appPrefix)return W.replace(/^@\/app\//,z?.appPrefix);if(W.includes("utils")&&z?.utilsPrefix)return W.replace(/^@\/utils\//,z?.utilsPrefix);if(W.includes("styles")&&z?.stylesPrefix)return W.replace(/^@\/styles\//,z?.stylesPrefix);if(z?.srcPrefix)return W.replace(/^@\//,z?.srcPrefix);return W}function i3(W){let Q=n3.sync(["vite.config.*"],{cwd:W,absolute:!0,onlyFiles:!0,ignore:d})?.[0];if(!Q)return!1;try{let z=y3.readFileSync(Q,"utf-8");return u0(z)}catch{return!1}}function u0(W){let Q=W.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"");if(!["tailwindcss","@tailwindcss/vite","tailwind("].some((q)=>Q.includes(q)))return!1;return["plugins:","postcss:","css:"].some((q)=>Q.includes(q))}function C(){if("bun/1.2.18 npm/? node/v24.3.0 darwin arm64".startsWith("yarn"))return"yarn";if("bun/1.2.18 npm/? node/v24.3.0 darwin arm64".startsWith("pnpm"))return"pnpm";if("bun/1.2.18 npm/? node/v24.3.0 darwin arm64".startsWith("bun"))return"bun";return"npm"}function z3(){switch(C()){case"yarn":return"yarn";case"pnpm":return"pnpx";case"bun":return"bunx";default:return"npx"}}function p3(){switch(C()){case"yarn":return"yarn dev";case"pnpm":return"pnpm dev";case"bun":return"bun dev";default:return"npm run dev"}}function b3(W){return W.replace(/^[ \t]*\/\/\s*(TODO:|collapse-(start|end)).*\r?\n?|[ \t]*{\s*\/\*\s*(TODO:|collapse-(start|end)).*?\*\/\s*}\r?\n?/gm,"")}var y0=T.join(N0.homedir(),".untitledui"),c=T.join(y0,"config.json"),B={components:[],path:"",type:void 0,license:""};if(F.existsSync(c)){let W=JSON.parse(F.readFileSync(c,"utf-8"));B.license=W.license}var $3=(W)=>{if(W.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
|
|
3
|
+
`),process.exit(1)},t3=new I0().name("add").description("add a component to your project").argument("[components...]","the components to add").option("-a, --all","add all available components",!1).option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the component to.").option("-d, --dir <directory>","the directory where the project is located.").option("-t, --type <base|marketing|shared-assets|application|foundations>","the type of the component to add.").action(async(W,Q)=>{if(W)B.components=W;if(Q)B.all=Q.all,B.dir=Q.dir,B.path=Q.path,B.overwrite=Q.overwrite,B.license=Q.license||B.license;try{await E3(B)}catch(z){console.error(N.red(z))}});async function E3(W){if(W)B={...B,...W};let Q=Z3().start(),z=T.posix.join(process.cwd(),B.dir||"");if(!F.existsSync(T.resolve(z,"package.json")))Q.warn("This command should be run in a project directory."),process.exit(1);let $=await o(z);if(B.license){if(!await B3(B.license))Q.fail("Invalid license key"),process.exit(1);if(!F.existsSync(c)){let K=T.dirname(c);F.mkdirSync(K,{recursive:!0}),F.writeFileSync(c,JSON.stringify({license:B.license},null,2))}if(JSON.parse(F.readFileSync(c,"utf-8")).license!==B.license)F.writeFileSync(c,JSON.stringify({license:B.license},null,2),"utf-8")}Q.stop();let q=[];if(B.components.length){let Y=await J3(B.type,B.components,B.license);if(Y&&Y.pro&&Y.pro.length>0){if(console.log(),Y.pro.length===1){let Z=Y.pro[0]?.split("/")[1]||Y.pro[0];console.log(N.yellow(`\uD83D\uDD12 The ${N.cyan(Z)} component requires PRO access.`))}else console.log(N.yellow("\uD83D\uDD12 The following components require PRO access:")),Y.pro.forEach((Z)=>{let K=Z?.split("/")[1]||Z;console.log(` • ${N.cyan(K)}`)});console.log(),console.log("To access PRO components:"),console.log(` ${N.green("→")} If you've already purchased: ${N.cyan(`${z3()} untitledui@latest login`)}`),console.log(` ${N.green("→")} To purchase PRO components: ${N.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(!Y?.components.length)console.log("No components found"),process.exit(1);q.push(...Y.components)}if(!B?.type&&!B?.components.length){let Y=await s3(B.license);if(!Y)console.log("No component types found"),process.exit(1);let Z=await Q3({type:"select",name:"type",onState:$3,message:`What type of ${N.cyan("component")} are you adding?`,choices:Y?.types.map((K)=>({title:K,value:K}))});B.type=Z.type}if(!B?.path){let Y=await Q3({type:"text",name:"path",onState:$3,message:`Where would you like to add the ${N.cyan("components")}?`,initial:"components"});B.path=Y.path}if(!B?.components.length){let Y=await l3(B?.type,B.license);if(!Y)console.log("No components found"),process.exit(1);let Z=await Q3({type:"multiselect",name:"components",onState:$3,message:`Which ${N.cyan("components")} would you like to add?`,choices:Y?.components?.map((V)=>({title:V?.name+(V?.count?` (${V?.count} variants)`:"")||"example",value:V||"example",selected:B.components.includes(V.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!Z.components||!Z.components.length)console.log("No option selected. Exiting..."),process.exit(1);let K=Z.components.filter((V)=>V?.type==="file").map((V)=>V.name),R=Z.components.filter((V)=>V?.type==="dir").map((V)=>V.name),x=[];if(R.length){let V=await a3(B?.type,B.license,R);if(V&&V.components.length)for(let D of V.components){let[k,u]=Object.entries(D)[0]||[],I=await Q3({type:"select",name:"component",onState:$3,message:`Which ${N.cyan("variant")} from ${N.cyan(k)} would you like to add?`,choices:u?.map((P)=>({title:P?.name.replace(/-modal/g,"")||"example",value:P?.name||"example",selected:B.components.includes(P.name)})),instructions:!1,hint:"- Space to select. Return to submit"});if(!I.component)console.log("No variant selected for "+N.cyan(k));x.push(k+"/"+I.component)}else console.log("No variants found")}B.components=[...x,...K]}if(!B.components?.length)Q.warn("No components selected. Exiting."),process.exit(1);let L=t(z),j=new Set,b=new Set,y=new Set,S=new A0({tsConfigFilePath:L?.tsConfig});if(Q.start(),B.type&&B.components.length){let Y=await J3(B.type,B.components,B.license);if(!Y?.components.length)console.log("No components found"),process.exit(1);q.push(...Y.components)}let E=new Set;if(q.forEach((Y)=>{Y?.components?.forEach((Z)=>{E.add({name:Z.name,path:Z.path})})}),Q.stop(),E.size){let Y=Array.from(E).filter((Z)=>!F.existsSync(T.posix.join(z,`${$?.isSrcDir?"src":""}`,Z?.path?.replace(/components\//,B.path+"/"))));if(Y?.length){let Z=await Q3({type:"multiselect",name:"baseComponents",onState:$3,message:"Select which base components you want to add",choices:Y.map((K)=>({title:K?.name,value:K?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(B.baseComponents=Z.baseComponents,!Y.length&&!Z.baseComponents?.length)Q.warn("No components selected")}}if(Q.start(),B?.baseComponents?.length){let Y=await J3("",B.baseComponents,B.license);if(!Y||!Y?.components.length)console.log("No base components found");else q.push(...Y.components)}if(Q.stop(),q.forEach((Y)=>{let Z=Z3(`Adding ${Y.name}...`).start(),K=Y.files;Y?.dependencies?.forEach((R)=>b.add(R)),Y?.devDependencies?.forEach((R)=>y.add(R));try{if(K?.forEach(async({path:R,code:x})=>{let V=T.posix.join(z,`${$?.isSrcDir?"src":""}`,R.replace(/components\//,B.path+"/")),D=$?.framework==="vite"?x.replace(`"use client";
|
|
4
4
|
|
|
5
|
-
`,""):
|
|
6
|
-
Failed to add the component ${N.red(
|
|
7
|
-
Following files already exist in the directory.`),
|
|
5
|
+
`,""):x,k=b3(D),u=T.dirname(V);if(F.existsSync(V)&&!B.overwrite){if(F.readFileSync(V,"utf-8")!==k)j.add({code:k,path:V})}else{F.mkdirSync(u,{recursive:!0}),F.writeFileSync(V,k);let I=T.relative(T.posix.join(z,`${$?.isSrcDir?"src":""}`),V).split("/").length,P=I===1?"./":"../".repeat(I-1),O=S.addSourceFileAtPath(T.resolve(V));O.getImportDeclarations().forEach((i)=>{let g=i.getModuleSpecifierValue();i.setModuleSpecifier(e(g,B.path,$?.aliasPrefix,P))}),await O.save()}}),j.size)Z.warn(`Some files of ${N.yellow(Y.name)} already exist`);else Z.succeed(`${N.green(Y.name)} is added successfully`)}catch(R){Z.fail(`
|
|
6
|
+
Failed to add the component ${N.red(Y.name)}`),console.error(N.red(R)),process.exit(1)}}),j.size&&!B?.overwrite)if(console.log(`
|
|
7
|
+
Following files already exist in the directory.`),j.forEach((Z)=>{console.log(N.green(`- ${T.relative(z,Z.path)}`))}),(await Q3({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let Z=Z3("Overwriting files").start();j.forEach((K)=>{let R=T.relative(T.resolve(z,`${$?.isSrcDir?"src":""}`,B.path),K.path).split("/").length,x=R===1?"./":"../".repeat(R-1),V=S.addSourceFileAtPath(T.resolve(K.path));V.replaceWithText(K.code),V.getImportDeclarations().forEach((D)=>{let k=D.getModuleSpecifierValue();D.setModuleSpecifier(e(k,B.path,$?.aliasPrefix,x))}),V.saveSync()}),Z.succeed("Files are overwritten")}else console.log(`Use ${N.cyan("--overwrite")} or ${N.cyan("-o")} to overwrite existing files, or refer to the documentation ${N.cyan("https://www.untitled.com/docs")} for manual installation. The rest of the files are added.`);let U=C();if(b?.size){let Y=Z3("Installing component dependencies").start();await o3(()=>L3(U,[U==="npm"?"install":"add",...b],{cwd:z}).catch(async(Z)=>{if(Z.message.includes("peer"))Y.warn("Component dependencies conflict detected. Retrying with --legacy-peer-deps..."),Y.start("Installing component dependencies with --legacy-peer-deps flag"),await L3(U,[U==="npm"?"install":"add",...b,"--legacy-peer-deps"],{cwd:z})}),{retries:1}),Y.succeed("Component dependencies are installed")}if(y?.size){let Y=Z3("Installing component devDependencies").start();await o3(()=>L3(U,[U==="npm"?"install":"add","-D",...y],{cwd:z}).catch(async(Z)=>{if(Z.message.includes("peer"))Y.warn("Component devDependencies conflict detected. Retrying with --legacy-peer-deps..."),Y.start("Installing component devDependencies with --legacy-peer-deps flag"),await L3(U,[U==="npm"?"install":"add","-D",...y,"--legacy-peer-deps"],{cwd:z})}),{retries:1}),Y.succeed("Component devDependencies are installed")}if(B.message)console.log(B.message);process.exit(0)}import T3 from"chalk";import{Command as T0}from"commander";import*as f from"fs";import w0 from"http";import S0 from"open";import x0 from"ora";import C0 from"os";import*as S3 from"path";import{URL as F0}from"url";import*as M3 from"fs";import*as l from"path";import{fileURLToPath as E0}from"url";var _0=E0(import.meta.url),_3=l.dirname(_0);function D0(){let W=[l.join(_3,"..","templates","auth-template.html"),l.join(_3,"templates","auth-template.html"),l.join(process.cwd(),"node_modules","untitledui","templates","auth-template.html"),l.join(_3,"..","..","templates","auth-template.html")];for(let Q of W)if(M3.existsSync(Q))return Q;throw new Error("Auth template file not found. Please ensure the CLI package is properly installed.")}function e3(){try{let W=D0();return M3.readFileSync(W,"utf-8")}catch(W){return console.warn("Warning: Using fallback auth template. Some styling may be missing."),`<!doctype html>
|
|
8
8
|
<html lang="en">
|
|
9
9
|
<head>
|
|
10
10
|
<meta charset="UTF-8" />
|
|
@@ -50,31 +50,31 @@ Following files already exist in the directory.`),H.forEach((Y)=>{console.log(N.
|
|
|
50
50
|
{{AUTO_CLOSE_SCRIPT}}
|
|
51
51
|
</div>
|
|
52
52
|
</body>
|
|
53
|
-
</html>`}}function
|
|
54
|
-
✨ You can now access PRO components with the CLI!`)),process.exit(0)}catch(Q){W.fail(`Authentication failed: ${Q instanceof Error?Q.message:Q}`),process.exit(1)}});async function
|
|
55
|
-
Failed to open browser automatically: ${
|
|
56
|
-
`))}),W.text="Waiting for authentication in browser..."}),setTimeout(()=>{X.close(),z(new Error("Authentication timeout. Please try again."))},300000)})}function
|
|
57
|
-
`),process.exit(1)},
|
|
58
|
-
Creating a new project in ${A.blue(h)}`);let Y=
|
|
53
|
+
</html>`}}function z0(){return e3().replace("{{TITLE}}","Authentication successful").replace("{{HEADING}}","Authentication successful").replace("{{DESCRIPTION}}","You can now close this tab and return to your terminal.").replace("{{AUTO_CLOSE_SCRIPT}}","<script>setTimeout(() => window.close(), 10000);</script>")}function j3(W){return e3().replace("{{TITLE}}","Authentication failed").replace("{{HEADING}}","Authentication failed").replace("{{DESCRIPTION}}",W).replace("{{AUTO_CLOSE_SCRIPT}}","")}var w3=S3.join(C0.homedir(),".untitledui"),D3=S3.join(w3,"config.json"),Q0=new T0().name("login").description("authenticate with Untitled UI to access PRO components").action(async()=>{let W=x0("Starting authentication...").start();try{await k0(W),W.succeed("Authentication completed successfully!"),console.log(T3.green(`
|
|
54
|
+
✨ You can now access PRO components with the CLI!`)),process.exit(0)}catch(Q){W.fail(`Authentication failed: ${Q instanceof Error?Q.message:Q}`),process.exit(1)}});async function k0(W){return new Promise((Q,z)=>{let X=w0.createServer(($,q)=>{let L=new F0($.url,"http://localhost");if(L.pathname==="/callback"){let j=L.searchParams.get("apiKey"),b=L.searchParams.get("error");if(b){q.writeHead(400,{"Content-Type":"text/html"}),q.end(j3(decodeURIComponent(b))),X.close(),z(new Error(decodeURIComponent(b)));return}if(!j){q.writeHead(400,{"Content-Type":"text/html"}),q.end(j3("No Access Token received")),X.close(),z(new Error("No Access Token received"));return}try{P0(j),q.writeHead(200,{"Content-Type":"text/html"}),q.end(z0()),X.close(),Q()}catch(y){q.writeHead(500,{"Content-Type":"text/html"}),q.end(j3("Failed to save authentication data")),X.close(),z(y)}}else q.writeHead(404),q.end("Not found")});X.listen(0,"localhost",()=>{let L=`https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/cli-auth?port=${X.address().port}`;W.text="Opening browser for authentication...",S0(L).catch((j)=>{console.log(T3.yellow(`
|
|
55
|
+
Failed to open browser automatically: ${j.message}`)),console.log(T3.cyan(`Please manually open: ${L}
|
|
56
|
+
`))}),W.text="Waiting for authentication in browser..."}),setTimeout(()=>{X.close(),z(new Error("Authentication timeout. Please try again."))},300000)})}function P0(W){if(!f.existsSync(w3))f.mkdirSync(w3,{recursive:!0});let Q={};if(f.existsSync(D3))try{Q=JSON.parse(f.readFileSync(D3,"utf-8"))}catch{Q={}}Q.license=W,f.writeFileSync(D3,JSON.stringify(Q,null,2),"utf-8")}import g3 from"async-retry";import M from"chalk";import{Command as l0}from"commander";import{execa as I3}from"execa";import*as w from"fs";import X3 from"ora";import a0 from"os";import*as v from"path";import r from"prompts";import{Project as s0}from"ts-morph";import O0 from"node-fetch";async function H3(W,Q){try{let X=await O0("https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api/components/example",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({example:W,key:Q})});if(!X.ok){if(X.status===401||X.status===403)return{type:"error",status:X.status,message:"PRO access required"};return console.error(`API error: ${X.status} - ${X.statusText}`),null}return await X.json()}catch(X){return console.error(X?.message||"Error fetching example data."),null}}import q3 from"async-retry";import A from"chalk";import{Command as g0}from"commander";import{execa as a}from"execa";import R3 from"fast-glob";import _ from"fs";import W3 from"ora";import d0 from"os";import*as G from"path";import u3 from"prompts";import{Project as h0}from"ts-morph";import{fileURLToPath as f0}from"url";import*as v3 from"fs";import*as W0 from"path";function x3(W,Q){let z=W0.join(W,"package.json");if(!v3.existsSync(z))return Q;let X=JSON.parse(v3.readFileSync(z,"utf-8")),$={...X.dependencies,...X.devDependencies},q=[];for(let L of Q){let j=$[L];if(!j){q.push(L);continue}if(L==="tailwindcss"){let b=j.match(/\d+/);if((b?parseInt(b[0],10):0)<4)q.push(L)}}return q}import C3 from"chalk";import*as m from"fs";import*as G3 from"path";function F3(W){if(!m.existsSync(G3.resolve(W)))console.log(C3.red(`Error: CSS file not found at ${W}`)),process.exit(1);let Q=m.readFileSync(G3.resolve(W),"utf-8"),z=/(--color-[a-zA-Z-]+-\d{1,3}):\s*(rgb\([^)]+\))/g,X={},$;while(($=z.exec(Q))!==null)if($[1]&&$[2])X[$[1]]=$[2];return X}function k3(W,Q,z){let X=G3.resolve(z);if(!m.existsSync(X)){console.log(C3.red(`Error: CSS file not found at ${X}`));return}let $=m.readFileSync(X,"utf-8"),q=F3(z),L={},j={};for(let[y,S]of Object.entries(q))if(y.startsWith(`--color-${W}-`)){let E=y.replace(`--color-${W}-`,"");L[E]=y}else if(y.startsWith(`--color-${Q}-`)){let E=y.replace(`--color-${Q}-`,"");j[E]=S}let b=!1;for(let[y,S]of Object.entries(L))if(j[y]){let E=j[y],U=new RegExp(`(${S}):\\s*rgb\\([^)]*\\);?`,"g");if(U.test($))$=$.replace(U,`$1: ${E};`),b=!0;else console.log(C3.yellow(`No match found for ${S}`))}if(b)m.writeFileSync(X,$,"utf-8")}var m0=f0(import.meta.url),Y0=G.dirname(m0),c0=G.join(d0.homedir(),".untitledui"),s=G.join(c0,"config.json"),$0="vite",q0="nextjs",Z0={[q0]:"Next.js",[$0]:"Vite"},h="",H={color:"",template:"",framework:void 0};if(_.existsSync(s)){let W=JSON.parse(_.readFileSync(s,"utf-8"));H.license=W.license}var P3=(W)=>{if(W.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
|
|
57
|
+
`),process.exit(1)},X0=new g0().name("init").description("initialize a new project or adjust an existing one").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","display this help message.").option("--vite","initialize a Vite project.",!1).option("--nextjs","initialize a Next.js project.",!1).option("-o, --overwrite","overwrite existing files.",!1).option("--colors-list","show the colors list.",!1).option("-c, --color <color-name>","specify a color for the project.").action(async(W,Q)=>{if(W)h=W;if(Q){if(H.color=Q.color,H.template=Q.template,H.overwrite=Q.overwrite,H.colorsList=Q.colorsList,H.license=Q.license||H.license,H.vite=Q.vite,H.nextjs=Q.nextjs,Q.vite)H.framework=$0;if(Q.nextjs)H.framework=q0}try{await O3(Q),process.exit(0)}catch(z){console.error(A.red(z)),process.exit(1)}});async function O3(W,Q=null){let z=process.cwd(),X=_.existsSync(G.resolve(z,"package.json")),$=G.resolve(G.join(Y0,"../config/styles","theme.css")),q=F3($??""),L=Array.from(new Set(Object.keys(q).map((U)=>U?.split("--color-")?.[1]?.replace(/-\d{1,3}/,"")))),j=W3().start(),b=await o(z),y=X?R3.sync(["**/**/theme.css"],{cwd:z,absolute:!0,onlyFiles:!0,ignore:d}):[],S=y?.[0]&&_.readFileSync(y[0],"utf-8").match(/(--color-brand+-\d{1,3}):\s*(rgb\([^)]+\))/g)?.[1]||void 0;if(H.license){if(!_.existsSync(s)){let Y=G.dirname(s);_.mkdirSync(Y,{recursive:!0}),_.writeFileSync(s,JSON.stringify({license:H.license},null,2))}if(JSON.parse(_.readFileSync(s,"utf-8")).license!==H.license)_.writeFileSync(s,JSON.stringify({license:H.license},null,2))}if(!X){if(j.stop(),!h){let U=await u3({onState:P3,type:"text",name:"path",message:"What is your project named?",initial:"untitled-ui"});if(typeof U.path==="string")h=U.path.trim()}if(Q)Q.projectPath=h;if(_.existsSync(G.resolve(G.posix.join(z,h))))j.fail(A.red("Directory already exists!")),process.exit(1);if(H.vite&&H.nextjs||!H.framework){let U=await u3({type:"select",name:"framework",onState:P3,message:`Which ${A.cyan("framework")} would you like to use?`,choices:Object.entries(Z0).map(([Y,Z])=>({title:Z,value:Y}))});H.framework=U.framework}j.succeed("Framework is selected: "+A.green(Z0[H.framework]))}else if(b?.framework==="other")j.fail("Unsupported project framework"),console.log(`Please refer to the documentation ${A.cyan("https://www.untitled.com/docs")} for supported frameworks or proceed with manual installation.`),process.exit(1);else if(b?.framework.startsWith("next")||b?.framework.startsWith("vite"))if(!Q&&!S)j.succeed(A.yellow(`Detected ${r3[b.framework]} project, proceeding with the setup...`));else j.stop();if(H.colorsList||!H.color&&!S){let U=await u3({type:"select",name:"color",onState:P3,initial:W.color??"",message:`Which ${A.cyan("color")} would you like to use as the ${A.cyanBright("brand")} color?`,choices:L.map((Y)=>({title:Y,value:Y}))});H.color=U.color}let E=G.posix.join(z,h||"");if(h&&!X){let U=G.resolve(h);console.log(`
|
|
58
|
+
Creating a new project in ${A.blue(h)}`);let Y=W3("Downloading and extracting the repository...").start();try{_.mkdirSync(U,{recursive:!0}),await q3(()=>m3(U,{template:H.framework}),{retries:2}),Y.succeed("Files are downloaded and extracted successfully!");let Z=W3({text:"Installing dependencies..."}).start(),K=R3.sync(["**/styles/theme.css"],{cwd:U,absolute:!0,onlyFiles:!0})[0];if(k3("brand",H.color||"",K??""),await q3(()=>a(C(),["install"],{cwd:E}).catch(async(R)=>{if(R.message.includes("peer"))Z.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),Z.start("Installing dependencies with --legacy-peer-deps flag"),await a(C(),["install","--legacy-peer-deps"],{cwd:E})}),{retries:1}),await q3(()=>a("git",["init"],{cwd:E}),{retries:1}),Z.succeed("Dependencies are installed"),!Q)console.log(`
|
|
59
59
|
Your project is ready, to get started run the following commands:
|
|
60
60
|
|
|
61
61
|
cd ${A.cyan(h)}
|
|
62
|
-
${A.cyan(
|
|
63
|
-
Failed to download and extract the repository`)),
|
|
64
|
-
`);_.rmdirSync(
|
|
65
|
-
`),
|
|
62
|
+
${A.cyan(p3())}`)}catch(Z){if(Y.fail(A.red(`
|
|
63
|
+
Failed to download and extract the repository`)),Z instanceof Error)console.error(Z.message);else console.error(`
|
|
64
|
+
`);_.rmdirSync(U,{recursive:!0}),process.exit(1)}}else{let U=W3(),Y=new Set,Z=t(z),K=G.resolve(G.join(Y0,"../config")),R=R3.sync(["**"],{cwd:K,onlyFiles:!0,ignore:d}),x=x3(z,["tailwindcss","tailwindcss-animate","@tailwindcss/typography","tailwindcss-react-aria-components"]),V=x3(z,["@tailwindcss/postcss","postcss"]);if(!Q&&!S)U.start("Copying files to the project directory");if(R.forEach((u)=>{let I=u.includes("postcss.config"),P=G.posix.join(G.posix.join(K),u),O=G.posix.join(z,I?u:`${b?.isSrcDir?"src":""}/${u}`);if(_.existsSync(O)){if(H?.overwrite)_.copyFileSync(P,O);else{let i=_.readFileSync(O,"utf-8"),g=_.readFileSync(P,"utf-8");if(i!==g){if(u.endsWith("theme.css")&&S)return;Y.add({targetFile:O,sourceFile:P})}}return}_.mkdirSync(G.dirname(O),{recursive:!0}),_.writeFileSync(O,""),_.copyFileSync(P,O)}),U.stop(),Y.size&&!H?.overwrite)if(console.log(`
|
|
65
|
+
`),U.fail("Following files already exist in the directory."),Y.forEach((I)=>{console.log(`- ${A.green(I.targetFile)}`)}),(await u3({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let I=W3("Overwriting files").start();Y.forEach((P)=>{_.copyFileSync(P.sourceFile,P.targetFile)}),I.succeed("Files are overwritten")}else console.log(`Use ${A.cyan("--overwrite")} or ${A.cyan("-o")} to overwrite existing files, or refer to the documentation ${A.cyan("https://www.untitled.com/docs")} for manual installation. The rest of the files are added.`);if(Z?.tailwindFile)console.log(`
|
|
66
66
|
Tailwind config file exists in the project directory. You can add it to your globals.css as follows:`),console.log(`
|
|
67
|
-
${A.cyan(`@config "../${
|
|
68
|
-
`);if(
|
|
67
|
+
${A.cyan(`@config "../${b?.isSrcDir?"../":""}${G.relative(z,Z.tailwindFile)}";`)}
|
|
68
|
+
`);if(b?.framework==="vite"){if(!i3(z))console.log(`
|
|
69
69
|
Tailwind CSS is not configured in your Vite project. Please refer to the documentation ${A.cyan("https://www.untitled.com/react/integrations/vite")} for manual installation.
|
|
70
|
-
`)}let
|
|
71
|
-
`),
|
|
72
|
-
Ensure that the ${A.cyan("theme.css")} file exists in the project directory under ${A.yellow("styles/")} folder.`);if((
|
|
73
|
-
Your project is ready, you can now start adding components.`)}}var
|
|
74
|
-
`),process.exit(1)},
|
|
70
|
+
`)}let D=Z?.layoutFile||Z?.appFile||b?.framework==="vite"&&Z?.mainFile||"";if(!D)console.log(`Import following files to your main file:
|
|
71
|
+
`),R.forEach((u)=>{console.log(A.cyan(u))});else{let I=new h0({tsConfigFilePath:G.resolve(Z?.tsConfig||"")}).addSourceFileAtPath(G.resolve(D)),P="globals.css";I.getImportDeclarations().filter((g)=>g.getModuleSpecifierValue().includes("globals.css")).forEach((g)=>g.remove());let O=G.relative(G.resolve(z,`${b?.isSrcDir?"src":""}`),D).split("/").length,i=b?.aliasPrefix?.stylesPrefix||b?.aliasPrefix?.srcPrefix||(O===1?"./":"../".repeat(O-1));I.addImportDeclarations(R.filter((g)=>g.includes("globals.css")).map((g)=>({moduleSpecifier:`${i}${b?.aliasPrefix?.stylesPrefix?g?.split("styles/")[1]:g}`}))),I.saveSync()}let k=R3.sync(["**/styles/theme.css"],{cwd:z,absolute:!0,onlyFiles:!0,ignore:d});if(!k?.length)return U.fail(`Failed to copy ${A.cyan("theme.css")} file.
|
|
72
|
+
Ensure that the ${A.cyan("theme.css")} file exists in the project directory under ${A.yellow("styles/")} folder.`);if((H.color||!S)&&k3("brand",H.color||"brand",k[0]??""),x.length||V.length){let u=W3().start("Installing dependencies");x.length&&await q3(()=>a(C(),[C()==="npm"?"install":"add",...x],{cwd:E}).catch(async(I)=>{if(I.message.includes("peer"))u.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),u.start("Installing dependencies with --legacy-peer-deps flag"),await a(C(),[C()==="npm"?"install":"add",...x,"--legacy-peer-deps"],{cwd:E})}),{retries:1}),V.length&&await q3(()=>a(C(),[C()==="npm"?"install":"add","-D",...V],{cwd:E}).catch(async(I)=>{if(I.message.includes("peer"))u.warn("DevDependency conflict detected. Retrying with --legacy-peer-deps..."),u.start("Installing dependencies with --legacy-peer-deps flag"),await a(C(),[C()==="npm"?"install":"add","-D",...V,"--legacy-peer-deps"],{cwd:E})}),{retries:1}),u.succeed("Dependencies are installed")}if(!Q&&!S)U.succeed(A.green("Project setup is completed!"));if(Q&&X){j.stop(),U.stop();return}else console.log(`
|
|
73
|
+
Your project is ready, you can now start adding components.`)}}var r0=v.join(a0.homedir(),".untitledui"),n=v.join(r0,"config.json"),J={path:"",example:"",license:"",components:[]},d3={};if(w.existsSync(n)){let W=JSON.parse(w.readFileSync(n,"utf-8"));J.license=W.license}var Y3=(W)=>{if(W.aborted)process.stdout.write("\x1B[?25h"),process.stdout.write(`
|
|
74
|
+
`),process.exit(1)},B0=new l0().name("example").description("add an example to the project").argument("[example]","the example to add").option("-o, --overwrite","overwrite existing files.",!1).option("-p, --path <path>","the path to add the component to.").option("-e, --example-path <example-path>","the path to add the example file to.").action(async(W,Q)=>{if(W)J.example=W;if(Q)J.path=Q.path,J.overwrite=Q.overwrite,J.examplePath=Q.examplePath,J.license=Q.license||J.license;try{await O3(Q,d3),await n0(J)}catch(z){console.error(M.red(z))}});async function n0(W){let Q=X3().start(),z=v.posix.join(process.cwd(),d3?.projectPath||"");if(!w.existsSync(v.posix.join(v.resolve(z,"package.json"))))Q.warn("This command should be run in a project directory."),process.exit(1);let $=await o(z);if(J.license){if(!await B3(J.license))Q.fail("Invalid license key"),process.exit(1);if(!w.existsSync(n)){let K=v.dirname(n);w.mkdirSync(K,{recursive:!0}),w.writeFileSync(n,JSON.stringify({license:J.license},null,2))}if(JSON.parse(w.readFileSync(n,"utf-8")).license!==J.license)w.writeFileSync(n,JSON.stringify({license:J.license},null,2),"utf-8")}if(Q.stop(),!J.example){let Y=await r({type:"select",name:"example",onState:Y3,message:"Select which type of example you want to add",choices:[{title:"Application",value:"application"},{title:"Marketing",value:"marketing"}]});J.example=Y.example}let q=null;if(J.example){let Y=await H3(J.example,J.license);if(Y?.type==="error"&&(Y.status===401||Y.status===403))console.log(),console.log(M.yellow(`\uD83D\uDD12 The ${M.cyan(J.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${M.green("→")} If you've already purchased: ${M.cyan(`${z3()} untitledui@latest login`)}`),console.log(` ${M.green("→")} To purchase PRO examples: ${M.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1);if(Y?.type==="directory"){let Z=await r({type:"select",name:"example",onState:Y3,message:`Select a folder or file in "${J.example}"`,choices:Y.results.map((K)=>({title:K,value:K}))});if(!Z.example)return;if(J.example=Z.example,Y=await H3(Z.example,J.license),Y?.type==="error"&&(Y.status===401||Y.status===403))console.log(),console.log(M.yellow(`\uD83D\uDD12 The ${M.cyan(Z.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${M.green("→")} If you've already purchased: ${M.cyan(`${z3()} untitledui@latest login`)}`),console.log(` ${M.green("→")} To purchase PRO examples: ${M.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Y?.type==="json-files"){let Z=await r({type:"select",name:"example",onState:Y3,message:`Select which example you want to add from "${J.example}"`,choices:Y.results.map((K)=>({title:K,value:`${J.example}/${K}`}))});if(!Z.example)return;if(J.example=Z.example,Y=await H3(Z.example,J.license),Y?.type==="error"&&(Y.status===401||Y.status===403))console.log(),console.log(M.yellow(`\uD83D\uDD12 The ${M.cyan(Z.example)} example requires PRO access.`)),console.log(),console.log("To access PRO examples:"),console.log(` ${M.green("→")} If you've already purchased: ${M.cyan(`${z3()} untitledui@latest login`)}`),console.log(` ${M.green("→")} To purchase PRO examples: ${M.cyan("https://www.untitledui.com/buy/react")}`),console.log(),process.exit(1)}if(Y?.type==="json-file")q=Y.content}if(!q)Q.fail("No example found"),process.exit(1);if(!J?.examplePath){let Y=$?.isUsingAppDir?"app":"pages",Z=$?.isSrcDir?v.posix.join("src",Y):Y,K=await r({type:"text",name:"examplePath",onState:Y3,message:`Where would you like to add the ${M.cyan(J?.example)} example?`,initial:Z});J.examplePath=K.examplePath}else if(!w.existsSync(v.posix.join(z,J.examplePath)))w.mkdirSync(v.posix.join(z,J.examplePath),{recursive:!0}),console.log(M.green(`Created directory ${J.examplePath}`));if(!J?.path){let Y=await r({type:"text",name:"path",onState:Y3,message:`Where would you like to add the ${M.cyan("components")}?`,initial:"components"});J.path=Y.path}let L=q.components.filter((Y)=>!w.existsSync(v.posix.join(z,`${$?.isSrcDir?"src":""}`,Y?.path?.replace(/components\//,J.path+"/"))));if(L?.length){let Y=await r({type:"multiselect",name:"components",onState:Y3,message:`Select which components you want to add from ${M.cyan(q.name)} example`,choices:L.map((Z)=>({title:Z?.name,value:Z?.name,selected:!0})),instructions:!1,hint:"- Space to select. Return to submit"});if(J.components=Y.components,!L.length&&!Y.components?.length)Q.warn("No components selected")}let j=t(z),b=new Set,y=new s0({tsConfigFilePath:j?.tsConfig}),S=X3(`Adding ${J?.example}...`).start(),E="";try{if(q.files?.forEach(async({path:Y,code:Z})=>{let K=v.posix.join(z,`${$?.isSrcDir?"src":""}`,Y.replace(/components\//,J.path+"/")),R=$?.framework==="vite"?Z.replace(`"use client";
|
|
75
75
|
|
|
76
|
-
`,""):
|
|
77
|
-
Failed to add the component ${M.red(J?.example)}`),console.error(M.red(Y)),process.exit(1)}if(
|
|
78
|
-
Following files already exist in the directory.`),
|
|
79
|
-
\uD83C\uDF89 Example ${M.green(J.example)} has been added to ${M.green(
|
|
80
|
-
\uD83C\uDF89 Example ${M.green(J.example)} has been added to ${M.green(
|
|
76
|
+
`,""):Z,x=b3(R);if(Y.includes("examples")){let D=v.basename(Y);K=v.posix.join(z,J?.examplePath??"",D),E=v.posix.join(J?.examplePath??"",D)}let V=v.dirname(K);if(w.existsSync(K)&&!J.overwrite){if(w.readFileSync(K,"utf-8")!==x)b.add({code:x,path:K})}else{w.mkdirSync(V,{recursive:!0}),w.writeFileSync(K,x);let D=v.relative(v.posix.join(z,`${$?.isSrcDir?"src":""}`),K).split("/").length,k=D===1?"./":"../".repeat(D-1),u=y.addSourceFileAtPath(v.resolve(K));u.getImportDeclarations().forEach((I)=>{let P=I.getModuleSpecifierValue();I.setModuleSpecifier(e(P,J.path,$?.aliasPrefix,k))}),await u.save()}}),b.size)S.warn(`Some files of ${M.yellow(J?.example)} already exist`);else S.succeed(`${M.green(J?.example)} is added successfully`)}catch(Y){S.fail(`
|
|
77
|
+
Failed to add the component ${M.red(J?.example)}`),console.error(M.red(Y)),process.exit(1)}if(b.size&&!J?.overwrite)if(console.log(`
|
|
78
|
+
Following files already exist in the directory.`),b.forEach((Z)=>{console.log(M.green(`- ${v.relative(z,Z.path)}`))}),(await r({type:"confirm",name:"overwrite",message:"Do you want to overwrite the existing files?",initial:!0})).overwrite){let Z=X3("Overwriting files").start();b.forEach((K)=>{let R=v.relative(v.resolve(z,`${$?.isSrcDir?"src":""}`,J.path),K.path).split("/").length,x=R===1?"./":"../".repeat(R-1),V=y.addSourceFileAtPath(v.resolve(K.path));V.replaceWithText(K.code),V.getImportDeclarations().forEach((D)=>{let k=D.getModuleSpecifierValue();D.setModuleSpecifier(e(k,J.path,$?.aliasPrefix,x))}),V.saveSync()}),Z.succeed("Files are overwritten")}else console.log(`Use ${M.cyan("--overwrite")} or ${M.cyan("-o")} to overwrite existing files, or refer to the documentation ${M.cyan("https://www.untitled.com/docs")} for manual installation. The rest of the files are added.`);let U=C();if(q?.dependencies?.length){let Y=X3("Installing example dependencies").start();await g3(()=>I3(U,[U==="npm"?"install":"add",...q.dependencies],{cwd:z}).catch(async(Z)=>{if(Z.message.includes("peer"))Y.warn("Dependency conflict detected. Retrying with --legacy-peer-deps..."),Y.start("Installing dependencies with --legacy-peer-deps flag"),await I3(U,[U==="npm"?"install":"add",...q.dependencies,"--legacy-peer-deps"],{cwd:z})}),{retries:1}),Y.succeed("Example dependencies are installed")}if(q?.devDependencies?.length){let Y=X3("Installing example devDependencies").start();await g3(()=>I3(U,[U==="npm"?"install":"add","-D",...q.devDependencies],{cwd:z}).catch(async(Z)=>{if(Z.message.includes("peer"))Y.warn("DevDependency conflict detected. Retrying with --legacy-peer-deps..."),Y.start("Installing devDependencies with --legacy-peer-deps flag"),await I3(U,[U==="npm"?"install":"add","-D",...q.devDependencies,"--legacy-peer-deps"],{cwd:z})}),{retries:1}),Y.succeed("Example devDependencies are installed")}if(J?.components?.length)await g3(()=>E3({components:J.components,dir:d3?.projectPath||"",path:J.path,message:`
|
|
79
|
+
\uD83C\uDF89 Example ${M.green(J.example)} has been added to ${M.green(E)}`}),{retries:1});console.log(`
|
|
80
|
+
\uD83C\uDF89 Example ${M.green(J.example)} has been added to ${M.green(E)}`),process.exit(0)}var h3={name:"untitledui",version:"0.1.43-beta.1",main:"dist/index.mjs",description:"The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",type:"module",publishConfig:{access:"public"},scripts:{test:'echo "Error: no test specified" && exit 1',dev:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/react/api --watch",build:"bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api","publish:npm":"bun run build && npm publish --access public",start:"node dist/index.mjs"},bugs:{url:"https://github.com/untitleduico/react/issues"},homepage:"https://github.com/untitleduico/react#readme",keywords:["untitledui","untitled-ui","untitledui","untitledui-cli","untitledui-react","untitledui-components","untitledui-examples","untitledui-vite","untitledui-nextjs","cli","tailwindcss","nextjs","react","components","examples","vite"],files:["dist","config","templates","README.md"],author:{name:"Untitled UI",url:"https://www.untitledui.com/react"},contributors:[{name:"Dilshod Turobov",url:"https://x.com/deebovv"},{name:"Jordan Hughes",url:"https://x.com/jordanphughes"}],license:"MIT",bin:{untitledui:"dist/index.mjs"},exports:"./dist/index.mjs",dependencies:{"async-retry":"^1.3.3",chalk:"^5.4.1",commander:"^13.1.0",execa:"^7.0.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",open:"^10.1.0",ora:"^8.2.0",prettier:"^3.5.3",prompts:"^2.4.2",tar:"^7.4.3","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.37.0",typescript:"^5.8.2"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function o0(){let W=new p0().name(h3.name).version(h3.version);W.addCommand(X0).addCommand(t3).addCommand(B0).addCommand(Q0),W.parse()}o0();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "untitledui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.43-beta.1",
|
|
4
4
|
"main": "dist/index.mjs",
|
|
5
5
|
"description": "The Untitled UI CLI tool helps you quickly scaffold projects with Untitled UI React and add components and page examples to your existing projects with an interactive interface in seconds.",
|
|
6
6
|
"type": "module",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"dev": "bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=http://localhost:3000/react/api --watch",
|
|
13
|
-
"build": "bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://
|
|
13
|
+
"build": "bun build --entrypoints ./index.ts --entry-naming=[name].mjs --outdir=dist --target=node --minify --packages=external --env=inline --define=process.env.API_URL=https://untitledui-docs-git-separate-s-3bf698-dilshod-turobovs-projects.vercel.app/react/api",
|
|
14
14
|
"publish:npm": "bun run build && npm publish --access public",
|
|
15
15
|
"start": "node dist/index.mjs"
|
|
16
16
|
},
|