4.4 KiB
4.4 KiB
Versionsverwaltung Setup - Quick Start
🚀 Schnellstart
1. Dependencies installieren
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
npm run prepare
Dies aktiviert die Git Hooks.
3. Git Repository initialisieren (falls noch nicht geschehen)
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 Featurefix- Bugfixdocs- Dokumentationstyle- Formatierungrefactor- Code-Refactoringperf- Performancetest- Testschore- Sonstiges
Beispiele:
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:
git commit -m "added login"
# Error: type must be lower-case
✅ Richtig:
git commit -m "feat(auth): add login screen"
🏷️ Version-Management
Neue Version erstellen
# 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:
- Version in
package.jsonerhöhen CHANGELOG.mdaktualisieren- Git commit erstellen
- Git tag erstellen
Nach Release
git push --follow-tags origin main
🌿 Branch-Workflow
Feature entwickeln
# 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
# 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:
- ESLint - Code-Qualität prüfen
- Prettier - Code formatieren
- Type-Check - TypeScript-Fehler finden
Falls Fehler auftreten:
# 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
# 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 - Ausführliche Versioning-Strategie
- GIT_WORKFLOW.md - Detaillierter Git-Workflow
- CHANGELOG.md - Versions-Historie
- CONTRIBUTING.md - Contribution Guidelines (wird erstellt)
🐛 Troubleshooting
Husky funktioniert nicht
rm -rf .git/hooks
npm run prepare
Commit wird abgelehnt
# Commit-Message prüfen
npx commitlint --edit
# Format: type(scope): subject
# Beispiel: feat(auth): add login
Pre-Commit schlägt fehl
# 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!
git checkout -b feature/auth-screens