@dropi/ui 0.1.35 → 0.1.37
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 +67 -45
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dropi/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
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
|
@@ -74,7 +74,8 @@ async function run() {
|
|
|
74
74
|
const p = path.join(projectRoot, f);
|
|
75
75
|
if (!fs.existsSync(p)) return false;
|
|
76
76
|
const c = fs.readFileSync(p, 'utf8');
|
|
77
|
-
|
|
77
|
+
// Detectar solo output: 'export' o output: "export" (no standalone ni otros)
|
|
78
|
+
return /output\s*:\s*["']export["']/.test(c);
|
|
78
79
|
});
|
|
79
80
|
const hasAppRouter = fs.existsSync(path.join(projectRoot, 'app')) || fs.existsSync(path.join(projectRoot, 'src', 'app'));
|
|
80
81
|
const hasPagesRouter = fs.existsSync(path.join(projectRoot, 'pages')) || fs.existsSync(path.join(projectRoot, 'src', 'pages'));
|
|
@@ -368,60 +369,81 @@ dropi-icon:not(.hydrated) {
|
|
|
368
369
|
// Resolver ruta real de @dropi/ui (compatible con npm, Yarn Berry, monorepos)
|
|
369
370
|
let dropiUiRoot;
|
|
370
371
|
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);
|
|
372
|
+
// Intento 1: resolver desde la exportación principal y subir al root del paquete
|
|
373
|
+
// (evita ERR_PACKAGE_PATH_NOT_EXPORTED que ocurre al resolver './package.json')
|
|
374
|
+
const mainFile = require.resolve('@dropi/ui', { paths: [projectRoot] });
|
|
375
|
+
let dir = path.dirname(mainFile);
|
|
376
|
+
while (dir !== path.dirname(dir)) {
|
|
377
|
+
const pkgPath = path.join(dir, 'package.json');
|
|
378
|
+
if (fs.existsSync(pkgPath)) {
|
|
379
|
+
try {
|
|
380
|
+
if (JSON.parse(fs.readFileSync(pkgPath, 'utf8')).name === '@dropi/ui') {
|
|
381
|
+
dropiUiRoot = dir;
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
} catch (_) {}
|
|
391
385
|
}
|
|
392
|
-
|
|
393
|
-
|
|
386
|
+
dir = path.dirname(dir);
|
|
387
|
+
}
|
|
388
|
+
} catch (e1) {}
|
|
389
|
+
|
|
390
|
+
if (!dropiUiRoot) {
|
|
391
|
+
// Intento 2: buscar en árbol de directorios (monorepos con hoisting)
|
|
392
|
+
let dir = projectRoot;
|
|
393
|
+
while (dir !== path.dirname(dir)) {
|
|
394
|
+
const candidate = path.join(dir, 'node_modules', '@dropi', 'ui');
|
|
395
|
+
if (fs.existsSync(path.join(candidate, 'package.json'))) {
|
|
396
|
+
dropiUiRoot = candidate;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
dir = path.dirname(dir);
|
|
394
400
|
}
|
|
395
401
|
}
|
|
396
402
|
|
|
403
|
+
// Fallback convencional
|
|
404
|
+
if (!dropiUiRoot) dropiUiRoot = path.join(projectRoot, 'node_modules', '@dropi', 'ui');
|
|
405
|
+
|
|
397
406
|
const setupAsset = (srcRelativePath, destRelativePath) => {
|
|
398
407
|
const src = path.join(dropiUiRoot, srcRelativePath);
|
|
399
408
|
const dest = path.join(projectRoot, publicDir, destRelativePath);
|
|
400
409
|
const destDir = path.dirname(dest);
|
|
401
410
|
|
|
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
|
-
}
|
|
411
|
+
if (!fs.existsSync(src)) {
|
|
412
|
+
log(`Assets no encontrados: ${srcRelativePath}. Verifica que @dropi/ui esté instalado.`, 'warn');
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
417
|
+
|
|
418
|
+
// Limpiar dest con lstatSync — detecta symlinks rotos que existsSync ignora
|
|
419
|
+
try {
|
|
420
|
+
const stat = fs.lstatSync(dest);
|
|
421
|
+
if (stat.isDirectory() && !stat.isSymbolicLink()) {
|
|
422
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
423
|
+
} else {
|
|
424
|
+
fs.unlinkSync(dest); // funciona para symlinks, broken symlinks y archivos
|
|
422
425
|
}
|
|
423
|
-
}
|
|
424
|
-
|
|
426
|
+
} catch (_) {
|
|
427
|
+
// dest no existe, todo bien
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Intentar symlink primero
|
|
431
|
+
try {
|
|
432
|
+
fs.symlinkSync(src, dest, fs.lstatSync(src).isDirectory() ? 'dir' : 'file');
|
|
433
|
+
log(`Assets configurados: ${destRelativePath} (Symlink ✅)`, 'ok');
|
|
434
|
+
return;
|
|
435
|
+
} catch (_) {}
|
|
436
|
+
|
|
437
|
+
// Fallback: copia directa
|
|
438
|
+
try {
|
|
439
|
+
if (fs.lstatSync(src).isDirectory()) {
|
|
440
|
+
fs.cpSync ? fs.cpSync(src, dest, { recursive: true }) : execSync(`cp -R "${src}" "${dest}"`);
|
|
441
|
+
} else {
|
|
442
|
+
fs.copyFileSync(src, dest);
|
|
443
|
+
}
|
|
444
|
+
log(`Assets copiados: ${destRelativePath} (Copia ✅)`, 'ok');
|
|
445
|
+
} catch (copyErr) {
|
|
446
|
+
log(`Error al copiar ${destRelativePath}: ${copyErr.message}`, 'warn');
|
|
425
447
|
}
|
|
426
448
|
};
|
|
427
449
|
|