fristy/VERSIONING_SETUP.md

243 lines
4.4 KiB
Markdown

# Versionsverwaltung Setup - Quick Start
## 🚀 Schnellstart
### 1. Dependencies installieren
```bash
npm install
```
Dies installiert automatisch alle Versionierungs-Tools:
- husky (Git Hooks)
- commitlint (Commit-Message-Validierung)
- standard-version (Automatisches Versioning)
- lint-staged (Pre-Commit Linting)
### 2. Husky initialisieren
```bash
npm run prepare
```
Dies aktiviert die Git Hooks.
### 3. Git Repository initialisieren (falls noch nicht geschehen)
```bash
git init
git add .
git commit -m "chore: initial project setup"
```
**Wichtig:** Der Commit wird automatisch validiert!
## 📝 Commit-Guidelines
### Commit-Format (wird automatisch geprüft!)
```
type(scope): subject
```
**Erlaubte Types:**
- `feat` - Neues Feature
- `fix` - Bugfix
- `docs` - Dokumentation
- `style` - Formatierung
- `refactor` - Code-Refactoring
- `perf` - Performance
- `test` - Tests
- `chore` - Sonstiges
**Beispiele:**
```bash
git commit -m "feat(auth): add login screen"
git commit -m "fix(contracts): resolve date bug"
git commit -m "docs(readme): update setup guide"
```
### Fehlermeldungen
**Falsch:**
```bash
git commit -m "added login"
# Error: type must be lower-case
```
**Richtig:**
```bash
git commit -m "feat(auth): add login screen"
```
## 🏷️ Version-Management
### Neue Version erstellen
```bash
# Automatisches Versioning basierend auf Commits
npm run release
# Spezifische Version
npm run release:patch # 0.0.1 → 0.0.2
npm run release:minor # 0.0.1 → 0.1.0
npm run release:major # 0.0.1 → 1.0.0
# Pre-Releases
npm run release:alpha # 0.0.1 → 0.0.2-alpha.0
npm run release:beta # 0.0.1 → 0.0.2-beta.0
npm run release:rc # 0.0.1 → 0.0.2-rc.0
```
**Was passiert automatisch:**
1. Version in `package.json` erhöhen
2. `CHANGELOG.md` aktualisieren
3. Git commit erstellen
4. Git tag erstellen
### Nach Release
```bash
git push --follow-tags origin main
```
## 🌿 Branch-Workflow
### Feature entwickeln
```bash
# 1. Branch erstellen
git checkout develop
git checkout -b feature/mein-feature
# 2. Entwickeln & committen
git add .
git commit -m "feat(module): beschreibung"
# 3. Push
git push origin feature/mein-feature
# 4. Pull Request erstellen
```
### Release durchführen
```bash
# 1. Release-Branch
git checkout develop
git checkout -b release/v0.2.0
# 2. Version bumpen
npm run release:minor
# 3. Merge zu main
git checkout main
git merge release/v0.2.0
git push --follow-tags origin main
# 4. Merge zurück zu develop
git checkout develop
git merge release/v0.2.0
git push origin develop
```
## ✅ Pre-Commit Checks
Vor jedem Commit wird automatisch ausgeführt:
1. **ESLint** - Code-Qualität prüfen
2. **Prettier** - Code formatieren
3. **Type-Check** - TypeScript-Fehler finden
Falls Fehler auftreten:
```bash
# Manuell fixen
npm run lint:fix
npm run format
```
## 🎯 Checkliste vor erstem Commit
- [ ] Dependencies installiert (`npm install`)
- [ ] Husky aktiviert (`npm run prepare`)
- [ ] Git initialisiert (`git init`)
- [ ] Remote hinzugefügt (`git remote add origin <url>`)
- [ ] Commit-Format verstanden
- [ ] Branch-Strategie verstanden
## 🔗 Nützliche Befehle
```bash
# Version anzeigen
npm version
# Changelog generieren
npm run release
# Code formatieren
npm run format
# Linting
npm run lint:fix
# Type-Check
npm run type-check
# Alle Checks
npm run lint && npm run type-check && npm test
```
## 📚 Weitere Dokumentation
- **[VERSIONING.md](./VERSIONING.md)** - Ausführliche Versioning-Strategie
- **[GIT_WORKFLOW.md](./GIT_WORKFLOW.md)** - Detaillierter Git-Workflow
- **[CHANGELOG.md](./CHANGELOG.md)** - Versions-Historie
- **[CONTRIBUTING.md](./CONTRIBUTING.md)** - Contribution Guidelines (wird erstellt)
## 🐛 Troubleshooting
### Husky funktioniert nicht
```bash
rm -rf .git/hooks
npm run prepare
```
### Commit wird abgelehnt
```bash
# Commit-Message prüfen
npx commitlint --edit
# Format: type(scope): subject
# Beispiel: feat(auth): add login
```
### Pre-Commit schlägt fehl
```bash
# Dateien manuell fixen
npm run lint:fix
npm run format
# Nochmal committen
git add .
git commit -m "feat(module): beschreibung"
```
## 🎉 Ready to Go!
Dein Projekt ist jetzt mit professioneller Versionsverwaltung ausgestattet:
✅ Automatische Commit-Validierung
✅ Pre-Commit Hooks (Linting, Formatting)
✅ Semantic Versioning
✅ Automatisches Changelog
✅ CI/CD-ready
✅ Git-Flow Workflow
**Nächster Schritt:** Ersten Feature-Branch erstellen!
```bash
git checkout -b feature/auth-screens
```