untitledui 0.1.60 → 0.1.61
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 +2 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -85,7 +85,7 @@ Your project is ready, you can now start adding components.`)}}var G={path:"",ex
|
|
|
85
85
|
Please check your path aliases in components.json and tsconfig.json.`);c.mkdirSync(d,{recursive:!0}),c.writeFileSync(T,C);let q=j.getSourceFile(S.resolve(T));if(q)q.replaceWithText(C);else q=j.addSourceFileAtPath(S.resolve(T));q.getImportDeclarations().forEach((K)=>{let M=K.getModuleSpecifierValue();K.setModuleSpecifier(E$(M,G.path,Z?.aliases))}),await q.save()}}if(J.size)_.warn(`Some files of ${I.yellow(G?.example)} already exist`);else _.succeed(`${I.green(G?.example)} is added successfully`)}catch(W){_.fail(`
|
|
86
86
|
Failed to add the component ${I.red(G?.example)}`),console.error(I.red(W)),process.exit(1)}if(J.size&&!G?.overwrite){console.log(`
|
|
87
87
|
Following files already exist in the directory.`),J.forEach((y)=>{console.log(I.green(`- ${S.relative(z,y.path)}`))});let W=!1;if(G.yes)W=!0,console.log(I.yellow("Auto-overwriting existing files (--yes mode)"));else{let y=await N$({type:"confirm",name:"overwrite",onState:f,message:"Do you want to overwrite the existing files?",initial:!0});if(y.overwrite===void 0)console.log(`
|
|
88
|
-
Use ${I.cyan("--overwrite")} or ${I.cyan("-o")} flag to overwrite existing files, or run with ${I.cyan("node")} instead of ${I.cyan("bun")}.`),process.exit(1);W=y.overwrite}if(W){let y=v$("Overwriting files").start();J.forEach((V)=>{let w=j.addSourceFileAtPath(S.resolve(V.path));w.replaceWithText(V.code),w.getImportDeclarations().forEach((T)=>{let E=T.getModuleSpecifierValue();T.setModuleSpecifier(E$(E,G.path,Z?.aliases))}),w.saveSync()}),y.succeed("Files are overwritten")}}if(Y?.dependencies?.length){let W=v$().start();await B$(Y.dependencies,{cwd:z,spinner:W,label:"example dependencies"})}if(Y?.devDependencies?.length){let W=v$().start();await B$(Y.devDependencies,{cwd:z,dev:!0,spinner:W,label:"example devDependencies"})}if(G?.components?.length)await J3(()=>Y0({components:G.components,dir:V0?.projectPath||"",path:G.path,message:""}),{retries:1});console.log(`
|
|
88
|
+
Use ${I.cyan("--overwrite")} or ${I.cyan("-o")} flag to overwrite existing files, or run with ${I.cyan("node")} instead of ${I.cyan("bun")}.`),process.exit(1);W=y.overwrite}if(W){let y=v$("Overwriting files").start();J.forEach((V)=>{let w=j.addSourceFileAtPath(S.resolve(V.path));w.replaceWithText(V.code),w.getImportDeclarations().forEach((T)=>{let E=T.getModuleSpecifierValue();T.setModuleSpecifier(E$(E,G.path,Z?.aliases))}),w.saveSync()}),y.succeed("Files are overwritten")}}if(Y?.dependencies?.length){let W=v$().start();await B$(Y.dependencies,{cwd:z,spinner:W,label:"example dependencies"})}if(Y?.devDependencies?.length){let W=v$().start();await B$(Y.devDependencies,{cwd:z,dev:!0,spinner:W,label:"example devDependencies"})}if(G?.components?.length)await J3(()=>Y0({components:G.components,dir:V0?.projectPath||"",path:G.path,license:G.license,message:""}),{retries:1});console.log(`
|
|
89
89
|
\uD83C\uDF89 Example ${I.green(G.example)} has been added to ${I.green(L)}`),process.exit(0)}import P from"chalk";import{Command as L3}from"commander";import W1 from"fast-glob";import _$ from"fs";import Y1 from"ora";import C$ from"path";import V3 from"prompts";var j3={ArrowRight:"ArrowNext",ArrowLeft:"ArrowPrevious",ChevronRight:"ChevronNext",ChevronLeft:"ChevronPrevious",ChevronRightDouble:"ChevronNextDouble",ChevronLeftDouble:"ChevronPreviousDouble"},N3=[{pattern:/\bml-/g,replace:"ms-",description:"ml- → ms-"},{pattern:/\bmr-/g,replace:"me-",description:"mr- → me-"},{pattern:/\bpl-/g,replace:"ps-",description:"pl- → ps-"},{pattern:/\bpr-/g,replace:"pe-",description:"pr- → pe-"},{pattern:/(?<!from-|to-|placement-)(?<!\bin-placement-)\bleft-/g,replace:"start-",description:"left- → start-"},{pattern:/(?<!from-|to-|placement-)(?<!\bin-placement-)\bright-/g,replace:"end-",description:"right- → end-"},{pattern:/\brounded-l-/g,replace:"rounded-s-",description:"rounded-l- → rounded-s-"},{pattern:/\brounded-r-/g,replace:"rounded-e-",description:"rounded-r- → rounded-e-"},{pattern:/\brounded-tl-/g,replace:"rounded-ss-",description:"rounded-tl- → rounded-ss-"},{pattern:/\brounded-tr-/g,replace:"rounded-se-",description:"rounded-tr- → rounded-se-"},{pattern:/\brounded-bl-/g,replace:"rounded-es-",description:"rounded-bl- → rounded-es-"},{pattern:/\brounded-br-/g,replace:"rounded-ee-",description:"rounded-br- → rounded-ee-"},{pattern:/\bborder-l-/g,replace:"border-s-",description:"border-l- → border-s-"},{pattern:/\bborder-r-/g,replace:"border-e-",description:"border-r- → border-e-"},{pattern:/\bborder-l\b/g,replace:"border-s",description:"border-l → border-s"},{pattern:/\bborder-r\b/g,replace:"border-e",description:"border-r → border-e"},{pattern:/\btext-left\b/g,replace:"text-start",description:"text-left → text-start"},{pattern:/\btext-right\b/g,replace:"text-end",description:"text-right → text-end"},{pattern:/\bfloat-left\b/g,replace:"float-start",description:"float-left → float-start"},{pattern:/\bfloat-right\b/g,replace:"float-end",description:"float-right → float-end"},{pattern:/\bclear-left\b/g,replace:"clear-start",description:"clear-left → clear-start"},{pattern:/\bclear-right\b/g,replace:"clear-end",description:"clear-right → clear-end"},{pattern:/\bscroll-ml-/g,replace:"scroll-ms-",description:"scroll-ml- → scroll-ms-"},{pattern:/\bscroll-mr-/g,replace:"scroll-me-",description:"scroll-mr- → scroll-me-"},{pattern:/\bscroll-pl-/g,replace:"scroll-ps-",description:"scroll-pl- → scroll-ps-"},{pattern:/\bscroll-pr-/g,replace:"scroll-pe-",description:"scroll-pr- → scroll-pe-"}],G$="(?:(sm|md|lg|xl|2xl):)?";function b$($,z){let Q=$.match(/^(sm|md|lg|xl|2xl):/);return Q?`${$} ${Q[1]}:rtl:${z}`:`${$} rtl:${z}`}var b3=[{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-in-from-right(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-in-from-left)/g,replace:($)=>`${$} rtl:slide-in-from-left${$.replace("slide-in-from-right","")}`,description:"slide-in-from-right + rtl:slide-in-from-left",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-in-from-left(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-in-from-right)/g,replace:($)=>`${$} rtl:slide-in-from-right${$.replace("slide-in-from-left","")}`,description:"slide-in-from-left + rtl:slide-in-from-right",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-out-to-right(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-out-to-left)/g,replace:($)=>`${$} rtl:slide-out-to-left${$.replace("slide-out-to-right","")}`,description:"slide-out-to-right + rtl:slide-out-to-left",needsReview:!0},{pattern:/(?<!placement-\w+:|in-placement-\w+:|rtl:)\bslide-out-to-left(?:-([\d.]+|\[\S+\]))?\b(?!\s+rtl:slide-out-to-right)/g,replace:($)=>`${$} rtl:slide-out-to-right${$.replace("slide-out-to-left","")}`,description:"slide-out-to-left + rtl:slide-out-to-right",needsReview:!0},{pattern:new RegExp(`(?<![-:])${G$}translate-x-([\\d./]+(?=\\s|$|")|full|px|\\[\\S+\\])(?!\\s+rtl:)`,"g"),replace:($)=>b$($,`-${$.replace(/^(sm|md|lg|xl|2xl):/,"")}`),description:"translate-x + rtl:-translate-x",needsReview:!0},{pattern:new RegExp(`(?<=^|\\s|")${G$}-translate-x-([\\d./]+(?=\\s|$|")|full|px|\\[\\S+\\])(?!\\s+rtl:)`,"g"),replace:($)=>{let z=$.match(/^(sm|md|lg|xl|2xl):/),Q=$.slice($.indexOf("-translate-x-")+13);return z?`${$} ${z[1]}:rtl:translate-x-${Q}`:`${$} rtl:translate-x-${Q}`},description:"-translate-x + rtl:translate-x",needsReview:!0},{pattern:new RegExp(`\\b${G$}space-x-(\\d+(?:\\.\\d+)?|\\[\\S+\\])(?!\\s+(?:sm:|md:|lg:|xl:|2xl:)?rtl:space-x-reverse)`,"g"),replace:($)=>b$($,"space-x-reverse"),description:"space-x + rtl:space-x-reverse",needsReview:!0},{pattern:new RegExp(`\\b${G$}divide-x(?:-(\\d+(?:\\.\\d+)?|\\[\\S+\\]))?(?!\\s+(?:sm:|md:|lg:|xl:|2xl:)?rtl:divide-x-reverse)`,"g"),replace:($)=>b$($,"divide-x-reverse"),description:"divide-x + rtl:divide-x-reverse",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${G$}bg-linear-to-r\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-linear-to-l)`,"g"),replace:($)=>b$($,"bg-linear-to-l"),description:"bg-linear-to-r + rtl:bg-linear-to-l",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${G$}bg-linear-to-l\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-linear-to-r)`,"g"),replace:($)=>b$($,"bg-linear-to-r"),description:"bg-linear-to-l + rtl:bg-linear-to-r",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${G$}bg-gradient-to-r\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-gradient-to-l)`,"g"),replace:($)=>b$($,"bg-gradient-to-l"),description:"bg-gradient-to-r + rtl:bg-gradient-to-l",needsReview:!0},{pattern:new RegExp(`(?<!rtl:)\\b${G$}bg-gradient-to-l\\b(?! (?:sm:|md:|lg:|xl:|2xl:)?rtl:bg-gradient-to-r)`,"g"),replace:($)=>b$($,"bg-gradient-to-r"),description:"bg-gradient-to-l + rtl:bg-gradient-to-r",needsReview:!0}],_3=/\bleft-1\/2\b.*-translate-x-1\/2|-translate-x-1\/2.*\bleft-1\/2\b/,X1=/\b(ml-|mr-|pl-|pr-|left-|right-|rounded-[lr]-|rounded-t[lr]-|rounded-b[lr]-|border-[lr]|text-left|text-right|float-left|float-right|scroll-m[lr]-|scroll-p[lr]-|translate-x-|space-x-|divide-x|bg-linear-to-[lr]|bg-gradient-to-[lr]|slide-in-from-(?:left|right)|slide-out-to-(?:left|right))/;function B1($,z){let Q=$;for(let U of z)Q=Q.replace(U.pattern,U.replace);return Q}function A3($,z,Q){let U={file:$,changes:[]},Z=z.split(`
|
|
90
90
|
`);for(let Y=0;Y<Z.length;Y++){let X=Z[Y];if(/^\s*(import\b|export\b.*from\b)/.test(X)||/\brequire\s*\(/.test(X))continue;if(_3.test(X))continue;let H=X,B=!1;if(H=H.replace(/"([^"]*)"|'([^']*)'|`([^`$]*)`|`([^`$]*)\$\{/g,(J,j,_,L,b)=>{let W=j??_??L??b;if(W==null||!X1.test(W))return J;let y=B1(W,Q);if(y!==W)return B=!0,J.replace(W,y);return J}),B&&H!==X)Z[Y]=H,U.changes.push({line:Y+1,before:X.trim(),after:H.trim()})}return U}function D3($){let z=0,Q=$;for(let[U,Z]of Object.entries(j3)){let Y=new RegExp(`\\b${U}\\b`,"g"),X=Q;if(Q=Q.replace(Y,Z),Q!==X)z+=(X.match(Y)||[]).length}return{content:Q,swaps:z}}async function I3($){let z=C$.resolve($);return W1(["**/*.tsx","**/*.ts"],{cwd:z,absolute:!0,ignore:["**/node_modules/**","**/*.story.tsx","**/*.demo.tsx","**/*.test.tsx"]})}var H1="[data-rtl-flip]:dir(rtl) { transform: scaleX(-1); }";function U1($){let z=["global.css","globals.css","styles/global.css","styles/globals.css","src/global.css","src/globals.css","src/styles/global.css","src/styles/globals.css","app/global.css","app/globals.css"];for(let U of z){let Z=C$.resolve($,U);if(_$.existsSync(Z))return Z}let Q=W1.sync(["**/*.css"],{cwd:$,absolute:!0,ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"]});for(let U of Q){let Z=_$.readFileSync(U,"utf-8");if(Z.includes("@import")&&Z.includes("tailwindcss"))return U}return Q[0]||null}function E3($,z){let Q=_$.readFileSync($,"utf-8");if(Q.includes("data-rtl-flip"))return!1;let U=Q.trimEnd()+`
|
|
91
91
|
|
|
@@ -177,4 +177,4 @@ Use ${I.cyan("--overwrite")} or ${I.cyan("-o")} flag to overwrite existing files
|
|
|
177
177
|
`));for(let q of b.slice(0,10)){console.log(D.dim(` ${q.file}`));for(let K of q.changes.slice(0,3))console.log(D.red(` - ${K.before.substring(0,100)}`)),console.log(D.green(` + ${K.after.substring(0,100)}`));if(q.changes.length>3)console.log(D.dim(` ... and ${q.changes.length-3} more`))}if(b.length>10)console.log(D.dim(`
|
|
178
178
|
... and ${b.length-10} more files`))}console.log(D.dim(`
|
|
179
179
|
Run without --dry-run to apply changes.
|
|
180
|
-
`))}else console.log(D.green("\n Done! Run `bun run build` to verify.")),console.log(D.dim(" If something went wrong, run `git checkout .` to revert.\n"))});var D0={name:"untitledui",version:"0.1.
|
|
180
|
+
`))}else console.log(D.green("\n Done! Run `bun run build` to verify.")),console.log(D.dim(" If something went wrong, run `git checkout .` to revert.\n"))});var D0={name:"untitledui",version:"0.1.61",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:"bun test __tests__/",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://www.untitledui.com/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",repository:{type:"git",url:"https://github.com/untitleduico/react.git",directory:"cli"},engines:{node:">=18"},keywords:["untitledui","untitled-ui","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.6.2",commander:"^13.1.0",execa:"^7.2.0","fast-glob":"^3.3.3","node-fetch":"^3.3.2",open:"^10.2.0",ora:"^8.2.0",prettier:"^3.7.4",prompts:"^2.4.2",tar:"^7.5.2","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0","update-check":"^1.5.4"},devDependencies:{"@types/async-retry":"^1.4.9","@types/bun":"^1.3.10","@types/prompts":"^2.4.9","@types/tar":"^6.1.13","type-fest":"^4.41.0",typescript:"^5.9.3"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function n3(){let $=new i3().name(D0.name).version(D0.version);$.addCommand(Q1).addCommand(s0).addCommand(Z1).addCommand(q1).addCommand(n0).addCommand(K1).addCommand(E1),$.parse()}n3();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "untitledui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
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",
|