@jongh/cli 5.20260902.1 → 5.20260905.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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +7 -5
package/dist/index.js CHANGED
@@ -5,4 +5,4 @@ import {Command}from'commander';import {intro,confirm,outro,spinner,log}from'@cl
5
5
  ${f}`));}catch(l){l instanceof Error&&console.log(b(l.message));}}}catch(o){outro(b(N("error occured"))),o instanceof z$1.ZodError&&console.log(o.message),o instanceof h&&console.log(b(o.format)),o instanceof Error&&console.log(b(o.message)),process.exit(1);}});var G=z$1.object({cwd:z$1.string().default(()=>process.cwd())});var F=J.bold.red,V=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=G.parse({cwd:S.resolve(t.cwd)});await we(o),e.stop("successfully Initialized!");}catch(o){e.stop(F("error occured")),o instanceof z$1.ZodError&&console.log(o.message),o instanceof h&&console.log(F(o.format)),o instanceof Error&&console.log(F(o.message)),process.exit(1);}});async function we(t){let e=await packageDirectory({cwd:t.cwd});if(!e)throw g({code:"config_not_found",configFile:"package.json",message:[`cannot find package.json in ${e}`]});let o=j(e),r=A(e,o);if(r===null)throw g({code:"resolve_path_fail",target:"tsconfig.json",cwd:e,message:[`cannot find paths alias in your ${S.join(e,"tsconfig.json")}`]});await D(e)&&(await confirm({message:"you already initialize,are you want to overwrite it?"})||process.exit(0));let s={utils:`${r}/utils`,components:`${r}/components`,hooks:`${r}/hooks`};return await T.writeFile(S.resolve(e,"components.json"),JSON.stringify(s),"utf-8"),s}var Y={"@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 I(t,e,o){return o?t===o:t===e}function H(t){return `import {${t}} from "radix-ui"`}function Z(t){let e=[];return t.getImportDeclarations().forEach(o=>{let r=o.getModuleSpecifierValue();if(!(r in Y))return;let n=Y[r];e.push(r);let s=o.getNamespaceImport();if(s){let x=s.getText();n!==x&&(n+=` as ${x}`),o.replaceWithText(H(n));return}let i=o.getNamedImports();if(i.length){let x=n;i.forEach(p=>{let a=p.getName(),l=p.getAliasNode()?.getText(),y=`${x}.${a}`;for(let d of [SyntaxKind.JsxOpeningElement,SyntaxKind.JsxClosingElement,SyntaxKind.JsxSelfClosingElement])t.getDescendantsOfKind(d).forEach(c=>{let f=c.getTagNameNode().getText();I(f,a,l)&&c.getTagNameNode().replaceWithText(y);});t.getDescendantsOfKind(SyntaxKind.TypeQuery).forEach(d=>{d.getChildren().forEach(c=>{let f=c.getText();I(f,a,l)&&c.replaceWithText(y);});}),t.getDescendantsOfKind(SyntaxKind.ExpressionStatement).forEach(d=>{d.getChildrenOfKind(SyntaxKind.BinaryExpression).forEach(f=>{f.getRight().getChildren().forEach(C=>{let ee=C.getText();I(ee,a,l)&&C.replaceWithText(y);});});}),t.getDescendantsOfKind(SyntaxKind.VariableDeclaration).forEach(d=>{let c=d.getInitializer();c&&c.getChildren().forEach(f=>{let u=f.getText();I(u,a,l)&&f.replaceWithText(y);});});}),o.replaceWithText(H(x));}}),{source:t.getFullText(),packages:e}}var Q=new Command().name("radix-ui-import").action(()=>{intro("find .tsx files...");let t=Se.sync("**/*.tsx",{ignore:["**/node_modules/**"],dot:false}),e=new Project,o="";t.forEach(r=>{let n=e.addSourceFileAtPathIfExists(S.join(process.cwd(),r));if(n)try{let{packages:s}=Z(n);o+=s.join(" "),n.save();}catch(s){log.error(`failed to transform ${r} ${s}`);}}),o.length?`copy this to delete and install new package
6
6
  <your package manager's delete command> ${o}
7
7
  <your package manager's install command> ${J.bgGreen("radix-ui")}`.split(`
8
- `).forEach(log.step):outro("no transform occured");});var X={version:"5.20260902.1"};async function Te(){new Command().name("design-system").version(X.version).addCommand(V).addCommand(K).addCommand(Q).parse();}Te();
8
+ `).forEach(log.step):outro("no transform occured");});var X={version:"5.20260905.1"};async function Te(){new Command().name("design-system").version(X.version).addCommand(V).addCommand(K).addCommand(Q).parse();}Te();
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@jongh/cli",
3
- "version": "5.20260902.1",
3
+ "version": "5.20260905.1",
4
4
  "description": "",
5
- "bin": "./dist/index.js",
6
5
  "type": "module",
7
6
  "keywords": [],
8
7
  "author": "",
@@ -45,6 +44,8 @@
45
44
  "zod-to-json-schema": "^3.24.5"
46
45
  },
47
46
  "devDependencies": {
47
+ "@jongh/eslint": "0.0.0",
48
+ "@jongh/tsconfig": "0.0.0",
48
49
  "@types/babel__generator": "^7.6.8",
49
50
  "@types/fs-extra": "^11.0.4",
50
51
  "@types/node": "^22.8.6",
@@ -52,9 +53,7 @@
52
53
  "ts-node": "^10.9.2",
53
54
  "tsup": "^8.3.0",
54
55
  "tsx": "^4.19.2",
55
- "vitest": "4.1.11",
56
- "@jongh/tsconfig": "0.0.0",
57
- "@jongh/eslint": "0.0.0"
56
+ "vitest": "4.1.11"
58
57
  },
59
58
  "scripts": {
60
59
  "build": "tsup",
@@ -64,5 +63,8 @@
64
63
  "lint": "eslint --max-warnings 0 --no-warn-ignored --fix",
65
64
  "check-type": "tsgo --noEmit",
66
65
  "test": "vitest run"
66
+ },
67
+ "bin": {
68
+ "cli": "./dist/index.js"
67
69
  }
68
70
  }