responsive-system 1.0.1 → 1.0.3
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 +17 -7
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -25,10 +25,18 @@ if (!fs.existsSync(packageJsonPath)) {
|
|
|
25
25
|
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
26
26
|
const deps = { ...packageJson.dependencies, ...packageJson.devDependencies }
|
|
27
27
|
|
|
28
|
-
// Verificar si React está instalado
|
|
29
|
-
const hasReact =
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
// Verificar si React está instalado (solo en proyecto raíz, no en subdirectorios)
|
|
29
|
+
const hasReact = (packageJson.dependencies && packageJson.dependencies.react) ||
|
|
30
|
+
(packageJson.devDependencies && packageJson.devDependencies.react) ||
|
|
31
|
+
fs.existsSync(path.join(projectRoot, 'node_modules', 'react'))
|
|
32
|
+
|
|
33
|
+
const hasTailwind = (packageJson.dependencies && packageJson.dependencies.tailwindcss) ||
|
|
34
|
+
(packageJson.devDependencies && packageJson.devDependencies.tailwindcss) ||
|
|
35
|
+
fs.existsSync(path.join(projectRoot, 'node_modules', 'tailwindcss'))
|
|
36
|
+
|
|
37
|
+
const hasTypeScript = (packageJson.dependencies && packageJson.dependencies.typescript) ||
|
|
38
|
+
(packageJson.devDependencies && packageJson.devDependencies.typescript) ||
|
|
39
|
+
fs.existsSync(path.join(projectRoot, 'node_modules', 'typescript'))
|
|
32
40
|
|
|
33
41
|
let needsInstall = false
|
|
34
42
|
const packagesToInstall = []
|
|
@@ -38,8 +46,9 @@ if (!hasReact) {
|
|
|
38
46
|
needsInstall = true
|
|
39
47
|
}
|
|
40
48
|
|
|
41
|
-
|
|
42
|
-
|
|
49
|
+
// Siempre instalar Tailwind en el proyecto raíz (aunque esté en responsive-system)
|
|
50
|
+
// Esto asegura que npx tailwindcss funcione
|
|
51
|
+
if (!hasTailwind || !fs.existsSync(path.join(projectRoot, 'node_modules', 'tailwindcss'))) {
|
|
43
52
|
packagesToInstall.push('tailwindcss@^4.1.14', 'postcss@^8.5.6', 'autoprefixer@^10.4.21')
|
|
44
53
|
needsInstall = true
|
|
45
54
|
}
|
|
@@ -72,8 +81,9 @@ if (needsInstall && packagesToInstall.length > 0) {
|
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
// Instalar TypeScript y Tailwind como devDependencies (para que npx funcione)
|
|
84
|
+
// Usar --force para asegurar que se instalen en el proyecto raíz
|
|
75
85
|
if (devPackages.length > 0) {
|
|
76
|
-
execSync(`npm install ${devPackages.join(' ')} --save-dev`, {
|
|
86
|
+
execSync(`npm install ${devPackages.join(' ')} --save-dev --force`, {
|
|
77
87
|
stdio: 'inherit',
|
|
78
88
|
cwd: projectRoot
|
|
79
89
|
})
|