refactor: Update deploy script to copy files directly to root instead of dist/
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user