Skip to content

Commit dd3ee7e

Browse files
committed
ci: updated build script
1 parent 6d7db1e commit dd3ee7e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

routes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/home
1+
/

scripts/build.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const { spawn } = require('child_process');
22
const fs = require('fs');
33

44
// Function to run a shell command and return the process immediately
5-
function runCommand(command, args = []) {
6-
const process = spawn(command, args);
5+
function runCommand(command, args = [], options = {}) {
6+
const process = spawn(command, args, options);
77

88
process.stdout.on('data', (data) => {
99
console.log(data.toString());
@@ -68,7 +68,7 @@ async function getAndSaveRoutes(port, filePath) {
6868

6969
// Main function to run the tasks
7070
async function main() {
71-
const port = process.env.PORT || 3000;
71+
const port = process.env.PORT || 5000;
7272
if (!port) {
7373
console.error('Environment variable PORT is not set');
7474
process.exit(1);
@@ -85,14 +85,15 @@ async function main() {
8585
`Waiting for server ${apiProcess.pid} to be ready on port ${port}...`,
8686
);
8787
await waitForServer(port);
88+
process.env.BASE_URL = `http://localhost:${port}`;
8889

8990
console.log('Server is ready. Fetching routes...');
9091
await getAndSaveRoutes(port, 'routes.txt');
9192

9293
console.log('Routes saved to routes.txt');
9394

9495
console.log('Building app...');
95-
await runCommandAndWait('nx', ['build', 'app']);
96+
await runCommandAndWait(`nx`, ['build', 'app']);
9697
console.log('App build completed');
9798

9899
console.log('Stopping server...');

0 commit comments

Comments
 (0)