@dinachi/cli 0.1.0 → 0.2.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/README.md CHANGED
@@ -6,16 +6,42 @@ A CLI for adding Dinachi UI components to your project. Just like shadcn/ui, thi
6
6
 
7
7
  ```bash
8
8
  npm install -g @dinachi/cli
9
- # or
9
+ ```
10
+
11
+ **Or use npx without global install:**
12
+
13
+ ```bash
10
14
  npx @dinachi/cli@latest init
11
15
  ```
12
16
 
13
17
  ## Usage
14
18
 
19
+ ### Two ways to use the CLI
20
+
21
+ **Option 1: Install globally (recommended)**
22
+
23
+ ```bash
24
+ npm install -g @dinachi/cli
25
+
26
+ # Then use short commands
27
+ dinachi init
28
+ dinachi add button
29
+ ```
30
+
31
+ **Option 2: Use npx (no global install)**
32
+
33
+ ```bash
34
+ # Always use the full package name
35
+ npx @dinachi/cli init
36
+ npx @dinachi/cli add button
37
+ ```
38
+
15
39
  ### Initialize Dinachi UI in your project
16
40
 
17
41
  ```bash
18
- npx dinachi init
42
+ dinachi init
43
+ # or
44
+ npx @dinachi/cli init
19
45
  ```
20
46
 
21
47
  This will:
@@ -27,7 +53,9 @@ This will:
27
53
  ### Add components
28
54
 
29
55
  ```bash
30
- npx dinachi add button
56
+ dinachi add button
57
+ # or
58
+ npx @dinachi/cli add button
31
59
  ```
32
60
 
33
61
  This will:
package/dist/index.js CHANGED
@@ -431,7 +431,7 @@ var addCommand = new Command("add").description("Add a component to your project
431
431
  }
432
432
  const componentsToInstall = [componentName, ...getComponentDependencies(componentName)];
433
433
  spinner.text = `Installing ${componentsToInstall.join(", ")}...`;
434
- const componentDir = path2.join(process.cwd(), config.aliases.components);
434
+ const componentDir = path2.join(process.cwd(), config.aliases.ui.replace("@/", "src/"));
435
435
  await fs2.ensureDir(componentDir);
436
436
  let allFilesAdded = [];
437
437
  let allDepsInstalled = [];
@@ -445,7 +445,7 @@ var addCommand = new Command("add").description("Add a component to your project
445
445
  }
446
446
  const utilityRegistry = getUtilityRegistry();
447
447
  const uniqueUtilityDeps = [...new Set(allUtilityDeps)];
