From 1af49879c040decddf2f55a0cda133f2f300229c Mon Sep 17 00:00:00 2001 From: TheOnlyMace <0815cracky@gmail.com> Date: Sat, 17 Jan 2026 00:01:54 +0100 Subject: [PATCH] refactor: Update deploy script to copy files directly to root instead of dist/ --- scripts/deploy.js | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index f84b195..18e387c 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -117,23 +117,44 @@ async function deploy() { exec('git checkout main'); log('✅ Auf main gewechselt', 'green'); - // 5. dist/ Dateien kopieren - log('\n📋 Schritt 5: dist/ Dateien aktualisieren...', 'blue'); + // 5. Produktionsdateien ins Root kopieren + log('\n📋 Schritt 5: Produktionsdateien aktualisieren...', 'blue'); - // Alte dist/ löschen + // Ordner die aus dist/ ins Root kopiert werden + const prodFolders = ['assets', 'config', 'includes']; + + // Alte Ordner im Root löschen + for (const folder of prodFolders) { + const folderPath = path.join(process.cwd(), folder); + if (fs.existsSync(folderPath)) { + fs.rmSync(folderPath, { recursive: true, force: true }); + } + } + + // Dateien aus develop/dist/ ins Root holen + for (const folder of prodFolders) { + exec(`git checkout develop -- dist/${folder}/`, { silent: true, ignoreError: true }); + + // Von dist/ ins Root verschieben + const srcPath = path.join(process.cwd(), 'dist', folder); + const destPath = path.join(process.cwd(), folder); + if (fs.existsSync(srcPath)) { + copyRecursive(srcPath, destPath); + } + } + + // dist/ Ordner aufräumen (falls vorhanden) const distPath = path.join(process.cwd(), 'dist'); if (fs.existsSync(distPath)) { fs.rmSync(distPath, { recursive: true, force: true }); } - // Zurück zu develop um dist zu holen - exec('git checkout develop -- dist/', { silent: true }); - log('✅ dist/ Dateien aktualisiert', 'green'); + log('✅ Produktionsdateien aktualisiert', 'green'); // 6. Prüfen ob es Änderungen gibt log('\n📋 Schritt 6: Änderungen prüfen...', 'blue'); if (!hasUncommittedChanges()) { - log('ℹ️ Keine Änderungen in dist/ - nichts zu deployen', 'yellow'); + log('ℹ️ Keine Änderungen - nichts zu deployen', 'yellow'); exec('git checkout develop'); log('\n✅ Zurück auf develop', 'green'); return; @@ -144,7 +165,7 @@ async function deploy() { const timestamp = new Date().toISOString().split('T')[0]; const commitMessage = `deploy: Produktions-Update ${timestamp}`; - exec('git add dist/'); + exec('git add assets/ config/ includes/'); exec(`git commit -m "${commitMessage}"`); log(`✅ Commit erstellt: "${commitMessage}"`, 'green');