@dinachi/cli 0.3.0 → 0.3.2
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
CHANGED
|
@@ -95,7 +95,7 @@ function getComponentRegistry() {
|
|
|
95
95
|
{ name: "index.ts" }
|
|
96
96
|
],
|
|
97
97
|
dependencies: [
|
|
98
|
-
"@base-ui-components/react
|
|
98
|
+
"@base-ui-components/react",
|
|
99
99
|
"lucide-react"
|
|
100
100
|
],
|
|
101
101
|
utilityDependencies: ["cn"]
|
|
@@ -346,6 +346,24 @@ async function getConfig() {
|
|
|
346
346
|
// src/commands/add.ts
|
|
347
347
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
348
348
|
var __dirname2 = path2.dirname(__filename2);
|
|
349
|
+
function resolveAliasPath(aliasPath, projectRoot) {
|
|
350
|
+
const cleanPath = aliasPath.replace(/^@\//, "");
|
|
351
|
+
const possibleBasePaths = [
|
|
352
|
+
path2.join(projectRoot, "src"),
|
|
353
|
+
// src/ prefix (most common)
|
|
354
|
+
path2.join(projectRoot, "app"),
|
|
355
|
+
// app/ prefix (Next.js app router)
|
|
356
|
+
projectRoot
|
|
357
|
+
// Direct in project root
|
|
358
|
+
];
|
|
359
|
+
for (const basePath of possibleBasePaths) {
|
|
360
|
+
const fullPath = path2.join(basePath, cleanPath);
|
|
361
|
+
if (fs2.existsSync(basePath)) {
|
|
362
|
+
return fullPath;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return path2.join(projectRoot, "src", cleanPath);
|
|
366
|
+
}
|
|
349
367
|
function getComponentDependencies(componentName) {
|
|
350
368
|
const registry = getComponentRegistry();
|
|
351
369
|
const component = registry[componentName];
|
|
@@ -477,7 +495,7 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
477
495
|
if (!options.all) {
|
|
478
496
|
spinner.text = `Installing ${componentsToInstall.join(", ")}...`;
|
|
479
497
|
}
|
|
480
|
-
const componentDir =
|
|
498
|
+
const componentDir = resolveAliasPath(config.aliases.ui, process.cwd());
|
|
481
499
|
await fs2.ensureDir(componentDir);
|
|
482
500
|
let allFilesAdded = [];
|
|
483
501
|
let allDepsInstalled = [];
|
|
@@ -491,7 +509,7 @@ var addCommand = new Command("add").description("Add a component to your project
|
|
|
491
509
|
}
|
|
492
510
|
const utilityRegistry = getUtilityRegistry();
|
|
493
511
|
const uniqueUtilityDeps = [...new Set(allUtilityDeps)];
|
|
494
|
-
const utilsDir =
|
|
512
|
+
const utilsDir = resolveAliasPath(config.aliases.lib, process.cwd());
|
|
495
513
|
if (uniqueUtilityDeps.length > 0) {
|
|
496
514
|
await fs2.ensureDir(utilsDir);
|
|
497
515
|
for (const utilityName of uniqueUtilityDeps) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import * as React from "react"
|
|
3
|
-
import { AlertDialog as BaseAlertDialog } from "@base-ui-components/react
|
|
3
|
+
import { AlertDialog as BaseAlertDialog } from "@base-ui-components/react"
|
|
4
4
|
import { cn } from "@/lib/utils"
|
|
5
5
|
|
|
6
6
|
const AlertDialog = BaseAlertDialog.Root
|