kawkab-frontend
Version:
Kawkab frontend is a frontend library for the Kawkab framework
24 lines (23 loc) ⢠1.03 kB
JavaScript
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);
}
});
}