@dropi/ui 0.1.33 → 0.1.35

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 +31 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dropi/ui",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
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,38 @@ 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 npm, Yarn Berry, monorepos)
369
+ let dropiUiRoot;
370
+ try {
371
+ // Intento 1: require.resolve desde projectRoot
372
+ dropiUiRoot = path.dirname(require.resolve('@dropi/ui/package.json', { paths: [projectRoot] }));
373
+ } catch (e1) {
374
+ try {
375
+ // Intento 2: ejecutar node en contexto del proyecto (útil en Yarn Berry PnP)
376
+ const resolved = execSync(
377
+ `node -e "console.log(require.resolve('@dropi/ui/package.json'))"`,
378
+ { cwd: projectRoot, encoding: 'utf8' }
379
+ ).trim();
380
+ dropiUiRoot = path.dirname(resolved);
381
+ } catch (e2) {
382
+ // Intento 3: buscar en árbol de directorios (monorepos con hoisting)
383
+ let dir = projectRoot;
384
+ while (dir !== path.dirname(dir)) {
385
+ const candidate = path.join(dir, 'node_modules', '@dropi', 'ui');
386
+ if (fs.existsSync(path.join(candidate, 'package.json'))) {
387
+ dropiUiRoot = candidate;
388
+ break;
389
+ }
390
+ dir = path.dirname(dir);
391
+ }
392
+ // Fallback convencional
393
+ if (!dropiUiRoot) dropiUiRoot = path.join(projectRoot, 'node_modules', '@dropi', 'ui');
394
+ }
395
+ }
396
+
368
397
  const setupAsset = (srcRelativePath, destRelativePath) => {
369
- const src = path.join(projectRoot, 'node_modules', '@dropi/ui', srcRelativePath);
398
+ const src = path.join(dropiUiRoot, srcRelativePath);
370
399
  const dest = path.join(projectRoot, publicDir, destRelativePath);
371
400
  const destDir = path.dirname(dest);
372
401