-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-dev.js
More file actions
30 lines (25 loc) · 1.2 KB
/
index-dev.js
File metadata and controls
30 lines (25 loc) · 1.2 KB
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
const { spawn } = require('child_process');
const start = [
{ cwd: "backend", command: "npm", arguments: ["start", "--", "-l", "silly", "--privacy-policy", "sample-privacy-policy/", "--imprint-name", "Test Name", "--imprint-address", "Test Address", "--imprint-mail", "test@example.com", "--imprint-phone", "+49 1234 567890", "--imprint-web", "example.com"] },
{ cwd: "frontend", command: "npm", arguments: ["start"] }
];
if (process.env["GITPOD_WORKSPACE_URL"]) {
process.env["REACT_APP_BACKEND_URL"] = process.env["GITPOD_WORKSPACE_URL"].replace("https://", "https://8080-");
process.env["FRONTEND_URL"] = process.env["GITPOD_WORKSPACE_URL"].replace("https://", "https://3000-");
} else {
process.env["REACT_APP_BACKEND_URL"] = "http://localhost:8080";
process.env["FRONTEND_URL"] = "http://localhost:3000";
}
start.forEach(({cwd, command, arguments}) => {
const proc = spawn(command, arguments, { cwd }, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(stdout);
console.error(stderr);
});
proc.stdout.on('data', function (data) {
console.log(data.toString());
});
})