Compare commits
11 Commits
feature/ph
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 1a72210608 | |||
| b6f745e144 | |||
| e7f2875287 | |||
| 0c6f8cac5a | |||
| 2b5b0afd91 | |||
| e896831b36 | |||
| 3db7dc8971 | |||
| e30bc5704b | |||
| 25a48e9958 | |||
| 148b4849fd | |||
|
|
fb646eba85 |
@@ -6,8 +6,67 @@ on:
|
|||||||
- "feature/**"
|
- "feature/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
lint-php:
|
||||||
|
name: PHP Syntax Check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install PHP
|
||||||
|
run: apt-get update -qq && apt-get install -y -qq php-cli > /dev/null 2>&1
|
||||||
|
|
||||||
|
- name: PHP Lint
|
||||||
|
run: |
|
||||||
|
errors=0
|
||||||
|
while IFS= read -r file; do
|
||||||
|
if ! php -l "$file" > /dev/null 2>&1; then
|
||||||
|
echo "❌ Syntax error in $file"
|
||||||
|
php -l "$file"
|
||||||
|
errors=1
|
||||||
|
fi
|
||||||
|
done < <(find . -name "*.php" -not -path "./vendor/*")
|
||||||
|
if [ "$errors" -eq 1 ]; then
|
||||||
|
echo "::error::PHP lint check failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "✅ All PHP files pass syntax check"
|
||||||
|
|
||||||
|
lint-css:
|
||||||
|
name: CSS Lint (stylelint)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Node.js & stylelint
|
||||||
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq npm nodejs > /dev/null 2>&1
|
||||||
|
npm install -g stylelint stylelint-config-standard stylelint-prettier > /dev/null 2>&1
|
||||||
|
|
||||||
|
- name: CSS Lint
|
||||||
|
run: |
|
||||||
|
npx stylelint "**/*.css" --config .stylelintrc.json --allow-empty-input
|
||||||
|
echo "✅ All CSS files pass lint"
|
||||||
|
|
||||||
|
lint-html:
|
||||||
|
name: HTML Lint (htmlhint)
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Node.js & htmlhint
|
||||||
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq npm nodejs > /dev/null 2>&1
|
||||||
|
npm install -g htmlhint > /dev/null 2>&1
|
||||||
|
|
||||||
|
- name: HTML Lint
|
||||||
|
run: |
|
||||||
|
npx htmlhint "**/*.html" --config .htmlhintrc
|
||||||
|
echo "✅ All HTML files pass lint"
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
name: Deploy to Test Environment
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [lint-php, lint-css, lint-html]
|
||||||
container:
|
container:
|
||||||
volumes:
|
volumes:
|
||||||
- /var/www/test/html:/deploy
|
- /var/www/test/html:/deploy
|
||||||
@@ -20,6 +79,7 @@ jobs:
|
|||||||
echo "=== Deploying branch: ${{ gitea.ref_name }} ==="
|
echo "=== Deploying branch: ${{ gitea.ref_name }} ==="
|
||||||
echo "=== Commit: ${{ gitea.sha }} ==="
|
echo "=== Commit: ${{ gitea.sha }} ==="
|
||||||
echo "=== By: ${{ gitea.actor }} ==="
|
echo "=== By: ${{ gitea.actor }} ==="
|
||||||
|
echo "=== All lint checks passed ✅ ==="
|
||||||
date
|
date
|
||||||
|
|
||||||
- name: Deploy to test environment
|
- name: Deploy to test environment
|
||||||
@@ -37,18 +97,19 @@ jobs:
|
|||||||
--exclude='.htmlhintrc' \
|
--exclude='.htmlhintrc' \
|
||||||
--exclude='.gitignore' \
|
--exclude='.gitignore' \
|
||||||
--exclude='.dockerignore' \
|
--exclude='.dockerignore' \
|
||||||
|
--exclude='.continue' \
|
||||||
--exclude='Dockerfile' \
|
--exclude='Dockerfile' \
|
||||||
--exclude='nginx.conf' \
|
--exclude='nginx.conf' \
|
||||||
--exclude='eslint.config.js' \
|
--exclude='eslint.config.js' \
|
||||||
--exclude='package.json' \
|
--exclude='package.json' \
|
||||||
|
--exclude='package-lock.json' \
|
||||||
--exclude='docs/' \
|
--exclude='docs/' \
|
||||||
--exclude='AGENTS.md' \
|
--exclude='AGENTS.md' \
|
||||||
--exclude='README.md' \
|
--exclude='README.md' \
|
||||||
|
--exclude='scripts/' \
|
||||||
./ /deploy/
|
./ /deploy/
|
||||||
|
|
||||||
# Set haus-schleusingen.html as index
|
|
||||||
cp /deploy/haus-schleusingen.html /deploy/index.html 2>/dev/null || true
|
|
||||||
|
|
||||||
echo "✅ Deployment complete!"
|
echo "✅ Deployment complete!"
|
||||||
|
|
||||||
- name: Set permissions
|
- name: Set permissions
|
||||||
@@ -64,6 +125,7 @@ jobs:
|
|||||||
echo "=========================================="
|
echo "=========================================="
|
||||||
echo " Branch: ${{ gitea.ref_name }}"
|
echo " Branch: ${{ gitea.ref_name }}"
|
||||||
echo " Commit: ${{ gitea.sha }}"
|
echo " Commit: ${{ gitea.sha }}"
|
||||||
echo " Target: http://178.104.150.0/"
|
echo " Target: http://178.104.150.0:6427/"
|
||||||
|
echo " Lint: ✅ All checks passed"
|
||||||
echo " Time: $(date)"
|
echo " Time: $(date)"
|
||||||
echo "=========================================="
|
echo "=========================================="
|
||||||
|
|||||||
23
AGENTS.md
23
AGENTS.md
@@ -1,8 +1,27 @@
|
|||||||
# Agent-Richtlinien für dieses Projekt
|
# Agent-Richtlinien für dieses Projekt
|
||||||
|
|
||||||
|
## ⚠️ WICHTIG: Pre-Commit Hooks sind Pflicht
|
||||||
|
|
||||||
|
**Jeder Commit MUSS die Pre-Commit Lint-Checks durchlaufen. Niemals `--no-verify` verwenden!**
|
||||||
|
|
||||||
|
### Für AI-Agents (Claw etc.):
|
||||||
|
- Verwende `./scripts/safe-commit.sh "Nachricht"` statt `git commit -m "..."`
|
||||||
|
- Das Script garantiert dass lint-staged läuft (PHP, HTML, CSS, JS, Prettier)
|
||||||
|
- Wenn ein Linter fehlschlägt: **Fehler beheben, nicht überspringen!**
|
||||||
|
- Niemals `git commit --no-verify` verwenden
|
||||||
|
|
||||||
|
### Lint-Checks die laufen:
|
||||||
|
- **PHP:** `php -l` Syntax-Check (via `scripts/lint-php.sh`)
|
||||||
|
- **HTML:** htmlhint
|
||||||
|
- **CSS:** stylelint + prettier
|
||||||
|
- **JS:** eslint + prettier
|
||||||
|
- **JSON/MD:** prettier
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Systemumgebung
|
## Systemumgebung
|
||||||
|
|
||||||
- **Betriebssystem: Windows** – Alle Befehle und Pfade müssen Windows-kompatibel sein (z. B. Pfadtrennzeichen `\`, PowerShell-Syntax).
|
- **Betriebssystem: Linux** – Befehle und Pfade sind Linux-kompatibel.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -17,7 +36,7 @@
|
|||||||
|
|
||||||
| Pfad | Beschreibung |
|
| Pfad | Beschreibung |
|
||||||
| --------------------------- | -------------------------------------------- |
|
| --------------------------- | -------------------------------------------- |
|
||||||
| `haus-schleusingen.html` | Einstiegsseite (einzige HTML-Datei) |
|
| `public/index.php` | Einstiegsseite (PHP-Entry-Point) |
|
||||||
| `css/haus-schleusingen.css` | Hauptstylesheet |
|
| `css/haus-schleusingen.css` | Hauptstylesheet |
|
||||||
| `js/haus-schleusingen.js` | Haupt-JavaScript |
|
| `js/haus-schleusingen.js` | Haupt-JavaScript |
|
||||||
| `js/masonry.pkgd.min.js` | Masonry-Layout-Bibliothek (nicht bearbeiten) |
|
| `js/masonry.pkgd.min.js` | Masonry-Layout-Bibliothek (nicht bearbeiten) |
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ Das Projekt basiert auf reinem HTML, CSS und JavaScript und wird über einen Ngi
|
|||||||
## Projektstruktur
|
## Projektstruktur
|
||||||
|
|
||||||
```
|
```
|
||||||
├── haus-schleusingen.html # Einstiegsseite (einzige HTML-Datei)
|
├── public/index.php # Einstiegsseite (PHP-Entry-Point)
|
||||||
├── css/
|
├── css/
|
||||||
│ └── haus-schleusingen.css # Hauptstylesheet
|
│ └── haus-schleusingen.css # Hauptstylesheet
|
||||||
├── js/
|
├── js/
|
||||||
|
|||||||
@@ -393,7 +393,7 @@
|
|||||||
<div class="lage-icon">📍</div>
|
<div class="lage-icon">📍</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="lage-title">Genaue Adresse</div>
|
<div class="lage-title">Genaue Adresse</div>
|
||||||
<div class="lage-desc">Schleusinger Bahnhofstraße 10<br />98533 Schleusingen, Thüringen</div>
|
<div class="lage-desc">Schleusinger Bahnhofstraße 10<br />98553 Schleusingen, Thüringen</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ server {
|
|||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
index haus-schleusingen.html;
|
index index.php;
|
||||||
|
|
||||||
# Gzip aktivieren
|
# Gzip aktivieren
|
||||||
gzip on;
|
gzip on;
|
||||||
@@ -12,7 +12,7 @@ server {
|
|||||||
gzip_vary on;
|
gzip_vary on;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri $uri/ /haus-schleusingen.html;
|
try_files $uri $uri/ /index.php;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lange Cache-Dauer für Bilder und statische Assets
|
# Lange Cache-Dauer für Bilder und statische Assets
|
||||||
|
|||||||
@@ -7,12 +7,16 @@
|
|||||||
"lint:html": "htmlhint \"**/*.html\"",
|
"lint:html": "htmlhint \"**/*.html\"",
|
||||||
"lint:css": "stylelint \"css/**/*.css\" \"fonts/**/*.css\" && echo Stylelint: No errors found",
|
"lint:css": "stylelint \"css/**/*.css\" \"fonts/**/*.css\" && echo Stylelint: No errors found",
|
||||||
"lint:js": "eslint \"js/**/*.js\" --ignore-pattern \"**/*.min.js\" && echo ESLint: No errors found",
|
"lint:js": "eslint \"js/**/*.js\" --ignore-pattern \"**/*.min.js\" && echo ESLint: No errors found",
|
||||||
"lint": "npm run lint:html && npm run lint:css && npm run lint:js",
|
"lint": "npm run lint:php && npm run lint:html && npm run lint:css && npm run lint:js",
|
||||||
"format": "prettier --write \"**/*.{html,css,js,json,md}\" --ignore-path .prettierignore",
|
"format": "prettier --write \"**/*.{html,css,js,json,md}\" --ignore-path .prettierignore",
|
||||||
"format:check": "prettier --check \"**/*.{html,css,js,json,md}\" --ignore-path .prettierignore",
|
"format:check": "prettier --check \"**/*.{html,css,js,json,md}\" --ignore-path .prettierignore",
|
||||||
"prepare": "husky"
|
"prepare": "husky",
|
||||||
|
"lint:php": "find . -name \"*.php\" -not -path \"./vendor/*\" -exec php -l {} \\; > /dev/null 2>&1 && echo \"PHP syntax OK\" || (echo \"PHP lint failed\" && exit 1)"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
"*.{php}": [
|
||||||
|
"scripts/lint-php.sh"
|
||||||
|
],
|
||||||
"*.{html}": [
|
"*.{html}": [
|
||||||
"htmlhint",
|
"htmlhint",
|
||||||
"prettier --write"
|
"prettier --write"
|
||||||
|
|||||||
@@ -176,8 +176,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Form submit is handled server-side by PHP – no JS intervention needed.
|
// Form submit is handled server-side by PHP – no JS intervention needed.
|
||||||
// Form submit – opens email client with pre-filled mailto: link
|
// Success feedback is shown via #form-result after server redirect.
|
||||||
document.getElementById("contactForm")
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
User-agent: *
|
User-agent: *
|
||||||
Allow: /
|
Allow: /
|
||||||
Sitemap: https://haus-schleusingen.de/haus-schleusingen.html
|
Sitemap: https://haus-schleusingen.de/
|
||||||
|
|||||||
28
scripts/lint-php.sh
Executable file
28
scripts/lint-php.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Pre-commit PHP syntax check for lint-staged
|
||||||
|
# Called with staged .php files as arguments
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! command -v php &>/dev/null; then
|
||||||
|
echo "❌ PHP not found. Install php-cli to commit PHP files."
|
||||||
|
echo " Ubuntu/Debian: sudo apt-get install php-cli"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
errors=0
|
||||||
|
for file in "$@"; do
|
||||||
|
if ! php -l "$file" >/dev/null 2>&1; then
|
||||||
|
echo "❌ Syntax error in $file"
|
||||||
|
php -l "$file"
|
||||||
|
errors=1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$errors" -eq 1 ]; then
|
||||||
|
echo ""
|
||||||
|
echo "❌ PHP lint failed. Fix errors before committing."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ PHP syntax OK"
|
||||||
37
scripts/safe-commit.sh
Executable file
37
scripts/safe-commit.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# safe-commit.sh – Commit with pre-commit hooks guaranteed to run
|
||||||
|
# Usage: ./scripts/safe-commit.sh "commit message"
|
||||||
|
#
|
||||||
|
# This script ensures lint checks always execute, even when committing
|
||||||
|
# from non-interactive contexts (CI, AI agents, etc.).
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [ -z "${1:-}" ]; then
|
||||||
|
echo "❌ Usage: ./scripts/safe-commit.sh \"commit message\""
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
MSG="$1"
|
||||||
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||||
|
cd "$REPO_ROOT"
|
||||||
|
|
||||||
|
# Ensure hooks directory exists and is configured
|
||||||
|
if [ -d ".husky" ]; then
|
||||||
|
git config core.hooksPath .husky
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run lint-staged manually as a safety net (in case hook is skipped)
|
||||||
|
if command -v npx &>/dev/null && [ -f "node_modules/.bin/lint-staged" ]; then
|
||||||
|
echo "🔍 Running pre-commit lint checks..."
|
||||||
|
npx lint-staged || {
|
||||||
|
echo ""
|
||||||
|
echo "❌ Lint checks failed. Commit aborted."
|
||||||
|
echo " Fix the errors above and try again."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
echo "✅ All lint checks passed."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Commit with hooks enabled (no --no-verify)
|
||||||
|
git commit -m "$MSG"
|
||||||
Reference in New Issue
Block a user