UNPKG

kawkab-frontend

Version:

Kawkab frontend is a frontend library for the Kawkab framework

24 lines (23 loc) • 1.03 kB
import { execSync } from 'child_process'; import chalk from 'chalk'; export function buildCommand(program) { program .command('build') .description('Build the application for production (SSR).') .action(() => { try { // --- Step 1: Generate routes --- console.log(chalk.cyan('šŸ”„ Generating routes...')); execSync('kawkab-frontend-generate-routes --no-watch', { stdio: 'inherit' }); console.log(chalk.green('āœ… Routes generated successfully.')); // --- Step 2: Start the build process --- console.log(chalk.blue('\nšŸš€ Starting production build (SSR)...')); execSync('npx cross-env BUILD_MODE=ssr react-router build', { stdio: 'inherit' }); console.log(chalk.bold.green('\nšŸŽ‰ SSR build completed successfully!')); } catch (error) { console.error(chalk.red('\nāŒ An error occurred during the build process.'), error); process.exit(1); } }); }