responsive-system 1.0.0 → 1.0.2

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.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Sistema de layout responsivo con auto-scaling para Tailwind CSS",
5
5
  "type": "module",
6
6
  "main": "./dist/responsive-system.cjs",
@@ -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 = deps.react || fs.existsSync(path.join(projectRoot, 'node_modules', 'react'))
30
- const hasTailwind = deps.tailwindcss || fs.existsSync(path.join(projectRoot, 'node_modules', 'tailwindcss'))
31
- const hasTypeScript = deps.typescript || fs.existsSync(path.join(projectRoot, 'node_modules', 'typescript'))
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 = []
@@ -39,6 +47,7 @@ if (!hasReact) {
39
47
  }
40
48
 
41
49
  if (!hasTailwind) {
50
+ // Instalar como devDependencies para que npx funcione
42
51
  packagesToInstall.push('tailwindcss@^4.1.14', 'postcss@^8.5.6', 'autoprefixer@^10.4.21')
43
52
  needsInstall = true
44
53
  }
@@ -53,10 +62,31 @@ if (needsInstall && packagesToInstall.length > 0) {
53
62
  console.log(` Instalando: ${packagesToInstall.join(', ')}`)
54
63
 
55
64
  try {
56
- execSync(`npm install ${packagesToInstall.join(' ')}`, {
57
- stdio: 'inherit',
58
- cwd: projectRoot
59
- })
65
+ // Separar paquetes: React (dependencies) vs TypeScript/Tailwind (devDependencies)
66
+ const reactPackages = packagesToInstall.filter(pkg => pkg.includes('react'))
67
+ const devPackages = packagesToInstall.filter(pkg =>
68
+ pkg.includes('typescript') ||
69
+ pkg.includes('tailwind') ||
70
+ pkg.includes('postcss') ||
71
+ pkg.includes('autoprefixer')
72
+ )
73
+
74
+ // Instalar React como dependencies (se necesita en runtime)
75
+ if (reactPackages.length > 0) {
76
+ execSync(`npm install ${reactPackages.join(' ')}`, {
77
+ stdio: 'inherit',
78
+ cwd: projectRoot
79
+ })
80
+ }
81
+
82
+ // Instalar TypeScript y Tailwind como devDependencies (para que npx funcione)
83
+ if (devPackages.length > 0) {
84
+ execSync(`npm install ${devPackages.join(' ')} --save-dev`, {
85
+ stdio: 'inherit',
86
+ cwd: projectRoot
87
+ })
88
+ }
89
+
60
90
  console.log('✅ responsive-system: Dependencias instaladas correctamente')
61
91
  } catch (error) {
62
92
  console.warn('⚠️ responsive-system: Error al instalar dependencias automáticamente')