mcpresso
Version:
TypeScript package for Model Context Protocol (MCP) utilities and tools
31 lines (25 loc) โข 1.11 kB
text/typescript
import { Command } from 'commander';
import chalk from 'chalk';
import { execSync } from 'child_process';
export const build = new Command('build')
.description('Build the project for production')
.option('--clean', 'Clean build directory before building')
.action(async (options) => {
try {
console.log(chalk.blue.bold('๐จ Building mcpresso project...\n'));
if (options.clean) {
console.log(chalk.gray('๐งน Cleaning build directory...'));
execSync('rm -rf dist', { stdio: 'inherit' });
}
console.log(chalk.gray('๐ฆ Building with Bun...'));
execSync('bun build src/server.ts --outdir dist --target node', { stdio: 'inherit' });
console.log(chalk.gray('โ
Type checking...'));
execSync('tsc --noEmit', { stdio: 'inherit' });
console.log(chalk.green.bold('\nโ
Build completed successfully!'));
console.log(chalk.gray('๐ Output: dist/'));
console.log(chalk.gray('๐ Ready for deployment!'));
} catch (error) {
console.error(chalk.red('โ Build failed:'), error);
process.exit(1);
}
});