# 🚀 Proceso: Committear Cambios y Actualizar Proyectos

## 📋 Resumen

Este documento explica el proceso completo para:
1. ✅ Committear cambios del demo en cd-system
2. ✅ Actualizar proyectos que usan ese demo
3. ✅ Validar que las protecciones funcionan correctamente

---

## Paso 1: Committear Cambios en cd-system

### 1.1 Verificar Cambios

```bash
cd /Applications/XAMPP/xamppfiles/htdocs/cd-system

# Ver estado
git status

# Ver cambios
git diff
```

### 1.2 Agregar Archivos del Demo

```bash
# Agregar solo archivos del demo/core (NO config/cd-system.php si tiene datos específicos)
git add resources/views/layout/front/footers/demo-architecture-2.blade.php
git add public/template/css/demos/demo-architecture-2.css
git add resources/views/modules/*/frontend/partials/dynamic-header.blade.php
git add resources/views/modules/cd-base/frontend/demos/demo-architecture-2/*.blade.php
git add resources/views/modules/gallery/frontend/index.blade.php

# Agregar documentación y scripts
git add docs/bewpro/system/ACTUALIZAR-DEMOS-DESDE-CD-SYSTEM.md
git add docs/bewpro/system/VALIDACION-ACTUALIZACION-DEMOS.md
git add docs/bewpro/system/RESUMEN-ACTUALIZACION-DEMOS.md
git add scripts/validate-demo-update.sh
```

### 1.3 Validar Antes de Commitear

```bash
# Ejecutar script de validación
./scripts/validate-demo-update.sh demo-architecture-2

# Ver qué se va a commitear
git status
```

### 1.4 Commitear

```bash
git commit -m "feat(demo-architecture-2): Optimizar footer y estandarizar headers

- Optimizar footer: legibilidad, espaciado y organización de columnas
- Estandarizar color de page-header (#847266) en todos los módulos
- Remover título/descripción en hover de gallery, mantener solo overlay
- Mejorar CSS del demo para mejor presentación
- Agregar documentación para actualización de demos desde cd-system
- Agregar script de validación de actualizaciones"
```

### 1.5 Push (Opcional)

```bash
git push origin cd-system
```

---

## Paso 2: Actualizar Proyectos

### 2.1 En el Proyecto: Verificar Protecciones

```bash
cd /Applications/XAMPP/xamppfiles/htdocs/cokecolombres  # o tu proyecto

# Verificar .gitattributes
cat .gitattributes | grep "merge=ours"

# Debe mostrar:
# config/cd-system.php merge=ours
# config/site.php merge=ours
# public/cd-project/assets/* merge=ours
```

### 2.2 Configurar Upstream (Solo primera vez)

```bash
# Agregar cd-system como upstream
git remote add upstream https://github.com/LACOMPANIADIGITAL/cd-system.git || true

# Verificar
git remote -v
```

### 2.3 Obtener Cambios

```bash
# Obtener cambios desde cd-system
git fetch upstream cd-system

# Ver qué cambios hay
git log HEAD..upstream/cd-system --oneline

# Ver archivos del demo que se actualizarán
git diff HEAD..upstream/cd-system --name-only | grep "demo-architecture-2"
```

### 2.4 Revisar Cambios

```bash
# Ver diferencias en el footer
git diff HEAD..upstream/cd-system resources/views/layout/front/footers/demo-architecture-2.blade.php

# Ver diferencias en CSS
git diff HEAD..upstream/cd-system public/template/css/demos/demo-architecture-2.css

# Verificar que config/cd-system.php NO cambiará (debe estar protegido)
git diff HEAD..upstream/cd-system config/cd-system.php
# Debe mostrar "merge=ours" o no mostrar cambios
```

### 2.5 Aplicar Cambios

```bash
# Hacer merge
git merge upstream/cd-system --no-edit

# Si hay conflictos, resolverlos
# Los archivos protegidos NO deberían tener conflictos
```

### 2.6 Verificar que las Protecciones Funcionaron

```bash
# Verificar config/cd-system.php mantiene configuración del proyecto
git show HEAD:config/cd-system.php | grep "demo"
# Debe mostrar el demo del PROYECTO, NO el de cd-system

# Verificar config/site.php mantiene identidad del proyecto
git show HEAD:config/site.php | grep -A 2 "'name'"
# Debe mostrar el nombre del PROYECTO
```

### 2.7 Limpiar y Probar

```bash
# Limpiar cache
php artisan config:clear
php artisan cache:clear
php artisan view:clear

# Probar
php artisan serve

# Verificar en navegador:
# - Footer optimizado se muestra correctamente
# - Headers tienen color consistente (#847266)
# - Gallery no muestra título/descripción en hover
# - Logo del proyecto se mantiene
```

### 2.8 Commit y Push (Opcional)

```bash
# Si todo está bien
git add -A
git commit -m "chore: Actualizar demo-architecture-2 desde cd-system

- Actualizar footer optimizado
- Estandarizar color de headers (#847266)
- Actualizar gallery sin título/descripción en hover
- Mejoras en CSS del demo"

git push origin cd-system
```

---

## ✅ Checklist Completo

### En cd-system:

- [ ] Cambios del demo commiteados
- [ ] Documentación agregada
- [ ] Script de validación agregado
- [ ] Push realizado (opcional)

### En el proyecto:

- [ ] `.gitattributes` verificado
- [ ] Upstream configurado
- [ ] Cambios revisados con `git diff`
- [ ] Merge realizado
- [ ] Protecciones verificadas
- [ ] Cache limpiado
- [ ] Proyecto probado
- [ ] Commit realizado (si todo está bien)

---

## 🔍 Validación Rápida

### Script de Validación en cd-system:

```bash
cd /Applications/XAMPP/xamppfiles/htdocs/cd-system
./scripts/validate-demo-update.sh demo-architecture-2
```

### Verificar Protecciones en Proyecto:

```bash
cd /Applications/XAMPP/xamppfiles/htdocs/cokecolombres
cat .gitattributes | grep "merge=ours" | wc -l
# Debe mostrar al menos 2 (config files)
```

---

## 📚 Documentación Relacionada

- `ACTUALIZAR-DEMOS-DESDE-CD-SYSTEM.md` - Guía completa paso a paso
- `VALIDACION-ACTUALIZACION-DEMOS.md` - Checklist de validación
- `RESUMEN-ACTUALIZACION-DEMOS.md` - Resumen ejecutivo

---

**Última actualización:** Diciembre 2024

