This commit is contained in:
2024-12-09 17:44:56 +01:00
parent 77115f9da0
commit b8d00a24d0
17 changed files with 1561 additions and 60 deletions

41
gulpfile.js Normal file
View File

@@ -0,0 +1,41 @@
const gulp = require('gulp');
const ftp = require('basic-ftp');
const log = require('fancy-log');
const dotenv = require('dotenv');
const path = require('path');
const fs = require('fs');
// Laden der Umgebungsvariablen aus der .env-Datei (optional)
dotenv.config();
// Deploy Task mit basic-ftp
gulp.task('deploy', async function () {
const client = new ftp.Client();
client.ftp.verbose = true; // Aktiviert detaillierte Logs
try {
// Zugriff auf die FTP-Verbindung
await client.access({
host: process.env.FTP_HOST || 'ftps.verag.ag',
user: process.env.FTP_USER || 'daniel',
password: process.env.FTP_PASS || 'debug',
secure: true, // Aktiviert FTPS (erfordert PROT P)
secureOptions: {
rejectUnauthorized: false // Nur verwenden, wenn Ihr Server ein selbstsigniertes Zertifikat verwendet
}
});
// Wechseln in das Zielverzeichnis
await client.ensureDir(process.env.FTP_DEST || '/Websites/avisotv.app.verag.ag');
await client.cd(process.env.FTP_DEST || '/Websites/avisotv.app.verag.ag');
// Rekursives Hochladen des Inhalts des 'www'-Verzeichnisses
await client.uploadFromDir('www');
log('Deployment erfolgreich abgeschlossen.');
}
catch (err) {
log.error('Deployment fehlgeschlagen:', err);
}
client.close();
});