responsive-system 1.7.10 → 1.7.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "responsive-system",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "description": "Sistema de layout responsivo con auto-scaling para Tailwind CSS",
5
5
  "type": "module",
6
6
  "main": "./dist/responsive-system.cjs",
@@ -58,6 +58,7 @@
58
58
  "lint": "eslint .",
59
59
  "preview": "vite preview",
60
60
  "prepublishOnly": "npm run build",
61
+ "install": "node scripts/postinstall.js",
61
62
  "postinstall": "node scripts/postinstall.js",
62
63
  "test:postinstall": "node scripts/test-postinstall.js"
63
64
  },
@@ -25,9 +25,10 @@ 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 o manualmente
29
- const isPostinstall = process.env.npm_lifecycle_event === 'postinstall'
30
- const isManual = process.argv[1].includes('postinstall.js') && !isPostinstall
28
+ // Detectar si se ejecuta desde node_modules (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') && scriptPath.includes('responsive-system')
31
32
 
32
33
  // Detectar CI/CD environments
33
34
  const isCI = !!(
@@ -41,13 +42,13 @@ const isCI = !!(
41
42
  process.env.JENKINS_URL
42
43
  )
43
44
 
44
- // Si está en CI/CD, salir silenciosamente
45
- if (isCI && isPostinstall) {
45
+ // Si está en CI/CD y viene de node_modules, salir silenciosamente
46
+ if (isCI && isFromNodeModules) {
46
47
  process.exit(0)
47
48
  }
48
49
 
49
- // Si NO es postinstall y NO es manual, no hacer nada (evitar ejecución accidental)
50
- if (!isPostinstall && !isManual) {
50
+ // Si NO viene de node_modules, no hacer nada (evitar ejecución accidental desde el paquete fuente)
51
+ if (!isFromNodeModules) {
51
52
  process.exit(0)
52
53
  }
53
54
 
@@ -86,7 +87,8 @@ let needsUpdate = false
86
87
 
87
88
  // Función para preguntar al usuario qué layout quiere
88
89
  async function askLayout() {
89
- if (isPostinstall && !isManual) {
90
+ // Si viene de node_modules (instalación automática), usar layout default
91
+ if (isFromNodeModules) {
90
92
  console.log(' ℹ️ Usando layout "default" por defecto')
91
93
  console.log(' 💡 Ejecuta "npx responsive-system-setup" para cambiar el layout')
92
94
  return 'default'
@@ -514,7 +516,7 @@ if (needsUpdate) {
514
516
  console.log('')
515
517
  console.log('⚠️ El proyecto ya está configurado')
516
518
 
517
- if (isManual) {
519
+ if (!isFromNodeModules) {
518
520
  const rl = readline.createInterface({
519
521
  input: process.stdin,
520
522
  output: process.stdout