@dinachi/cli 0.3.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +20 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -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 = path2.join(process.cwd(), config.aliases.ui.replace("@/", "src/"));
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 = path2.join(process.cwd(), config.aliases.lib.replace("@/", "src/"));
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
  {
2
2
  "name": "@dinachi/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "CLI for adding Dinachi UI components to your project",
5
5
  "type": "module",
6
6
  "keywords": [