Lines 95-135javascript
95 const backendPath = path.join(__dirname, '../backend');
96 const frontendPath = path.join(__dirname, '../frontend');
100 const frontendPort = await findAvailablePort(23232);
101 const backendPort = await findAvailablePort(frontendPort + 1);
103 const envContent = `window.TOROLLO_BACKEND_PORT = ${backendPort};`;
105 // Ensure directory structures exist before writing env.js
106 const publicPath = path.join(frontendPath, 'public');
107 if (fs.existsSync(publicPath)) {
108 fs.writeFileSync(path.join(publicPath, 'env.js'), envContent);
111 const distPath = path.join(frontendPath, 'dist');
112 if (fs.existsSync(distPath)) {
113 fs.writeFileSync(path.join(distPath, 'env.js'), envContent);
116 const { spawn } = require('child_process');
118 const backendProcess = spawn('node', [path.join(backendPath, 'dist/server.js')], {
119 env: { ...process.env, PORT: backendPort },
123 const servePath = require.resolve('serve/build/main.js');
124 const frontendProcess = spawn('node', [servePath, '-s', 'dist', '-l', frontendPort], {
129 console.log(`${colors.cyan}================================================${colors.reset}`);
130 console.log(`${colors.green}${colors.bold}[*] Torollo System Lab is ready!${colors.reset}`);
131 console.log(`${colors.cyan}[>] Access it here: ${colors.reset}${colors.bold}http://localhost:${frontendPort}${colors.reset}`);
132 console.log(`${colors.cyan}================================================${colors.reset}\n`);
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
bin/cli.jsView on unpkg · L115 134 // Automatically open browser tab