448
- const utilsDir = path2.join(process.cwd(), config.aliases.utils);
448
+ const utilsDir = path2.join(process.cwd(), config.aliases.lib.replace("@/", "src/"));
449
449
  if (uniqueUtilityDeps.length > 0) {
450
450
  await fs2.ensureDir(utilsDir);
451
451
  for (const utilityName of uniqueUtilityDeps) {
@@ -460,7 +460,7 @@ var addCommand = new Command("add").description("Add a component to your project
460
460
  await fs2.writeFile(targetPath, content);
461
461
  allFilesAdded.push({
462
462
  name: utilityFilename,
463
- path: path2.join(config.aliases.utils, utilityFilename)
463
+ path: path2.join(config.aliases.lib, utilityFilename)
464
464
  });
465
465
  if (utility.dependencies?.length) {
466
466
  allDepsInstalled.push(...utility.dependencies);
@@ -481,7 +481,7 @@ var addCommand = new Command("add").description("Add a component to your project
481
481
  let content = await fs2.readFile(sourcePath, "utf-8");
482
482
  content = content.replace(/^\/\/ @ts-nocheck\s*\n/m, "");
483
483
  await fs2.writeFile(targetPath, content);
484
- allFilesAdded.push({ name: file.name, path: path2.join(config.aliases.components, file.name) });
484
+ allFilesAdded.push({ name: file.name, path: path2.join(config.aliases.ui, file.name) });
485
485
  }
486
486
  if (comp.dependencies?.length) {
487
487
  allDepsInstalled.push(...comp.dependencies);
@@ -567,7 +567,7 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
567
567
  type: "text",
568
568
  name: "utilsPath",
569
569
  message: "Where would you like to install utilities?",
570
- initial: "./src/lib/utils.ts"
570
+ initial: "./src/lib"
571
571
  },
572
572
  {
573
573
  type: "confirm",
@@ -583,7 +583,7 @@ var initCommand = new Command2("init").description("Initialize Dinachi UI in you
583
583
  const spinner = ora2("Setting up Dinachi UI...").start();
584
584
  try {
585
585
  await fs3.ensureDir(path3.dirname(response.componentsPath));
586
- await fs3.ensureDir(path3.dirname(response.utilsPath));
586
+ await fs3.ensureDir(response.utilsPath);
587
587
  const utilsContent = `import { type ClassValue, clsx } from "clsx"
588
588
  import { twMerge } from "tailwind-merge"
589
589
 
@@ -591,7 +591,7 @@ export function cn(...inputs: ClassValue[]) {
591
591
  return twMerge(clsx(inputs))
592
592
  }
593
593
  `;
594
- await fs3.writeFile(response.utilsPath, utilsContent);
594
+ await fs3.writeFile(path3.join(response.utilsPath, "utils.ts"), utilsContent);
595
595
  if (response.installDeps) {
596
596
  spinner.text = "Installing dependencies...";
597
597
  const deps = [
@@ -614,17 +614,25 @@ export function cn(...inputs: ClassValue[]) {
614
614
  "cssVariables": true
615
615
  },
616
616
  "aliases": {
617
- "components": "${response.componentsPath}",
618
- "utils": "${response.utilsPath.replace(".ts", "")}"
619
- }
617
+ "components": "@/components",
618
+ "utils": "@/lib/utils",
619
+ "ui": "@/components/ui",
620
+ "lib": "@/lib",
621
+ "hooks": "@/hooks"
622
+ },
623
+ "iconLibrary": "lucide"
620
624
  }`;
621
625
  await fs3.writeFile("components.json", configContent);
622
626
  spinner.succeed("\u2705 Dinachi UI setup complete!");
623
627
  console.log();
624
628
  console.log("Next steps:");
625
- console.log(` 1. Add a component: ${chalk2.cyan("npx dinachi add button")}`);
626
- console.log(` 2. Components will be installed to: ${chalk2.cyan(response.componentsPath)}`);
627
- console.log(` 3. Utils available at: ${chalk2.cyan(response.utilsPath)}`);
629
+ console.log(` 1. Add a component: ${chalk2.cyan("npx @dinachi/cli add button")}`);
630
+ console.log(` 2. Components will be installed to: ${chalk2.cyan("@/components/ui")}`);
631
+ console.log(` 3. Utils available at: ${chalk2.cyan("@/lib/utils")}`);
632
+ console.log();
633
+ console.log("\u{1F4A1} Tip: Install globally for shorter commands:");
634
+ console.log(` ${chalk2.cyan("npm install -g @dinachi/cli")}`);
635
+ console.log(` Then use: ${chalk2.cyan("dinachi add button")}`);
628
636
  } catch (error) {
629
637
  spinner.fail(`\u274C Setup failed: ${error.message}`);
630
638
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dinachi/cli",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CLI for adding Dinachi UI components to your project",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,8 +1,9 @@
1
+ // @ts-nocheck
1
2
  "use client"
2
3
 
3
4
  import * as React from "react"
4
5
  import { Select as SelectPrimitive } from "@base-ui-components/react/select"
5
- import { cn } from "@dinachi/core"
6
+ import { cn } from "@/lib/utils"
6
7
  import { Check, ChevronDown } from "lucide-react"
7
8
 
8
9