@jongh/cli 1.3.1 → 1.4.0
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 +7 -0
- package/package.json +6 -3
- package/dist/index.cjs +0 -697
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {Command}from'commander';import {intro,confirm,select,outro,spinner,log}from'@clack/prompts';import ee from'chalk';import {execa}from'execa';import $ from'fs-extra';import {detect}from'package-manager-detector';import b from'path';import {z as z$1,ZodError}from'zod';import ye from'fast-glob';import {loadConfig,createMatchPath}from'tsconfig-paths';import {Project,Node,SyntaxKind}from'ts-morph';import {packageDirectory}from'pkg-dir';var R=t=>{let e={};for(let o of t)e[o]=o;return e},O=R(["config_not_found","resolve_path_fail","failed_to_fetch"]);R(["components.json","tsconfig.json","panda.config.*","package.json"]);var w=class extends Error{issue;constructor(e){super(),this.name="NewError",this.issue=e;}get format(){return this.issue.code+`
|
|
3
|
+
`+this.issue.message?.join(`
|
|
4
|
+
`)}},l=t=>{let e;switch(t.code){case O.config_not_found:e=`error occured while config ${t.configFile}`;break;case O.resolve_path_fail:e=`failed to resolve your path, current ${t.cwd}`;break;case O.failed_to_fetch:e=`failed to fetch ${t.target} [${t.statusCode}]`;break;default:e="error occured";}return new w({...t,message:[...t.message||"",e]})};var C={fileName:"components.json",schema:z$1.object({utils:z$1.string(),components:z$1.string(),hooks:z$1.string(),styledsystem:z$1.string()}).strict()},ue=["ui","hooks","utils"],he=z$1.object({name:z$1.string(),content:z$1.string(),type:z$1.enum(ue)}),z=z$1.object({name:z$1.string(),dependencies:z$1.array(z$1.string()).optional(),files:z$1.array(he).optional()}),L=z$1.object({name:z$1.string(),dependencies:z$1.array(z$1.string()).optional(),file:z$1.string()});function U(t){try{return $.readJsonSync(b.resolve(t,C.fileName))}catch(e){return l({code:"config_not_found",configFile:C.fileName,message:[e instanceof Error?e.message:""]})}}function v(t){let e=loadConfig(t);if(e.resultType==="failed")throw l({code:"config_not_found",configFile:"tsconfig.json",message:["cannot found tsconfig.json"]});return e}async function J(t){return await $.pathExists(b.join(t,"components.json"))}function K(t,e){let o=["./","./src/","./app/","./src/app"].map(a=>b.resolve(t,a));for(let[a,r]of Object.entries(e.paths)){let s=b.join(t,e.baseUrl||"",r[0].replace(/\/\*$/,""));if(o.some(i=>i===s||i.includes(s)))return a.replace(/\/\*$/,"")}return null}function W(t,e,o){let a=b.join(t,e);for(let[r,s]of Object.entries(o.paths)){let i=s[0].replace(/\/\*$/,"");if(a===b.join(t,o.baseUrl||"",i))return r.replace(/\/\*$/,"")}return null}async function _(t){try{let e=await ye.glob(["panda.config.*"],{cwd:t,deep:3});if(!e.length)throw l({code:"config_not_found",configFile:"panda.config.*",message:["failed to find panda.config file"]});return e[0]}catch(e){throw l({code:"config_not_found",configFile:"panda.config.*",message:[e instanceof Error?e.message:"unknown error occured finding panda.config"]})}}async function T(t,e){let o=createMatchPath(e.absoluteBaseUrl,e.paths)(t,void 0,()=>true);if(!o)throw l({code:"resolve_path_fail",target:t,cwd:process.cwd(),message:["resolve error"]});return o}async function F(t){let e=t.match(/outdir:\s*["']([^"']+)["']/),o=t.match(/importMap:\s*({[^}]+}|["'][^"']+["'])/),a=e?e[1]:null,r=null;if(o){let s=o[1];if(s.startsWith("{")){let i=s.match(/css:\s*["']([^"']+)["']/);r=i?i[1].replace(/\/css$/,""):null;}else r=s.replace(/["']/g,"");}return {outdir:a,importMap:r}}function Y(t,e){let o=t;return [{from:/@utils\//g,to:`${e.utils}/`},{from:/@hooks\//g,to:`${e.hooks}/`},{from:/@styled-system\//g,to:`${e.styledsystem}/`},{from:/@components\//g,to:`${e.components}/`}].forEach(({from:r,to:s})=>{o=o.replace(r,s);}),o}function Q(t,e,o){let r=new Project().addSourceFileAtPath(t),s=r.getFirstDescendant(p=>Node.isCallExpression(p)&&p.getExpression().getText()==="definePreset");if(!s)return;let i=s?.getFirstDescendant(p=>Node.isPropertyAssignment(p)&&p.getName()==="recipes");if(!i)return;let f=i.getFirstDescendantByKind(SyntaxKind.ObjectLiteralExpression);if(!f)return;r.getImportDeclarations().some(p=>{let g=p.getModuleSpecifierValue(),m=p.getNamedImports();return g===o&&m.some(u=>u.getName()===`${e}Recipe`)})||(r.addImportDeclaration({moduleSpecifier:o,namedImports:[{name:`${e}Recipe`}]}),f.addPropertyAssignment({name:e,initializer:`${e}Recipe`})),r.saveSync();}function Z(t){let o=new Project().addSourceFileAtPath(t),a=[{namedImports:[{name:"preset"}],moduleSpecifier:"panda-animation"},{namedImports:[{name:"defaultPreset"}],moduleSpecifier:"./preset"}];o.addImportDeclarations(a);let s=o.getFirstDescendantByKind(SyntaxKind.CallExpression)?.getArguments()[0];s?(s.getProperty("presets")||s.addPropertyAssignment({name:"presets",initializer:'[preset(), "@pandacss/preset-panda", defaultPreset"]'}),o.saveSync()):console.warn("Could not modify panda.config.ts. add presets : [preset(), @pandacss/preset-panda, defaultPreset] in your panda.config");}async function q(t){let e=await detect({cwd:t});if(!e)throw new Error("package manager not found");return e.name==="pnpm"?"pnpm exec":e.name==="bun"?"bunx":e.name==="yarn"?"yarn dlx":"npx"}var Pe=z$1.object({components:z$1.array(z$1.string()).optional(),cwd:z$1.string()}),ve="https://whdgur.shop",oe=new Command().name("add").argument("[components...]").option("-c, --cwd <cwd>","current working directory, default to process.cwd()",process.cwd()).action(async(t,e)=>{let o=ee.bold.red,a=ee.bold.blue;try{let r=Pe.parse({components:t,...e});intro(a("install components..."));let s=C.schema.parse(U(r.cwd)),i=await v(r.cwd),f=await _(r.cwd),h=await $.readFile(b.resolve(r.cwd,f),"utf-8"),{outdir:p}=await F(h),g=C.schema.parse({utils:await T(s.utils,i),components:await T(s.components,i),hooks:await T(s.hooks,i),styledsystem:b.join(r.cwd,p||"styled-system")}),m=r.components?.map(c=>c.toLowerCase());if(!m?.length)return;(await Promise.allSettled(m?.map(async c=>{try{let n=await fetch(`${ve}/${c}.json`);if(!n.ok)throw new Error("fetch error",{cause:{code:"failed_to_fetch",target:c,statusCode:n.status,message:[n.statusText]}});return await n.json()}catch(n){if(n instanceof TypeError)throw l({code:"failed_to_fetch",target:c,statusCode:null,message:[o(n.message),o(n.cause?JSON.stringify(n.cause):"cause by typeError")]});if(n instanceof Error)throw l(n.cause)}}))).forEach(async(c,n)=>{if(c.status==="rejected"){c.reason instanceof w&&console.log(o(c.reason.format));return}try{let y=z.parse(c.value),j=b.join(g.components,m[n]);if($.pathExistsSync(j)&&!await confirm({message:`Component ${m[n]} already exists. Do you want to overwrite it?`}))return;y.files?.forEach(x=>{let D=Y(x.content,s);x.name==="recipe.ts"&&Q(b.join(r.cwd,"preset.ts"),`${m[n]}`,b.join(s.components,`${m[n]}`,"recipe")),x.type==="ui"?$.outputFileSync(b.join(j,x.name),D):$.outputFileSync(b.join(g[x.type],x.name),D,"utf-8");});let I=await detect({cwd:r.cwd}),P=I?I.name:"";P||(P=await select({message:"cannot find package manager, select",options:[{value:"npm",label:"npm"},{value:"pnpm",label:"pnpm"},{value:"yarn",label:"yarn"}]})),y.dependencies?.length&&await execa(P,[P==="npm"?"install":"add",...y.dependencies]);let fe=await q(r.cwd),[le,...ge]=fe.split(" ");execa(le,[...ge,"panda","codegen"]),outro(a(`${m[n]} completed successfully`));}catch(y){console.log(y);}});}catch(r){console.log(r),r instanceof ZodError&&o(r.message),r instanceof w&&o(r.format),r instanceof Error&&o(r.message),outro(a("error occured")),process.exit(1);}});var _e="https://whdgur.shop";async function re(){let t=await fetch(`${_e}/preset.json`);if(!t.ok)throw l({code:"failed_to_fetch",target:"preset.json",statusCode:t.status});let e=await t.json();return L.parse(e)}var Ae=z$1.object({cwd:z$1.string()}),ne=new Command().name("init").description("Initialize the project").option("-c, --cwd <cwd>","current working directory, default to process.cwd()",process.cwd()).action(async t=>{let e=spinner();e.start("Initializing");try{let o=Ae.parse({cwd:b.resolve(t.cwd)});await Oe(o),e.stop("successfully Initialized!");}catch(o){o instanceof w&&console.error(o.format),e.stop("Failed to initialize"),process.exit(0);}});async function Oe(t){let e=t.cwd||await packageDirectory();if(!e)throw l({code:"config_not_found",configFile:"package.json",message:[`cannot find package.json in ${e}`]});let o=v(e);await J(e)&&(await confirm({message:"you already initialize,are you want to overwrite it?"})||process.exit(1));let r=await _(e),s=await $.readFile(b.join(e,r),"utf-8"),i=K(e,o),f="styled-system",{outdir:h,importMap:p}=await F(s);p?f=p:f=W(e,h||"styled-system",o)||".",h&&(f=h);let g=C.schema.parse({utils:`${i}/utils`,components:`${i}/components`,hooks:`${i}/hooks`,styledsystem:f}),m=await re();return $.writeFile(b.join(e,m.name),JSON.parse(m.file)),Z(b.resolve(e,r)),await $.writeFile(b.resolve(e,"components.json"),JSON.stringify(g),"utf-8"),g}var ae={"@radix-ui/react-accessible-icon":"AccessibleIcon","@radix-ui/react-accordion":"Accordion","@radix-ui/react-alert-dialog":"AlertDialog","@radix-ui/react-aspect-ratio":"AspectRatio","@radix-ui/react-avatar":"Avatar","@radix-ui/react-checkbox":"Checkbox","@radix-ui/react-collapsible":"Collapsible","@radix-ui/react-context-menu":"ContextMenu","@radix-ui/react-dialog":"Dialog","@radix-ui/react-direction":"Direction","@radix-ui/react-dropdown-menu":"DropdownMenu","@radix-ui/react-form":"Form","@radix-ui/react-hover-card":"HoverCard","@radix-ui/react-label":"Label","@radix-ui/react-menubar":"Menubar","@radix-ui/react-navigation-menu":"NavigationMenu","@radix-ui/react-popover":"Popover","@radix-ui/react-portal":"Portal","@radix-ui/react-progress":"Progress","@radix-ui/react-radio-group":"RadioGroup","@radix-ui/react-scroll-area":"ScrollArea","@radix-ui/react-select":"Select","@radix-ui/react-separator":"Separator","@radix-ui/react-slider":"Slider","@radix-ui/react-slot":"Slot","@radix-ui/react-switch":"Switch","@radix-ui/react-tabs":"Tabs","@radix-ui/react-toast":"Toast","@radix-ui/react-toggle":"Toggle","@radix-ui/react-toggle-group":"ToggleGroup","@radix-ui/react-toolbar":"Toolbar","@radix-ui/react-tooltip":"Tooltip","@radix-ui/react-visually-hidden":"VisuallyHidden"};function A(t,e,o){return o?t===o:t===e}function ie(t){return `import {${t}} from "radix-ui"`}function ce(t){let e=[];return t.getImportDeclarations().forEach(o=>{let a=o.getModuleSpecifierValue();if(!(a in ae))return;let r=ae[a];e.push(a);let s=o.getNamespaceImport();if(s){let f=s.getText();r!==f&&(r+=` as ${f}`),o.replaceWithText(ie(r));return}let i=o.getNamedImports();if(i.length){let f=r;i.forEach(h=>{let p=h.getName(),g=h.getAliasNode()?.getText(),m=`${f}.${p}`;for(let u of [SyntaxKind.JsxOpeningElement,SyntaxKind.JsxClosingElement,SyntaxKind.JsxSelfClosingElement])t.getDescendantsOfKind(u).forEach(c=>{let n=c.getTagNameNode().getText();A(n,p,g)&&c.getTagNameNode().replaceWithText(m);});t.getDescendantsOfKind(SyntaxKind.TypeQuery).forEach(u=>{u.getChildren().forEach(c=>{let n=c.getText();A(n,p,g)&&c.replaceWithText(m);});}),t.getDescendantsOfKind(SyntaxKind.ExpressionStatement).forEach(u=>{u.getChildrenOfKind(SyntaxKind.BinaryExpression).forEach(n=>{n.getRight().getChildren().forEach(j=>{let I=j.getText();A(I,p,g)&&j.replaceWithText(m);});});}),t.getDescendantsOfKind(SyntaxKind.VariableDeclaration).forEach(u=>{let c=u.getInitializer();c&&c.getChildren().forEach(n=>{let y=n.getText();A(y,p,g)&&n.replaceWithText(m);});});}),o.replaceWithText(ie(f));}}),{source:t.getFullText(),packages:e}}var de=new Command().name("radix-ui-import").action(()=>{intro("find .tsx files...");let t=ye.sync("**/*.tsx",{ignore:["**/node_modules/**"],dot:false}),e=new Project,o="";t.forEach(a=>{let r=e.addSourceFileAtPathIfExists(b.join(process.cwd(),a));if(r)try{let{packages:s}=ce(r);o+=s.join(" "),r.save();}catch(s){log.error(`failed to transform ${a} ${s}`);}}),o.length?`copy this to delete and install new package
|
|
5
|
+
<your package manager's delete command> ${o}
|
|
6
|
+
<your package manager's install command> ${ee.bgGreen("radix-ui")}`.split(`
|
|
7
|
+
`).forEach(log.step):outro("no transform occured");});var me={version:"1.4.0"};async function We(){new Command().name("design-system").version(me.version).addCommand(ne).addCommand(oe).addCommand(de).parse();}We();
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jongh/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"bin": "./dist/index.
|
|
5
|
+
"bin": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"author": "",
|
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
"dist",
|
|
15
15
|
"package.json"
|
|
16
16
|
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18.0.0"
|
|
19
|
+
},
|
|
17
20
|
"dependencies": {
|
|
18
21
|
"@babel/generator": "^7.26.3",
|
|
19
22
|
"@babel/parser": "^7.26.3",
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
"build:cli": "tsup",
|
|
52
55
|
"build:registry": "npx tsx ./src/build-script.ts --all",
|
|
53
56
|
"release": "pnpm publish -no-git-checks",
|
|
54
|
-
"lint": "eslint --max-warnings 0 --fix",
|
|
57
|
+
"lint": "eslint --max-warnings 0 --no-warn-ignored --fix",
|
|
55
58
|
"check-type": "tsc --noEmit",
|
|
56
59
|
"test": "vitest run"
|
|
57
60
|
}
|
package/dist/index.cjs
DELETED
|
@@ -1,697 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict"
|
|
3
|
-
var _e = Object.create
|
|
4
|
-
var H = Object.defineProperty
|
|
5
|
-
var Te = Object.getOwnPropertyDescriptor
|
|
6
|
-
var Fe = Object.getOwnPropertyNames
|
|
7
|
-
var $e = Object.getPrototypeOf,
|
|
8
|
-
Ae = Object.prototype.hasOwnProperty
|
|
9
|
-
var Ne = (t, e, o, n) => {
|
|
10
|
-
if ((e && typeof e == "object") || typeof e == "function")
|
|
11
|
-
for (let r of Fe(e))
|
|
12
|
-
!Ae.call(t, r) &&
|
|
13
|
-
r !== o &&
|
|
14
|
-
H(t, r, {
|
|
15
|
-
get: () => e[r],
|
|
16
|
-
enumerable: !(n = Te(e, r)) || n.enumerable,
|
|
17
|
-
})
|
|
18
|
-
return t
|
|
19
|
-
}
|
|
20
|
-
var h = (t, e, o) => (
|
|
21
|
-
(o = t != null ? _e($e(t)) : {}),
|
|
22
|
-
Ne(
|
|
23
|
-
e || !t || !t.__esModule
|
|
24
|
-
? H(o, "default", { value: t, enumerable: !0 })
|
|
25
|
-
: o,
|
|
26
|
-
t,
|
|
27
|
-
)
|
|
28
|
-
)
|
|
29
|
-
var ke = require("commander")
|
|
30
|
-
var w = require("@clack/prompts"),
|
|
31
|
-
K = h(require("chalk"), 1),
|
|
32
|
-
ce = require("commander"),
|
|
33
|
-
W = require("execa"),
|
|
34
|
-
T = h(require("fs-extra"), 1),
|
|
35
|
-
pe = require("package-manager-detector"),
|
|
36
|
-
S = h(require("path"), 1),
|
|
37
|
-
k = require("zod")
|
|
38
|
-
var Y = (t) => {
|
|
39
|
-
let e = {}
|
|
40
|
-
for (let o of t) e[o] = o
|
|
41
|
-
return e
|
|
42
|
-
},
|
|
43
|
-
L = Y(["config_not_found", "resolve_path_fail", "failed_to_fetch"]),
|
|
44
|
-
Ve = Y([
|
|
45
|
-
"components.json",
|
|
46
|
-
"tsconfig.json",
|
|
47
|
-
"panda.config.*",
|
|
48
|
-
"package.json",
|
|
49
|
-
]),
|
|
50
|
-
v = class extends Error {
|
|
51
|
-
issue
|
|
52
|
-
constructor(e) {
|
|
53
|
-
super(), (this.name = "NewError"), (this.issue = e)
|
|
54
|
-
}
|
|
55
|
-
get format() {
|
|
56
|
-
return (
|
|
57
|
-
this.issue.code +
|
|
58
|
-
`
|
|
59
|
-
` +
|
|
60
|
-
this.issue.message?.join(`
|
|
61
|
-
`)
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
g = (t) => {
|
|
66
|
-
let e
|
|
67
|
-
switch (t.code) {
|
|
68
|
-
case L.config_not_found:
|
|
69
|
-
e = `error occured while config ${t.configFile}`
|
|
70
|
-
break
|
|
71
|
-
case L.resolve_path_fail:
|
|
72
|
-
e = `failed to resolve your path, current ${t.cwd}`
|
|
73
|
-
break
|
|
74
|
-
case L.failed_to_fetch:
|
|
75
|
-
e = `failed to fetch ${t.target} [${t.statusCode}]`
|
|
76
|
-
break
|
|
77
|
-
default:
|
|
78
|
-
e = "error occured"
|
|
79
|
-
}
|
|
80
|
-
return new v({ ...t, message: [...(t.message || ""), e] })
|
|
81
|
-
}
|
|
82
|
-
var q = h(require("fast-glob"), 1),
|
|
83
|
-
B = h(require("fs-extra"), 1),
|
|
84
|
-
J = h(require("path"), 1),
|
|
85
|
-
U = require("tsconfig-paths")
|
|
86
|
-
var p = require("zod"),
|
|
87
|
-
b = {
|
|
88
|
-
fileName: "components.json",
|
|
89
|
-
schema: p.z
|
|
90
|
-
.object({
|
|
91
|
-
utils: p.z.string(),
|
|
92
|
-
components: p.z.string(),
|
|
93
|
-
hooks: p.z.string(),
|
|
94
|
-
styledsystem: p.z.string(),
|
|
95
|
-
})
|
|
96
|
-
.strict(),
|
|
97
|
-
},
|
|
98
|
-
Oe = ["ui", "hooks", "utils"],
|
|
99
|
-
De = p.z.object({
|
|
100
|
-
name: p.z.string(),
|
|
101
|
-
content: p.z.string(),
|
|
102
|
-
type: p.z.enum(Oe),
|
|
103
|
-
}),
|
|
104
|
-
Q = p.z.object({
|
|
105
|
-
name: p.z.string(),
|
|
106
|
-
dependencies: p.z.array(p.z.string()).optional(),
|
|
107
|
-
files: p.z.array(De).optional(),
|
|
108
|
-
}),
|
|
109
|
-
Z = p.z.object({
|
|
110
|
-
name: p.z.string(),
|
|
111
|
-
dependencies: p.z.array(p.z.string()).optional(),
|
|
112
|
-
file: p.z.string(),
|
|
113
|
-
})
|
|
114
|
-
function X(t) {
|
|
115
|
-
try {
|
|
116
|
-
return B.default.readJsonSync(J.default.resolve(t, b.fileName))
|
|
117
|
-
} catch (e) {
|
|
118
|
-
return g({
|
|
119
|
-
code: "config_not_found",
|
|
120
|
-
configFile: b.fileName,
|
|
121
|
-
message: [e instanceof Error ? e.message : ""],
|
|
122
|
-
})
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
async function ee(t) {
|
|
126
|
-
let e = (0, U.loadConfig)(t)
|
|
127
|
-
if (e.resultType === "failed")
|
|
128
|
-
throw g({
|
|
129
|
-
code: "config_not_found",
|
|
130
|
-
configFile: "tsconfig.json",
|
|
131
|
-
message: ["cannot found tsconfig.json"],
|
|
132
|
-
})
|
|
133
|
-
return e
|
|
134
|
-
}
|
|
135
|
-
async function te(t) {
|
|
136
|
-
return await B.default.pathExists(J.default.join(t, "components.json"))
|
|
137
|
-
}
|
|
138
|
-
function oe(t, e) {
|
|
139
|
-
let o = (0, U.loadConfig)(t)
|
|
140
|
-
if (o?.resultType === "failed" || !Object.entries(o?.paths).length)
|
|
141
|
-
return { baseAlias: null, styledSystemAlias: null }
|
|
142
|
-
let n = null,
|
|
143
|
-
r = null
|
|
144
|
-
for (let [s, i] of Object.entries(o.paths))
|
|
145
|
-
i[0].includes(e) && (r = s.replace(/\/\*$/, "")),
|
|
146
|
-
(i.includes("./*") || i.includes("./src/*") || i.includes("./app/*")) &&
|
|
147
|
-
(n = s.replace(/\/\*$/, ""))
|
|
148
|
-
return (
|
|
149
|
-
n || (n = Object.keys(o?.paths)?.[0].replace(/\/\*$/, "") ?? null),
|
|
150
|
-
r || (r = "."),
|
|
151
|
-
{ baseAlias: n, styledSystemAlias: r }
|
|
152
|
-
)
|
|
153
|
-
}
|
|
154
|
-
async function A(t) {
|
|
155
|
-
try {
|
|
156
|
-
let e = await q.default.glob(["panda.config.*"], { cwd: t, deep: 3 })
|
|
157
|
-
if (!e.length)
|
|
158
|
-
throw g({
|
|
159
|
-
code: "config_not_found",
|
|
160
|
-
configFile: "panda.config.*",
|
|
161
|
-
message: ["failed to find panda.config file"],
|
|
162
|
-
})
|
|
163
|
-
return e[0]
|
|
164
|
-
} catch (e) {
|
|
165
|
-
throw g({
|
|
166
|
-
code: "config_not_found",
|
|
167
|
-
configFile: "panda.config.*",
|
|
168
|
-
message: [
|
|
169
|
-
e instanceof Error
|
|
170
|
-
? e.message
|
|
171
|
-
: "unknown error occured finding panda.config",
|
|
172
|
-
],
|
|
173
|
-
})
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
async function N(t) {
|
|
177
|
-
let e = t.match(/outdir:\s*["']([^"']+)["']/),
|
|
178
|
-
o = t.match(/importMap:\s*({[^}]+}|["'][^"']+["'])/),
|
|
179
|
-
n = e ? e[1] : null,
|
|
180
|
-
r = null
|
|
181
|
-
if (o) {
|
|
182
|
-
let s = o[1]
|
|
183
|
-
if (s.startsWith("{")) {
|
|
184
|
-
let i = s.match(/css:\s*["']([^"']+)["']/)
|
|
185
|
-
r = i ? i[1].replace(/\/css$/, "") : null
|
|
186
|
-
} else r = s.replace(/["']/g, "")
|
|
187
|
-
}
|
|
188
|
-
return { outdir: n, importMap: r }
|
|
189
|
-
}
|
|
190
|
-
var re = require("tsconfig-paths")
|
|
191
|
-
async function O(t, e) {
|
|
192
|
-
let o = (0, re.createMatchPath)(e.absoluteBaseUrl, e.paths)(
|
|
193
|
-
t,
|
|
194
|
-
void 0,
|
|
195
|
-
() => !0,
|
|
196
|
-
)
|
|
197
|
-
if (!o)
|
|
198
|
-
throw g({
|
|
199
|
-
code: "resolve_path_fail",
|
|
200
|
-
target: t,
|
|
201
|
-
cwd: process.cwd(),
|
|
202
|
-
message: ["resolve error"],
|
|
203
|
-
})
|
|
204
|
-
return o
|
|
205
|
-
}
|
|
206
|
-
var j = require("ts-morph")
|
|
207
|
-
function se(t, e) {
|
|
208
|
-
let o = t
|
|
209
|
-
return (
|
|
210
|
-
[
|
|
211
|
-
{ from: /@utils\//g, to: `${e.utils}/` },
|
|
212
|
-
{ from: /@hooks\//g, to: `${e.hooks}/` },
|
|
213
|
-
{ from: /@styled-system\//g, to: `${e.styledsystem}/` },
|
|
214
|
-
{ from: /@components\//g, to: `${e.components}/` },
|
|
215
|
-
].forEach(({ from: r, to: s }) => {
|
|
216
|
-
o = o.replace(r, s)
|
|
217
|
-
}),
|
|
218
|
-
o
|
|
219
|
-
)
|
|
220
|
-
}
|
|
221
|
-
function ne(t, e, o) {
|
|
222
|
-
let r = new j.Project().addSourceFileAtPath(t),
|
|
223
|
-
s = r.getFirstDescendant(
|
|
224
|
-
(d) =>
|
|
225
|
-
j.Node.isCallExpression(d) &&
|
|
226
|
-
d.getExpression().getText() === "definePreset",
|
|
227
|
-
)
|
|
228
|
-
if (!s) return
|
|
229
|
-
let i = s?.getFirstDescendant(
|
|
230
|
-
(d) => j.Node.isPropertyAssignment(d) && d.getName() === "recipes",
|
|
231
|
-
)
|
|
232
|
-
if (!i) return
|
|
233
|
-
let l = i.getFirstDescendantByKind(j.SyntaxKind.ObjectLiteralExpression)
|
|
234
|
-
if (!l) return
|
|
235
|
-
r.getImportDeclarations().some((d) => {
|
|
236
|
-
let f = d.getModuleSpecifierValue(),
|
|
237
|
-
m = d.getNamedImports()
|
|
238
|
-
return f === o && m.some((u) => u.getName() === `${e}Recipe`)
|
|
239
|
-
}) ||
|
|
240
|
-
(r.addImportDeclaration({
|
|
241
|
-
moduleSpecifier: o,
|
|
242
|
-
namedImports: [{ name: `${e}Recipe` }],
|
|
243
|
-
}),
|
|
244
|
-
l.addPropertyAssignment({ name: e, initializer: `${e}Recipe` })),
|
|
245
|
-
r.saveSync()
|
|
246
|
-
}
|
|
247
|
-
var ae = require("package-manager-detector")
|
|
248
|
-
async function ie(t) {
|
|
249
|
-
let e = await (0, ae.detect)({ cwd: t })
|
|
250
|
-
if (!e) throw new Error("package manager not found")
|
|
251
|
-
return e.name === "pnpm"
|
|
252
|
-
? "pnpm exec"
|
|
253
|
-
: e.name === "bun"
|
|
254
|
-
? "bunx"
|
|
255
|
-
: e.name === "yarn"
|
|
256
|
-
? "yarn dlx"
|
|
257
|
-
: "npx"
|
|
258
|
-
}
|
|
259
|
-
var Me = k.z.object({
|
|
260
|
-
components: k.z.array(k.z.string()).optional(),
|
|
261
|
-
cwd: k.z.string(),
|
|
262
|
-
}),
|
|
263
|
-
ze = "https://whdgur.shop",
|
|
264
|
-
de = new ce.Command()
|
|
265
|
-
.name("add")
|
|
266
|
-
.argument("[components...]")
|
|
267
|
-
.option(
|
|
268
|
-
"-c, --cwd <cwd>",
|
|
269
|
-
"current working directory, default to process.cwd()",
|
|
270
|
-
process.cwd(),
|
|
271
|
-
)
|
|
272
|
-
.action(async (t, e) => {
|
|
273
|
-
let o = K.default.bold.red,
|
|
274
|
-
n = K.default.bold.blue
|
|
275
|
-
try {
|
|
276
|
-
let r = Me.parse({ components: t, ...e })
|
|
277
|
-
;(0, w.intro)(n("install components..."))
|
|
278
|
-
let s = b.schema.parse(X(r.cwd)),
|
|
279
|
-
i = await ee(r.cwd),
|
|
280
|
-
l = await A(r.cwd),
|
|
281
|
-
y = await T.default.readFile(S.default.resolve(r.cwd, l), "utf-8"),
|
|
282
|
-
{ outdir: d } = await N(y),
|
|
283
|
-
f = b.schema.parse({
|
|
284
|
-
utils: await O(s.utils, i),
|
|
285
|
-
components: await O(s.components, i),
|
|
286
|
-
hooks: await O(s.hooks, i),
|
|
287
|
-
styledsystem: S.default.join(r.cwd, d || "styled-system"),
|
|
288
|
-
}),
|
|
289
|
-
m = r.components?.map((c) => c.toLowerCase())
|
|
290
|
-
if (!m?.length) return
|
|
291
|
-
;(
|
|
292
|
-
await Promise.allSettled(
|
|
293
|
-
m?.map(async (c) => {
|
|
294
|
-
try {
|
|
295
|
-
let a = await fetch(`${ze}/${c}.json`)
|
|
296
|
-
if (!a.ok)
|
|
297
|
-
throw new Error("fetch error", {
|
|
298
|
-
cause: {
|
|
299
|
-
code: "failed_to_fetch",
|
|
300
|
-
target: c,
|
|
301
|
-
statusCode: a.status,
|
|
302
|
-
message: [a.statusText],
|
|
303
|
-
},
|
|
304
|
-
})
|
|
305
|
-
return await a.json()
|
|
306
|
-
} catch (a) {
|
|
307
|
-
if (a instanceof TypeError)
|
|
308
|
-
throw g({
|
|
309
|
-
code: "failed_to_fetch",
|
|
310
|
-
target: c,
|
|
311
|
-
statusCode: null,
|
|
312
|
-
message: [
|
|
313
|
-
o(a.message),
|
|
314
|
-
o(
|
|
315
|
-
a.cause
|
|
316
|
-
? JSON.stringify(a.cause)
|
|
317
|
-
: "cause by typeError",
|
|
318
|
-
),
|
|
319
|
-
],
|
|
320
|
-
})
|
|
321
|
-
if (a instanceof Error) throw g(a.cause)
|
|
322
|
-
}
|
|
323
|
-
}),
|
|
324
|
-
)
|
|
325
|
-
).forEach(async (c, a) => {
|
|
326
|
-
if (c.status === "rejected") {
|
|
327
|
-
c.reason instanceof v && console.log(o(c.reason.format))
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
try {
|
|
331
|
-
let x = Q.parse(c.value),
|
|
332
|
-
_ = S.default.join(f.components, m[a])
|
|
333
|
-
if (
|
|
334
|
-
T.default.pathExistsSync(_) &&
|
|
335
|
-
!(await (0, w.confirm)({
|
|
336
|
-
message: `Component ${m[a]} already exists. Do you want to overwrite it?`,
|
|
337
|
-
}))
|
|
338
|
-
)
|
|
339
|
-
return
|
|
340
|
-
x.files?.forEach((C) => {
|
|
341
|
-
let G = se(C.content, s)
|
|
342
|
-
C.name === "recipe.ts" &&
|
|
343
|
-
ne(
|
|
344
|
-
S.default.join(r.cwd, "preset.ts"),
|
|
345
|
-
`${m[a]}`,
|
|
346
|
-
S.default.join(s.components, `${m[a]}`, "recipe"),
|
|
347
|
-
),
|
|
348
|
-
C.type === "ui"
|
|
349
|
-
? T.default.outputFileSync(S.default.join(_, C.name), G)
|
|
350
|
-
: T.default.outputFileSync(
|
|
351
|
-
S.default.join(f[C.type], C.name),
|
|
352
|
-
G,
|
|
353
|
-
"utf-8",
|
|
354
|
-
)
|
|
355
|
-
})
|
|
356
|
-
let F = await (0, pe.detect)({ cwd: r.cwd }),
|
|
357
|
-
$ = F ? F.name : ""
|
|
358
|
-
$ ||
|
|
359
|
-
($ = await (0, w.select)({
|
|
360
|
-
message: "cannot find package manager, select",
|
|
361
|
-
options: [
|
|
362
|
-
{ value: "npm", label: "npm" },
|
|
363
|
-
{ value: "pnpm", label: "pnpm" },
|
|
364
|
-
{ value: "yarn", label: "yarn" },
|
|
365
|
-
],
|
|
366
|
-
})),
|
|
367
|
-
x.dependencies?.length &&
|
|
368
|
-
(await (0, W.execa)($, [
|
|
369
|
-
$ === "npm" ? "install" : "add",
|
|
370
|
-
...x.dependencies,
|
|
371
|
-
]))
|
|
372
|
-
let Ie = await ie(r.cwd),
|
|
373
|
-
[ve, ...Pe] = Ie.split(" ")
|
|
374
|
-
;(0, W.execa)(ve, [...Pe, "panda", "codegen"]),
|
|
375
|
-
(0, w.outro)(n(`${m[a]} completed successfully`))
|
|
376
|
-
} catch (x) {
|
|
377
|
-
console.log(x)
|
|
378
|
-
}
|
|
379
|
-
})
|
|
380
|
-
} catch (r) {
|
|
381
|
-
console.log(r),
|
|
382
|
-
r instanceof k.ZodError && o(r.message),
|
|
383
|
-
r instanceof v && o(r.format),
|
|
384
|
-
r instanceof Error && o(r.message),
|
|
385
|
-
(0, w.outro)(n("error occured")),
|
|
386
|
-
process.exit(1)
|
|
387
|
-
}
|
|
388
|
-
})
|
|
389
|
-
var M = require("@clack/prompts"),
|
|
390
|
-
le = require("commander"),
|
|
391
|
-
D = h(require("fs-extra"), 1),
|
|
392
|
-
P = h(require("path"), 1),
|
|
393
|
-
fe = require("pkg-dir"),
|
|
394
|
-
z = require("ts-morph"),
|
|
395
|
-
V = require("zod")
|
|
396
|
-
var Re = "https://whdgur.shop"
|
|
397
|
-
async function me() {
|
|
398
|
-
let t = await fetch(`${Re}/preset.json`)
|
|
399
|
-
if (!t.ok)
|
|
400
|
-
throw g({
|
|
401
|
-
code: "failed_to_fetch",
|
|
402
|
-
target: "preset.json",
|
|
403
|
-
statusCode: t.status,
|
|
404
|
-
})
|
|
405
|
-
let e = await t.json()
|
|
406
|
-
return Z.parse(e)
|
|
407
|
-
}
|
|
408
|
-
var Le = V.z.object({ cwd: V.z.string() }),
|
|
409
|
-
ge = new le.Command()
|
|
410
|
-
.name("init")
|
|
411
|
-
.description("Initialize the project")
|
|
412
|
-
.option(
|
|
413
|
-
"-c, --cwd <cwd>",
|
|
414
|
-
"current working directory, default to process.cwd()",
|
|
415
|
-
process.cwd(),
|
|
416
|
-
)
|
|
417
|
-
.action(async (t) => {
|
|
418
|
-
let e = (0, M.spinner)()
|
|
419
|
-
e.start("Initializing")
|
|
420
|
-
try {
|
|
421
|
-
let o = Le.parse({ cwd: P.default.resolve(t.cwd) })
|
|
422
|
-
await Be(o), e.stop("Initialized")
|
|
423
|
-
} catch (o) {
|
|
424
|
-
o instanceof Error && console.error(o.message),
|
|
425
|
-
e.stop("Failed to initialize"),
|
|
426
|
-
process.exit(0)
|
|
427
|
-
}
|
|
428
|
-
})
|
|
429
|
-
async function Be(t) {
|
|
430
|
-
let e = t.cwd || (await (0, fe.packageDirectory)())
|
|
431
|
-
if (!e) throw new Error("Failed to find package root")
|
|
432
|
-
;(await te(e)) &&
|
|
433
|
-
((await (0, M.confirm)({
|
|
434
|
-
message: "you already initialize,are you want to overwrite it?",
|
|
435
|
-
})) ||
|
|
436
|
-
process.exit(1))
|
|
437
|
-
let n = await A(e),
|
|
438
|
-
r = await D.default.readFile(P.default.join(e, n), "utf-8"),
|
|
439
|
-
s = "styled-system",
|
|
440
|
-
{ outdir: i, importMap: l } = await N(r)
|
|
441
|
-
i && (s = i)
|
|
442
|
-
let { baseAlias: y, styledSystemAlias: d } = oe(e, s)
|
|
443
|
-
if (!y || !d) throw new Error("Failed to find tsconfig alias")
|
|
444
|
-
l ? (s = l) : (s = d)
|
|
445
|
-
let f = {
|
|
446
|
-
utils: `${y}/utils`,
|
|
447
|
-
components: `${y}/components`,
|
|
448
|
-
hooks: `${y}/hooks`,
|
|
449
|
-
styledsystem: s,
|
|
450
|
-
}
|
|
451
|
-
b.schema.parse(f)
|
|
452
|
-
let m = await me()
|
|
453
|
-
return (
|
|
454
|
-
D.default.writeFile(P.default.join(e, m.name), JSON.parse(m.file)),
|
|
455
|
-
Je(P.default.resolve(e, n)),
|
|
456
|
-
await D.default.writeFile(
|
|
457
|
-
P.default.resolve(e, "components.json"),
|
|
458
|
-
JSON.stringify(f),
|
|
459
|
-
"utf-8",
|
|
460
|
-
),
|
|
461
|
-
f
|
|
462
|
-
)
|
|
463
|
-
}
|
|
464
|
-
function Je(t) {
|
|
465
|
-
let o = new z.Project().addSourceFileAtPath(t),
|
|
466
|
-
n = [
|
|
467
|
-
{
|
|
468
|
-
namedImports: [{ name: "preset" }],
|
|
469
|
-
moduleSpecifier: "panda-animation",
|
|
470
|
-
},
|
|
471
|
-
{
|
|
472
|
-
namedImports: [{ name: "defaultPreset" }],
|
|
473
|
-
moduleSpecifier: "./preset",
|
|
474
|
-
},
|
|
475
|
-
]
|
|
476
|
-
o.addImportDeclarations(n)
|
|
477
|
-
let s = o
|
|
478
|
-
.getFirstDescendantByKind(z.SyntaxKind.CallExpression)
|
|
479
|
-
?.getArguments()[0]
|
|
480
|
-
s
|
|
481
|
-
? (s.getProperty("presets") ||
|
|
482
|
-
s.addPropertyAssignment({
|
|
483
|
-
name: "presets",
|
|
484
|
-
initializer: '[preset(), "@pandacss/preset-panda", defaultPreset"]',
|
|
485
|
-
}),
|
|
486
|
-
o.saveSync())
|
|
487
|
-
: console.warn(
|
|
488
|
-
"Could not modify panda.config.ts. add presets : [preset(), @pandacss/preset-panda, defaultPreset] in your panda.config",
|
|
489
|
-
)
|
|
490
|
-
}
|
|
491
|
-
var I = require("@clack/prompts"),
|
|
492
|
-
xe = h(require("chalk"), 1),
|
|
493
|
-
we = require("commander"),
|
|
494
|
-
Ce = h(require("fast-glob"), 1),
|
|
495
|
-
be = h(require("path"), 1),
|
|
496
|
-
Se = require("ts-morph")
|
|
497
|
-
var E = require("ts-morph"),
|
|
498
|
-
ue = {
|
|
499
|
-
"@radix-ui/react-accessible-icon": "AccessibleIcon",
|
|
500
|
-
"@radix-ui/react-accordion": "Accordion",
|
|
501
|
-
"@radix-ui/react-alert-dialog": "AlertDialog",
|
|
502
|
-
"@radix-ui/react-aspect-ratio": "AspectRatio",
|
|
503
|
-
"@radix-ui/react-avatar": "Avatar",
|
|
504
|
-
"@radix-ui/react-checkbox": "Checkbox",
|
|
505
|
-
"@radix-ui/react-collapsible": "Collapsible",
|
|
506
|
-
"@radix-ui/react-context-menu": "ContextMenu",
|
|
507
|
-
"@radix-ui/react-dialog": "Dialog",
|
|
508
|
-
"@radix-ui/react-direction": "Direction",
|
|
509
|
-
"@radix-ui/react-dropdown-menu": "DropdownMenu",
|
|
510
|
-
"@radix-ui/react-form": "Form",
|
|
511
|
-
"@radix-ui/react-hover-card": "HoverCard",
|
|
512
|
-
"@radix-ui/react-label": "Label",
|
|
513
|
-
"@radix-ui/react-menubar": "Menubar",
|
|
514
|
-
"@radix-ui/react-navigation-menu": "NavigationMenu",
|
|
515
|
-
"@radix-ui/react-popover": "Popover",
|
|
516
|
-
"@radix-ui/react-portal": "Portal",
|
|
517
|
-
"@radix-ui/react-progress": "Progress",
|
|
518
|
-
"@radix-ui/react-radio-group": "RadioGroup",
|
|
519
|
-
"@radix-ui/react-scroll-area": "ScrollArea",
|
|
520
|
-
"@radix-ui/react-select": "Select",
|
|
521
|
-
"@radix-ui/react-separator": "Separator",
|
|
522
|
-
"@radix-ui/react-slider": "Slider",
|
|
523
|
-
"@radix-ui/react-slot": "Slot",
|
|
524
|
-
"@radix-ui/react-switch": "Switch",
|
|
525
|
-
"@radix-ui/react-tabs": "Tabs",
|
|
526
|
-
"@radix-ui/react-toast": "Toast",
|
|
527
|
-
"@radix-ui/react-toggle": "Toggle",
|
|
528
|
-
"@radix-ui/react-toggle-group": "ToggleGroup",
|
|
529
|
-
"@radix-ui/react-toolbar": "Toolbar",
|
|
530
|
-
"@radix-ui/react-tooltip": "Tooltip",
|
|
531
|
-
"@radix-ui/react-visually-hidden": "VisuallyHidden",
|
|
532
|
-
}
|
|
533
|
-
function R(t, e, o) {
|
|
534
|
-
return o ? t === o : t === e
|
|
535
|
-
}
|
|
536
|
-
function he(t) {
|
|
537
|
-
return `import {${t}} from "radix-ui"`
|
|
538
|
-
}
|
|
539
|
-
function ye(t) {
|
|
540
|
-
let e = []
|
|
541
|
-
return (
|
|
542
|
-
t.getImportDeclarations().forEach((o) => {
|
|
543
|
-
let n = o.getModuleSpecifierValue()
|
|
544
|
-
if (!(n in ue)) return
|
|
545
|
-
let r = ue[n]
|
|
546
|
-
e.push(n)
|
|
547
|
-
let s = o.getNamespaceImport()
|
|
548
|
-
if (s) {
|
|
549
|
-
let l = s.getText()
|
|
550
|
-
r !== l && (r += ` as ${l}`), o.replaceWithText(he(r))
|
|
551
|
-
return
|
|
552
|
-
}
|
|
553
|
-
let i = o.getNamedImports()
|
|
554
|
-
if (i.length) {
|
|
555
|
-
let l = r
|
|
556
|
-
i.forEach((y) => {
|
|
557
|
-
let d = y.getName(),
|
|
558
|
-
f = y.getAliasNode()?.getText(),
|
|
559
|
-
m = `${l}.${d}`
|
|
560
|
-
for (let u of [
|
|
561
|
-
E.SyntaxKind.JsxOpeningElement,
|
|
562
|
-
E.SyntaxKind.JsxClosingElement,
|
|
563
|
-
E.SyntaxKind.JsxSelfClosingElement,
|
|
564
|
-
])
|
|
565
|
-
t.getDescendantsOfKind(u).forEach((c) => {
|
|
566
|
-
let a = c.getTagNameNode().getText()
|
|
567
|
-
R(a, d, f) && c.getTagNameNode().replaceWithText(m)
|
|
568
|
-
})
|
|
569
|
-
t.getDescendantsOfKind(E.SyntaxKind.TypeQuery).forEach((u) => {
|
|
570
|
-
u.getChildren().forEach((c) => {
|
|
571
|
-
let a = c.getText()
|
|
572
|
-
R(a, d, f) && c.replaceWithText(m)
|
|
573
|
-
})
|
|
574
|
-
}),
|
|
575
|
-
t
|
|
576
|
-
.getDescendantsOfKind(E.SyntaxKind.ExpressionStatement)
|
|
577
|
-
.forEach((u) => {
|
|
578
|
-
u.getChildrenOfKind(E.SyntaxKind.BinaryExpression).forEach(
|
|
579
|
-
(a) => {
|
|
580
|
-
a.getRight()
|
|
581
|
-
.getChildren()
|
|
582
|
-
.forEach((_) => {
|
|
583
|
-
let F = _.getText()
|
|
584
|
-
R(F, d, f) && _.replaceWithText(m)
|
|
585
|
-
})
|
|
586
|
-
},
|
|
587
|
-
)
|
|
588
|
-
}),
|
|
589
|
-
t
|
|
590
|
-
.getDescendantsOfKind(E.SyntaxKind.VariableDeclaration)
|
|
591
|
-
.forEach((u) => {
|
|
592
|
-
let c = u.getInitializer()
|
|
593
|
-
c &&
|
|
594
|
-
c.getChildren().forEach((a) => {
|
|
595
|
-
let x = a.getText()
|
|
596
|
-
R(x, d, f) && a.replaceWithText(m)
|
|
597
|
-
})
|
|
598
|
-
})
|
|
599
|
-
}),
|
|
600
|
-
o.replaceWithText(he(l))
|
|
601
|
-
}
|
|
602
|
-
}),
|
|
603
|
-
{ source: t.getFullText(), packages: e }
|
|
604
|
-
)
|
|
605
|
-
}
|
|
606
|
-
var Ee = new we.Command().name("radix-ui-import").action(() => {
|
|
607
|
-
;(0, I.intro)("find .tsx files...")
|
|
608
|
-
let t = Ce.default.sync("**/*.tsx", {
|
|
609
|
-
ignore: ["**/node_modules/**"],
|
|
610
|
-
dot: !1,
|
|
611
|
-
}),
|
|
612
|
-
e = new Se.Project(),
|
|
613
|
-
o = ""
|
|
614
|
-
t.forEach((n) => {
|
|
615
|
-
let r = e.addSourceFileAtPathIfExists(be.default.join(process.cwd(), n))
|
|
616
|
-
if (r)
|
|
617
|
-
try {
|
|
618
|
-
let { packages: s } = ye(r)
|
|
619
|
-
;(o += s.join(" ")), r.save()
|
|
620
|
-
} catch (s) {
|
|
621
|
-
I.log.error(`failed to transform ${n} ${s}`)
|
|
622
|
-
}
|
|
623
|
-
}),
|
|
624
|
-
o.length
|
|
625
|
-
? `copy this to delete and install new package
|
|
626
|
-
<your package manager's delete command> ${o}
|
|
627
|
-
<your package manager's install command> ${xe.default.bgGreen("radix-ui")}`
|
|
628
|
-
.split(
|
|
629
|
-
`
|
|
630
|
-
`,
|
|
631
|
-
)
|
|
632
|
-
.forEach(I.log.step)
|
|
633
|
-
: (0, I.outro)("no transform occured")
|
|
634
|
-
})
|
|
635
|
-
var je = {
|
|
636
|
-
name: "@jongh/cli",
|
|
637
|
-
version: "1.2.0",
|
|
638
|
-
description: "",
|
|
639
|
-
bin: "./dist/index.js",
|
|
640
|
-
type: "module",
|
|
641
|
-
scripts: {
|
|
642
|
-
build: "tsup && npx tsx ./src/build-script.ts --all",
|
|
643
|
-
"build:cli": "tsup",
|
|
644
|
-
"build:registry": "npx tsx ./src/build-script.ts --all",
|
|
645
|
-
release: "pnpm publish -no-git-checks",
|
|
646
|
-
lint: "eslint --max-warnings 0 --fix",
|
|
647
|
-
"check-type": "tsc --noEmit",
|
|
648
|
-
test: "vitest run",
|
|
649
|
-
},
|
|
650
|
-
keywords: [],
|
|
651
|
-
author: "",
|
|
652
|
-
license: "ISC",
|
|
653
|
-
publishConfig: { access: "public" },
|
|
654
|
-
files: ["dist", "package.json"],
|
|
655
|
-
dependencies: {
|
|
656
|
-
"@babel/generator": "^7.26.3",
|
|
657
|
-
"@babel/parser": "^7.26.3",
|
|
658
|
-
"@babel/traverse": "^7.26.4",
|
|
659
|
-
"@clack/prompts": "^0.7.0",
|
|
660
|
-
"@effect/platform": "^0.69.13",
|
|
661
|
-
"@effect/schema": "^0.75.5",
|
|
662
|
-
"@types/babel__traverse": "^7.20.6",
|
|
663
|
-
chalk: "^5.4.1",
|
|
664
|
-
commander: "^13.0.0",
|
|
665
|
-
effect: "^3.10.8",
|
|
666
|
-
execa: "^9.5.2",
|
|
667
|
-
"fast-glob": "^3.3.2",
|
|
668
|
-
"fs-extra": "^11.2.0",
|
|
669
|
-
"package-manager-detector": "^0.2.8",
|
|
670
|
-
"pkg-dir": "^8.0.0",
|
|
671
|
-
"ts-morph": "^25.0.0",
|
|
672
|
-
"tsconfig-paths": "^4.2.0",
|
|
673
|
-
yargs: "^17.7.2",
|
|
674
|
-
zod: "^3.24.1",
|
|
675
|
-
},
|
|
676
|
-
devDependencies: {
|
|
677
|
-
"@types/babel__generator": "^7.6.8",
|
|
678
|
-
"@types/fs-extra": "^11.0.4",
|
|
679
|
-
"@types/node": "^22.8.6",
|
|
680
|
-
"@types/yargs": "^17.0.33",
|
|
681
|
-
"ts-node": "^10.9.2",
|
|
682
|
-
tsup: "^8.3.0",
|
|
683
|
-
tsx: "^4.19.2",
|
|
684
|
-
"@jongh/tsconfig": "workspace:*",
|
|
685
|
-
"@jongh/eslint": "workspace:*",
|
|
686
|
-
},
|
|
687
|
-
}
|
|
688
|
-
async function Ke() {
|
|
689
|
-
new ke.Command()
|
|
690
|
-
.name("design-system")
|
|
691
|
-
.version(je.version || "0.0.0")
|
|
692
|
-
.addCommand(ge)
|
|
693
|
-
.addCommand(de)
|
|
694
|
-
.addCommand(Ee)
|
|
695
|
-
.parse()
|
|
696
|
-
}
|
|
697
|
-
Ke()
|