responsive-system 1.7.9 → 1.7.11
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 +1 -1
- package/scripts/postinstall.js +24 -19
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -25,9 +25,12 @@ const __dirname = path.dirname(__filename)
|
|
|
25
25
|
const projectRoot = process.cwd()
|
|
26
26
|
const packageJsonPath = path.join(projectRoot, 'package.json')
|
|
27
27
|
|
|
28
|
-
// Detectar si se ejecuta como postinstall
|
|
29
|
-
|
|
30
|
-
const
|
|
28
|
+
// Detectar si se ejecuta como postinstall del paquete instalado
|
|
29
|
+
// El script se ejecuta desde node_modules/responsive-system/scripts/postinstall.js
|
|
30
|
+
const scriptPath = fileURLToPath(import.meta.url)
|
|
31
|
+
const isFromNodeModules = scriptPath.includes('node_modules' + path.sep + 'responsive-system')
|
|
32
|
+
const isPostinstall = process.env.npm_lifecycle_event === 'postinstall' || isFromNodeModules
|
|
33
|
+
const isManual = process.argv[1].includes('postinstall.js') && !isFromNodeModules
|
|
31
34
|
|
|
32
35
|
// Detectar CI/CD environments
|
|
33
36
|
const isCI = !!(
|
|
@@ -484,26 +487,28 @@ if (needsUpdate) {
|
|
|
484
487
|
console.log('✅ Todas las dependencias ya están en package.json')
|
|
485
488
|
}
|
|
486
489
|
|
|
487
|
-
//
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
490
|
+
// Función async para manejar la configuración del proyecto
|
|
491
|
+
(async () => {
|
|
492
|
+
// Verificar que fs.existsSync esté disponible
|
|
493
|
+
if (typeof fs.existsSync !== 'function') {
|
|
494
|
+
console.error('❌ Error: fs.existsSync no está disponible')
|
|
495
|
+
process.exit(1)
|
|
496
|
+
}
|
|
491
497
|
|
|
492
|
-
//
|
|
493
|
-
const
|
|
498
|
+
// Verificar si el proyecto ya está configurado
|
|
499
|
+
const mainTsxPath = path.join(projectRoot, 'src', 'main.tsx')
|
|
500
|
+
const layoutsDir = path.join(projectRoot, 'src', 'layouts')
|
|
501
|
+
const viteConfigPath = path.join(projectRoot, 'vite.config.ts')
|
|
502
|
+
|
|
503
|
+
let isAlreadyConfigured = false
|
|
494
504
|
try {
|
|
495
|
-
|
|
505
|
+
isAlreadyConfigured = fs.existsSync(mainTsxPath) &&
|
|
506
|
+
fs.existsSync(layoutsDir) &&
|
|
507
|
+
fs.existsSync(viteConfigPath)
|
|
496
508
|
} catch (e) {
|
|
497
|
-
|
|
509
|
+
console.error('❌ Error al verificar archivos existentes:', e.message)
|
|
510
|
+
isAlreadyConfigured = false
|
|
498
511
|
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
const isAlreadyConfigured = fileExists(mainTsxPath) &&
|
|
502
|
-
fileExists(layoutsDir) &&
|
|
503
|
-
fileExists(viteConfigPath)
|
|
504
|
-
|
|
505
|
-
// Función async para manejar la configuración del proyecto
|
|
506
|
-
(async () => {
|
|
507
512
|
|
|
508
513
|
// Si el proyecto está vacío, crear estructura base
|
|
509
514
|
if (isProjectEmpty) {
|