Remove legacy build scripts: Deleted outdated PowerShell and Bash scripts for publishing and running builds, streamlining the project structure and eliminating redundancy. These scripts were previously used for production builds and have been replaced by more efficient methods.
This commit is contained in:
@@ -1,185 +0,0 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Erstellt einen Production-Build und veroeffentlicht ihn auf den Branch main.
|
||||
|
||||
.DESCRIPTION
|
||||
1. Wechselt auf main und setzt ihn auf den Stand von dev
|
||||
2. Entfernt Kommentare, minifiziert CSS, obfuskiert JavaScript
|
||||
3. Committet und pusht main (optional)
|
||||
4. Wechselt zurueck auf dev (Quellcode bleibt unveraendert)
|
||||
|
||||
.PARAMETER Push
|
||||
Pusht main nach origin (Standard: nur lokaler Commit)
|
||||
|
||||
.PARAMETER DryRun
|
||||
Fuehrt Git-Schritte nur simuliert aus (Build wird trotzdem erstellt)
|
||||
|
||||
.PARAMETER AllowDirty
|
||||
Erlaubt uncommittete Aenderungen
|
||||
|
||||
.PARAMETER Message
|
||||
Commit-Nachricht fuer den Production-Build
|
||||
|
||||
.EXAMPLE
|
||||
.\scripts\publish-to-main.ps1
|
||||
|
||||
.EXAMPLE
|
||||
.\scripts\publish-to-main.ps1 -Push
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$Push,
|
||||
[switch]$DryRun,
|
||||
[switch]$AllowDirty,
|
||||
[string]$Message = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
||||
$BuildDir = Join-Path $Root "scripts\build"
|
||||
$OriginalBranch = ""
|
||||
|
||||
function Write-Step([string]$Text) {
|
||||
Write-Host ""
|
||||
Write-Host "==> $Text" -ForegroundColor Cyan
|
||||
}
|
||||
|
||||
function Ensure-GitClean {
|
||||
$status = git -C $Root status --porcelain
|
||||
if ($status) {
|
||||
throw "Uncommittete Aenderungen im Repository. Bitte zuerst committen oder stashen."
|
||||
}
|
||||
}
|
||||
|
||||
function Resolve-NodeTool([string]$ToolName) {
|
||||
$command = Get-Command $ToolName -ErrorAction SilentlyContinue
|
||||
if ($command) {
|
||||
return $command.Source
|
||||
}
|
||||
|
||||
$candidates = @(
|
||||
(Join-Path $env:ProgramFiles "nodejs\$ToolName.cmd"),
|
||||
(Join-Path ${env:ProgramFiles(x86)} "nodejs\$ToolName.cmd"),
|
||||
(Join-Path $env:LOCALAPPDATA "Programs\nodejs\$ToolName.cmd"),
|
||||
"c:\Program Files\cursor\resources\app\resources\helpers\node.exe"
|
||||
)
|
||||
|
||||
foreach ($candidate in $candidates) {
|
||||
if ($ToolName -eq "node" -and (Test-Path $candidate)) {
|
||||
return $candidate
|
||||
}
|
||||
if ($ToolName -ne "node" -and (Test-Path $candidate)) {
|
||||
return $candidate
|
||||
}
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
function Ensure-Node {
|
||||
$script:NodeExe = Resolve-NodeTool "node"
|
||||
$script:NpmExe = Resolve-NodeTool "npm"
|
||||
|
||||
if (-not $script:NodeExe) {
|
||||
throw "Node.js ist nicht installiert. Bitte Node.js 18+ installieren: https://nodejs.org/"
|
||||
}
|
||||
if (-not $script:NpmExe) {
|
||||
throw "npm wurde nicht gefunden. Bitte Node.js inkl. npm installieren und PATH setzen."
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Set-Location $Root
|
||||
Ensure-Node
|
||||
if (-not $AllowDirty) {
|
||||
Ensure-GitClean
|
||||
} else {
|
||||
Write-Warning "AllowDirty aktiv - uncommittete Aenderungen werden mit veroeffentlicht."
|
||||
}
|
||||
|
||||
$OriginalBranch = (git branch --show-current).Trim()
|
||||
if ($OriginalBranch -ne "dev") {
|
||||
Write-Warning "Empfohlen: Auf Branch 'dev' starten (aktuell: $OriginalBranch)"
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Message)) {
|
||||
$Message = "chore(release): production build $(Get-Date -Format 'yyyy-MM-dd HH:mm')"
|
||||
}
|
||||
|
||||
Write-Step "Installiere Build-Abhaengigkeiten"
|
||||
Set-Location $BuildDir
|
||||
if (-not $DryRun) {
|
||||
& $NpmExe ci --no-fund --no-audit
|
||||
if ($LASTEXITCODE -ne 0) { throw "npm ci fehlgeschlagen" }
|
||||
}
|
||||
|
||||
Write-Step "Wechsle auf main und synchronisiere mit dev"
|
||||
Set-Location $Root
|
||||
if ($DryRun) {
|
||||
Write-Host '[DryRun] git checkout main'
|
||||
Write-Host '[DryRun] git reset --hard dev'
|
||||
} else {
|
||||
git checkout main
|
||||
git reset --hard dev
|
||||
}
|
||||
|
||||
Write-Step "Production-Build (Kommentare entfernen, JS obfuscaten)"
|
||||
Set-Location $BuildDir
|
||||
if ($DryRun) {
|
||||
Write-Host '[DryRun] npm run build:in-place'
|
||||
} else {
|
||||
& $NpmExe run build:in-place
|
||||
if ($LASTEXITCODE -ne 0) { throw "Production-Build fehlgeschlagen" }
|
||||
}
|
||||
|
||||
Write-Step "Production-Build committen"
|
||||
Set-Location $Root
|
||||
if ($DryRun) {
|
||||
Write-Host '[DryRun] git add -A'
|
||||
Write-Host ('[DryRun] git commit -m "' + $Message + '"')
|
||||
} else {
|
||||
git add -A
|
||||
$null = git diff --cached --quiet
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Warning "Keine Build-Aenderungen - nichts zu committen."
|
||||
} else {
|
||||
git commit -m $Message
|
||||
}
|
||||
}
|
||||
|
||||
if ($Push) {
|
||||
Write-Step "Push nach origin/main"
|
||||
if ($DryRun) {
|
||||
Write-Host '[DryRun] git push origin main'
|
||||
} else {
|
||||
git push origin main
|
||||
}
|
||||
} else {
|
||||
Write-Host "Hinweis: Ohne -Push wurde nur lokal auf main gebaut." -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Step "Zurueck auf $OriginalBranch"
|
||||
if (-not $DryRun) {
|
||||
if ([string]::IsNullOrWhiteSpace($OriginalBranch)) {
|
||||
git checkout dev
|
||||
} else {
|
||||
git checkout $OriginalBranch
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Production-Release abgeschlossen." -ForegroundColor Green
|
||||
if (-not $Push -and -not $DryRun) {
|
||||
Write-Host "Zum Veroeffentlichen: git push origin main" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host ""
|
||||
Write-Host ('FEHLER: ' + $_.Exception.Message) -ForegroundColor Red
|
||||
Set-Location $Root
|
||||
if ($OriginalBranch -and -not $DryRun) {
|
||||
git checkout $OriginalBranch 2>$null
|
||||
}
|
||||
exit 1
|
||||
}
|
||||
@@ -1,187 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Erstellt einen Production-Build und veröffentlicht ihn auf den Branch main.
|
||||
#
|
||||
# 1. Wechselt auf main und setzt ihn auf den Stand von dev
|
||||
# 2. Entfernt Kommentare, minifiziert CSS, obfuskiert JavaScript
|
||||
# 3. Committet und pusht main (optional)
|
||||
# 4. Wechselt zurück auf den ursprünglichen Branch (dev bleibt unverändert)
|
||||
#
|
||||
# Nutzung:
|
||||
# ./scripts/publish-to-main.sh
|
||||
# ./scripts/publish-to-main.sh --push
|
||||
# ./scripts/publish-to-main.sh --dry-run
|
||||
# ./scripts/publish-to-main.sh --allow-dirty --message "chore(release): v1.2"
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
PUSH=false
|
||||
DRY_RUN=false
|
||||
ALLOW_DIRTY=false
|
||||
MESSAGE=""
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: publish-to-main.sh [OPTIONS]
|
||||
|
||||
Options:
|
||||
--push Push nach origin/main
|
||||
--dry-run Git-Schritte nur anzeigen (Build wird ausgeführt)
|
||||
--allow-dirty Uncommittete Änderungen erlauben
|
||||
--message TEXT Commit-Nachricht
|
||||
-h, --help Hilfe anzeigen
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--push)
|
||||
PUSH=true
|
||||
shift
|
||||
;;
|
||||
--dry-run)
|
||||
DRY_RUN=true
|
||||
shift
|
||||
;;
|
||||
--allow-dirty)
|
||||
ALLOW_DIRTY=true
|
||||
shift
|
||||
;;
|
||||
--message)
|
||||
MESSAGE="${2:-}"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unbekannte Option: $1" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
BUILD_DIR="$ROOT/scripts/build"
|
||||
ORIGINAL_BRANCH=""
|
||||
|
||||
step() {
|
||||
echo ""
|
||||
echo "==> $1"
|
||||
}
|
||||
|
||||
require_command() {
|
||||
if ! command -v "$1" >/dev/null 2>&1; then
|
||||
echo "FEHLER: '$1' nicht gefunden. Bitte installieren und PATH setzen." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
ensure_git_clean() {
|
||||
if [[ -n "$(git -C "$ROOT" status --porcelain)" ]]; then
|
||||
echo "FEHLER: Uncommittete Änderungen. Bitte zuerst committen oder stashen." >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup_on_error() {
|
||||
echo ""
|
||||
echo "FEHLER: Abgebrochen." >&2
|
||||
cd "$ROOT" || true
|
||||
if [[ -n "$ORIGINAL_BRANCH" && "$DRY_RUN" == false ]]; then
|
||||
git checkout "$ORIGINAL_BRANCH" 2>/dev/null || true
|
||||
fi
|
||||
}
|
||||
|
||||
trap cleanup_on_error ERR
|
||||
|
||||
require_command node
|
||||
require_command npm
|
||||
require_command git
|
||||
|
||||
cd "$ROOT"
|
||||
|
||||
if [[ "$ALLOW_DIRTY" == false ]]; then
|
||||
ensure_git_clean
|
||||
else
|
||||
echo "WARNUNG: --allow-dirty aktiv – uncommittete Änderungen werden mit veröffentlicht." >&2
|
||||
fi
|
||||
|
||||
ORIGINAL_BRANCH="$(git branch --show-current | tr -d '[:space:]')"
|
||||
if [[ "$ORIGINAL_BRANCH" != "dev" ]]; then
|
||||
echo "WARNUNG: Empfohlen auf Branch 'dev' zu starten (aktuell: ${ORIGINAL_BRANCH:-detached})" >&2
|
||||
fi
|
||||
|
||||
if [[ -z "$MESSAGE" ]]; then
|
||||
MESSAGE="chore(release): production build $(date '+%Y-%m-%d %H:%M')"
|
||||
fi
|
||||
|
||||
step "Installiere Build-Abhängigkeiten"
|
||||
cd "$BUILD_DIR"
|
||||
if [[ "$DRY_RUN" == false ]]; then
|
||||
npm ci --no-fund --no-audit
|
||||
fi
|
||||
|
||||
step "Wechsle auf main und synchronisiere mit dev"
|
||||
cd "$ROOT"
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
echo "[DryRun] git checkout main"
|
||||
echo "[DryRun] git reset --hard dev"
|
||||
else
|
||||
git checkout main
|
||||
git reset --hard dev
|
||||
fi
|
||||
|
||||
step "Production-Build (Kommentare entfernen, JS obfuscaten)"
|
||||
cd "$BUILD_DIR"
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
echo "[DryRun] npm run build:in-place"
|
||||
else
|
||||
npm run build:in-place
|
||||
fi
|
||||
|
||||
step "Production-Build committen"
|
||||
cd "$ROOT"
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
echo "[DryRun] git add -A"
|
||||
echo "[DryRun] git commit -m \"$MESSAGE\""
|
||||
else
|
||||
git add -A
|
||||
if git diff --cached --quiet; then
|
||||
echo "WARNUNG: Keine Build-Änderungen – nichts zu committen." >&2
|
||||
else
|
||||
git commit -m "$MESSAGE"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$PUSH" == true ]]; then
|
||||
step "Push nach origin/main"
|
||||
if [[ "$DRY_RUN" == true ]]; then
|
||||
echo "[DryRun] git push origin main"
|
||||
else
|
||||
git push origin main
|
||||
fi
|
||||
else
|
||||
echo "Hinweis: Ohne --push wurde nur lokal auf main gebaut."
|
||||
fi
|
||||
|
||||
step "Zurück auf ${ORIGINAL_BRANCH:-dev}"
|
||||
if [[ "$DRY_RUN" == false ]]; then
|
||||
if [[ -n "$ORIGINAL_BRANCH" ]]; then
|
||||
git checkout "$ORIGINAL_BRANCH"
|
||||
else
|
||||
git checkout dev
|
||||
fi
|
||||
fi
|
||||
|
||||
trap - ERR
|
||||
|
||||
echo ""
|
||||
echo "Production-Release abgeschlossen."
|
||||
if [[ "$PUSH" == false && "$DRY_RUN" == false ]]; then
|
||||
echo "Zum Veröffentlichen: git push origin main"
|
||||
fi
|
||||
@@ -1,46 +0,0 @@
|
||||
#Requires -Version 5.1
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Erstellt ein Production-Bundle unter dist/ (ohne Branch-Wechsel).
|
||||
#>
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$InPlace
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
|
||||
$BuildDir = Join-Path $Root "scripts\build"
|
||||
|
||||
function Resolve-NodeTool([string]$ToolName) {
|
||||
$command = Get-Command $ToolName -ErrorAction SilentlyContinue
|
||||
if ($command) { return $command.Source }
|
||||
|
||||
$candidates = @(
|
||||
(Join-Path $env:ProgramFiles "nodejs\$ToolName.cmd"),
|
||||
(Join-Path ${env:ProgramFiles(x86)} "nodejs\$ToolName.cmd")
|
||||
)
|
||||
|
||||
foreach ($candidate in $candidates) {
|
||||
if (Test-Path $candidate) { return $candidate }
|
||||
}
|
||||
|
||||
return $null
|
||||
}
|
||||
|
||||
$npm = Resolve-NodeTool "npm"
|
||||
if (-not $npm) {
|
||||
throw "npm nicht gefunden. Bitte Node.js installieren."
|
||||
}
|
||||
|
||||
Set-Location $BuildDir
|
||||
& $npm ci --no-fund --no-audit
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
if ($InPlace) {
|
||||
& $npm run build:in-place
|
||||
} else {
|
||||
& $npm run build
|
||||
}
|
||||
|
||||
exit $LASTEXITCODE
|
||||
@@ -1,58 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Erstellt ein Production-Bundle unter dist/ (ohne Branch-Wechsel).
|
||||
#
|
||||
# Nutzung:
|
||||
# ./scripts/run-build.sh
|
||||
# ./scripts/run-build.sh --in-place
|
||||
#
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
IN_PLACE=false
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: run-build.sh [OPTIONS]
|
||||
|
||||
Options:
|
||||
--in-place Build direkt im Repository (statt dist/)
|
||||
-h, --help Hilfe anzeigen
|
||||
EOF
|
||||
}
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--in-place)
|
||||
IN_PLACE=true
|
||||
shift
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unbekannte Option: $1" >&2
|
||||
usage >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
BUILD_DIR="$ROOT/scripts/build"
|
||||
|
||||
if ! command -v npm >/dev/null 2>&1; then
|
||||
echo "FEHLER: npm nicht gefunden. Bitte Node.js installieren." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$BUILD_DIR"
|
||||
npm ci --no-fund --no-audit
|
||||
|
||||
if [[ "$IN_PLACE" == true ]]; then
|
||||
npm run build:in-place
|
||||
else
|
||||
npm run build
|
||||
fi
|
||||
@@ -1,48 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* HexaHost.de E-Mail Test (nur CLI oder lokale Entwicklung)
|
||||
*/
|
||||
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
$remoteAddr = $_SERVER['REMOTE_ADDR'] ?? '';
|
||||
$isLocal = in_array($remoteAddr, ['127.0.0.1', '::1'], true)
|
||||
|| filter_var($remoteAddr, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) === false;
|
||||
|
||||
if (!$isLocal) {
|
||||
http_response_code(403);
|
||||
exit('Forbidden');
|
||||
}
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../backend/config/mail-config.php';
|
||||
|
||||
function testEmail() {
|
||||
$config = getHexaHostConfig();
|
||||
|
||||
$subject = '[HexaHost.de] Test-E-Mail';
|
||||
$message = "Test-E-Mail von HexaHost.de\n\n";
|
||||
$message .= "Zeitstempel: " . date('d.m.Y H:i:s') . "\n";
|
||||
|
||||
$headers = [
|
||||
'From: ' . $config['from_name'] . ' <' . $config['from_email'] . '>',
|
||||
'MIME-Version: 1.0',
|
||||
'Content-Type: text/plain; charset=UTF-8',
|
||||
'X-Mailer: HexaHost Test Email',
|
||||
];
|
||||
|
||||
return mail($config['to_email'], $subject, $message, implode("\r\n", $headers));
|
||||
}
|
||||
|
||||
if (PHP_SAPI === 'cli') {
|
||||
echo testEmail() ? "Test-E-Mail gesendet.\n" : "Fehler beim Senden.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET['test'])) {
|
||||
echo testEmail()
|
||||
? 'Test-E-Mail wurde gesendet.'
|
||||
: 'Fehler beim Senden der Test-E-Mail.';
|
||||
} else {
|
||||
echo '<h1>HexaHost.de E-Mail Test</h1>';
|
||||
echo '<p><a href="?test=1">Test-E-Mail senden</a></p>';
|
||||
}
|
||||
Reference in New Issue
Block a user