Press n or j to go to the next uncovered block, b, p or k for the previous block.
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 36 37 38 39 40 41 42 43 44 | #!/usr/bin/env node import { exec, spawn } from 'node:child_process'; import { promisify } from 'node:util'; const _execAsync = promisify(exec); // Align with scripts/serve-website.js default const PORT = process.env.PORT || 8081; async function buildAndServe() { try { console.log('šØ Building website...'); await new Promise((resolve, reject) => { const buildProc = spawn('pnpm', ['run', 'website:build'], { stdio: 'inherit' }); buildProc.on('error', reject); buildProc.on('exit', (code) => code === 0 ? resolve() : reject(new Error(`website:build exited with code ${code}`))); }); console.log('ā Website built successfully!'); console.log('š Starting development server...'); const serverProcess = exec(`PORT=${PORT} node scripts/serve-website.js`); serverProcess.stdout.on('data', (data) => { console.log(data.toString().trim()); }); serverProcess.stderr.on('data', (data) => { console.error(data.toString().trim()); }); // Handle graceful shutdown process.on('SIGINT', () => { console.log('\nš Shutting down server...'); serverProcess.kill(); process.exit(0); }); console.log(`š Open http://127.0.0.1:${PORT}/playground/ to try examples`); } catch (error) { console.error('ā Error:', error.message); process.exit(1); } } buildAndServe(); |