@dropi/ui 0.1.35 → 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 +65 -44
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
|
@@ -368,60 +368,81 @@ dropi-icon:not(.hydrated) {
|
|
|
368
368
|
// Resolver ruta real de @dropi/ui (compatible con npm, Yarn Berry, monorepos)
|
|
369
369
|
let dropiUiRoot;
|
|
370
370
|
try {
|
|
371
|
-
// Intento 1:
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
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);
|
|
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 (_) {}
|
|
391
384
|
}
|
|
392
|
-
|
|
393
|
-
|
|
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);
|
|
394
399
|
}
|
|
395
400
|
}
|
|
396
401
|
|
|
402
|
+
// Fallback convencional
|
|
403
|
+
if (!dropiUiRoot) dropiUiRoot = path.join(projectRoot, 'node_modules', '@dropi', 'ui');
|
|
404
|
+
|
|
397
405
|
const setupAsset = (srcRelativePath, destRelativePath) => {
|
|
398
406
|
const src = path.join(dropiUiRoot, srcRelativePath);
|
|
399
407
|
const dest = path.join(projectRoot, publicDir, destRelativePath);
|
|
400
408
|
const destDir = path.dirname(dest);
|
|
401
409
|
|
|
402
|
-
if (fs.existsSync(src)) {
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
fs.copyFileSync(src, dest);
|
|
417
|
-
}
|
|
418
|
-
log(`Assets copiados: ${destRelativePath} (Copia ✅)`, 'ok');
|
|
419
|
-
} catch (copyErr) {
|
|
420
|
-
log(`Assets no encontrados: ${destRelativePath}. Cópialos manualmente desde node_modules/@dropi/ui/${srcRelativePath}`, 'warn');
|
|
421
|
-
}
|
|
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
|
|
422
424
|
}
|
|
423
|
-
}
|
|
424
|
-
|
|
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');
|
|
425
446
|
}
|
|
426
447
|
};
|
|
427
448
|
|