@dropi/ui 0.1.32 → 0.1.34

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/package.json +1 -1
  2. package/scripts/setup.js +21 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropi/ui",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "Dropi Design System — Web Components for Angular, React and Vue",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
package/scripts/setup.js CHANGED
@@ -364,9 +364,17 @@ dropi-icon:not(.hydrated) {
364
364
 
365
365
  // 5. Iconos y Lottie (Symlink/Copia de assets)
366
366
  const publicDir = isAngular ? 'src/assets' : 'public';
367
-
367
+
368
+ // Resolver ruta real de @dropi/ui (compatible con Yarn Berry/PnP y npm)
369
+ let dropiUiRoot;
370
+ try {
371
+ dropiUiRoot = path.dirname(require.resolve('@dropi/ui/package.json', { paths: [projectRoot] }));
372
+ } catch (e) {
373
+ dropiUiRoot = path.join(projectRoot, 'node_modules', '@dropi/ui');
374
+ }
375
+
368
376
  const setupAsset = (srcRelativePath, destRelativePath) => {
369
- const src = path.join(projectRoot, 'node_modules', '@dropi/ui', srcRelativePath);
377
+ const src = path.join(dropiUiRoot, srcRelativePath);
370
378
  const dest = path.join(projectRoot, publicDir, destRelativePath);
371
379
  const destDir = path.dirname(dest);
372
380
 
@@ -374,20 +382,25 @@ dropi-icon:not(.hydrated) {
374
382
  if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
375
383
  try {
376
384
  if (fs.existsSync(dest)) {
377
- // Si es un directorio y existe, no hacemos symlink directo, pero aquí tratamos archivos o carpetas simples
378
385
  if (fs.lstatSync(dest).isSymbolicLink() || fs.existsSync(dest)) fs.unlinkSync(dest);
379
386
  }
380
387
  fs.symlinkSync(src, dest, fs.lstatSync(src).isDirectory() ? 'dir' : 'file');
381
388
  log(`Assets configurados: ${destRelativePath} (Symlink ✅)`, 'ok');
382
389
  } catch (e) {
383
390
  // Fallback a copia recursiva
384
- if (fs.lstatSync(src).isDirectory()) {
385
- fs.cpSync ? fs.cpSync(src, dest, { recursive: true }) : execSync(`cp -R "${src}" "${dest}"`);
386
- } else {
387
- fs.copyFileSync(src, dest);
391
+ try {
392
+ if (fs.lstatSync(src).isDirectory()) {
393
+ fs.cpSync ? fs.cpSync(src, dest, { recursive: true }) : execSync(`cp -R "${src}" "${dest}"`);
394
+ } else {
395
+ fs.copyFileSync(src, dest);
396
+ }
397
+ log(`Assets copiados: ${destRelativePath} (Copia ✅)`, 'ok');
398
+ } catch (copyErr) {
399
+ log(`Assets no encontrados: ${destRelativePath}. Cópialos manualmente desde node_modules/@dropi/ui/${srcRelativePath}`, 'warn');
388
400
  }
389
- log(`Assets copiados: ${destRelativePath} (Copia ✅)`, 'ok');
390
401
  }
402
+ } else {
403
+ log(`Assets no encontrados en node_modules: ${srcRelativePath}. Verifica que @dropi/ui esté instalado correctamente.`, 'warn');
391
404
  }
392
405
  };
393
406