responsive-system 1.7.6 → 1.7.7
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 +7 -16
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -21,22 +21,8 @@ const __filename = fileURLToPath(import.meta.url)
|
|
|
21
21
|
const __dirname = path.dirname(__filename)
|
|
22
22
|
|
|
23
23
|
// Obtener el directorio del proyecto consumidor
|
|
24
|
-
// Cuando npm ejecuta postinstall, process.cwd()
|
|
25
|
-
|
|
26
|
-
let projectRoot = process.cwd()
|
|
27
|
-
// Si process.cwd() está en node_modules, subir hasta encontrar el proyecto raíz
|
|
28
|
-
if (projectRoot.includes('node_modules')) {
|
|
29
|
-
// Subir hasta encontrar un directorio que no sea node_modules
|
|
30
|
-
let currentDir = projectRoot
|
|
31
|
-
while (currentDir !== path.dirname(currentDir)) {
|
|
32
|
-
const parentDir = path.dirname(currentDir)
|
|
33
|
-
if (!parentDir.includes('node_modules') || parentDir.endsWith('node_modules')) {
|
|
34
|
-
projectRoot = parentDir
|
|
35
|
-
break
|
|
36
|
-
}
|
|
37
|
-
currentDir = parentDir
|
|
38
|
-
}
|
|
39
|
-
}
|
|
24
|
+
// Cuando npm ejecuta postinstall, process.cwd() ya apunta al proyecto consumidor
|
|
25
|
+
const projectRoot = process.cwd()
|
|
40
26
|
const packageJsonPath = path.join(projectRoot, 'package.json')
|
|
41
27
|
|
|
42
28
|
// Detectar si se ejecuta como postinstall o manualmente
|
|
@@ -60,6 +46,11 @@ if (isCI && isPostinstall) {
|
|
|
60
46
|
process.exit(0)
|
|
61
47
|
}
|
|
62
48
|
|
|
49
|
+
// Si NO es postinstall y NO es manual, no hacer nada (evitar ejecución accidental)
|
|
50
|
+
if (!isPostinstall && !isManual) {
|
|
51
|
+
process.exit(0)
|
|
52
|
+
}
|
|
53
|
+
|
|
63
54
|
console.log('')
|
|
64
55
|
console.log('📦 responsive-system: Iniciando configuración...')
|
|
65
56
|
console.log(` Directorio: ${projectRoot}`)
|