-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.js
35 lines (26 loc) · 1.05 KB
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const { exec } = require('child_process');
const path = require('path');
const frontend = './frontend';
const backend = './backend';
// Plattformunabhängige Pfadkonstruktion
const backendPath = path.join(__dirname, backend);
const frontendPath = path.join(__dirname, frontend);
// Funktion zum Ausführen von Befehlen und Anzeigen von Ausgaben
function executeCommand(command, cwd, description) {
console.log(`Starte Befehl: ${description}`);
console.log(`Befehl: ${command}`);
const childProcess = exec(command, { cwd });
childProcess.stdout.on('data', (data) => {
console.log(`[stdout] ${data}`);
});
childProcess.stderr.on('data', (data) => {
console.error(`[stderr] ${data}`);
});
childProcess.on('close', (code) => {
console.log(`Befehl ${description} beendet mit Exit-Code ${code}`);
});
}
// Backend-Befehle ausführen
executeCommand(`python ${path.join(backendPath, 'main.py')}`, backendPath, 'Starte Backend');
// Frontend-Befehle ausführen
executeCommand(`npm run dev`, frontendPath, 'Starte Frontend-Entwicklungsmodus');