orchestry-mcp
Version:
Orchestry MCP Server for multi-session task management
43 lines (35 loc) • 1.32 kB
JavaScript
import { exec, execSync } from 'child_process';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.join(__dirname, '..');
const distDir = path.join(rootDir, 'dist');
// Clean dist directory
if (fs.existsSync(distDir)) {
fs.rmSync(distDir, { recursive: true });
}
// Run TypeScript compiler
console.log('🔨 Compiling TypeScript...');
execSync('npx tsc', { cwd: rootDir, stdio: 'inherit' });
// Now move the compiled files to the correct location
const compiledSrcDir = path.join(distDir, 'src');
const compiledSharedDir = path.join(distDir, 'shared');
if (fs.existsSync(compiledSrcDir)) {
// Move all files from dist/src/* to dist/*
const files = fs.readdirSync(compiledSrcDir);
for (const file of files) {
const src = path.join(compiledSrcDir, file);
const dest = path.join(distDir, file);
fs.renameSync(src, dest);
}
// Remove the src directory
fs.rmSync(compiledSrcDir, { recursive: true });
}
// Keep shared directory where it is
console.log('✅ Files compiled successfully');
// Add shebangs
console.log('📝 Adding shebangs...');
execSync('node scripts/add-shebang.js', { cwd: rootDir, stdio: 'inherit' });
console.log('✅ Build complete!');