@dropi/ui 0.1.34 → 0.1.36
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/package.json +3 -2
- package/scripts/setup.js +68 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dropi/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
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",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"import": "./hydrate/index.mjs",
|
|
34
34
|
"require": "./hydrate/index.js",
|
|
35
35
|
"types": "./hydrate/index.d.ts"
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"./package.json": "./package.json"
|
|
37
38
|
},
|
|
38
39
|
"files": [
|
|
39
40
|
"dist/",
|
package/scripts/setup.js
CHANGED
|
@@ -365,42 +365,84 @@ dropi-icon:not(.hydrated) {
|
|
|
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
|
|
368
|
+
// Resolver ruta real de @dropi/ui (compatible con npm, Yarn Berry, monorepos)
|
|
369
369
|
let dropiUiRoot;
|
|
370
370
|
try {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
// Intento 1: resolver desde la exportación principal y subir al root del paquete
|
|
372
|
+
// (evita ERR_PACKAGE_PATH_NOT_EXPORTED que ocurre al resolver './package.json')
|
|
373
|
+
const mainFile = require.resolve('@dropi/ui', { paths: [projectRoot] });
|
|
374
|
+
let dir = path.dirname(mainFile);
|
|
375
|
+
while (dir !== path.dirname(dir)) {
|
|
376
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
377
|
+
if (fs.existsSync(pkgPath)) {
|
|
378
|
+
try {
|
|
379
|
+
if (JSON.parse(fs.readFileSync(pkgPath, 'utf8')).name === '@dropi/ui') {
|
|
380
|
+
dropiUiRoot = dir;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
} catch (_) {}
|
|
384
|
+
}
|
|
385
|
+
dir = path.dirname(dir);
|
|
386
|
+
}
|
|
387
|
+
} catch (e1) {}
|
|
388
|
+
|
|
389
|
+
if (!dropiUiRoot) {
|
|
390
|
+
// Intento 2: buscar en árbol de directorios (monorepos con hoisting)
|
|
391
|
+
let dir = projectRoot;
|
|
392
|
+
while (dir !== path.dirname(dir)) {
|
|
393
|
+
const candidate = path.join(dir, 'node_modules', '@dropi', 'ui');
|
|
394
|
+
if (fs.existsSync(path.join(candidate, 'package.json'))) {
|
|
395
|
+
dropiUiRoot = candidate;
|
|
396
|
+
break;
|
|
397
|
+
}
|
|
398
|
+
dir = path.dirname(dir);
|
|
399
|
+
}
|
|
374
400
|
}
|
|
375
401
|
|
|
402
|
+
// Fallback convencional
|
|
403
|
+
if (!dropiUiRoot) dropiUiRoot = path.join(projectRoot, 'node_modules', '@dropi', 'ui');
|
|
404
|
+
|
|
376
405
|
const setupAsset = (srcRelativePath, destRelativePath) => {
|
|
377
406
|
const src = path.join(dropiUiRoot, srcRelativePath);
|
|
378
407
|
const dest = path.join(projectRoot, publicDir, destRelativePath);
|
|
379
408
|
const destDir = path.dirname(dest);
|
|
380
409
|
|
|
381
|
-
if (fs.existsSync(src)) {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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');
|
|
400
|
-
}
|
|
410
|
+
if (!fs.existsSync(src)) {
|
|
411
|
+
log(`Assets no encontrados: ${srcRelativePath}. Verifica que @dropi/ui esté instalado.`, 'warn');
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
416
|
+
|
|
417
|
+
// Limpiar dest con lstatSync — detecta symlinks rotos que existsSync ignora
|
|
418
|
+
try {
|
|
419
|
+
const stat = fs.lstatSync(dest);
|
|
420
|
+
if (stat.isDirectory() && !stat.isSymbolicLink()) {
|
|
421
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
422
|
+
} else {
|
|
423
|
+
fs.unlinkSync(dest); // funciona para symlinks, broken symlinks y archivos
|
|
401
424
|
}
|
|
402
|
-
}
|
|
403
|
-
|
|
425
|
+
} catch (_) {
|
|
426
|
+
// dest no existe, todo bien
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// Intentar symlink primero
|
|
430
|
+
try {
|
|
431
|
+
fs.symlinkSync(src, dest, fs.lstatSync(src).isDirectory() ? 'dir' : 'file');
|
|
432
|
+
log(`Assets configurados: ${destRelativePath} (Symlink ✅)`, 'ok');
|
|
433
|
+
return;
|
|
434
|
+
} catch (_) {}
|
|
435
|
+
|
|
436
|
+
// Fallback: copia directa
|
|
437
|
+
try {
|
|
438
|
+
if (fs.lstatSync(src).isDirectory()) {
|
|
439
|
+
fs.cpSync ? fs.cpSync(src, dest, { recursive: true }) : execSync(`cp -R "${src}" "${dest}"`);
|
|
440
|
+
} else {
|
|
441
|
+
fs.copyFileSync(src, dest);
|
|
442
|
+
}
|
|
443
|
+
log(`Assets copiados: ${destRelativePath} (Copia ✅)`, 'ok');
|
|
444
|
+
} catch (copyErr) {
|
|
445
|
+
log(`Error al copiar ${destRelativePath}: ${copyErr.message}`, 'warn');
|
|
404
446
|
}
|
|
405
447
|
};
|
|
406
448
|
|