mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-25 09:25:50 +00:00
- Rename index.ts to cli.ts as single entry point - Merge app.ts and shutdown-state.ts into server.ts - Update all imports and references to use new structure - Update e2e tests and dev script to spawn via cli.ts - Remove execution code from server.ts (only cli.ts executes) - Clean up tsconfig.client.json exclude path This creates a cleaner separation where cli.ts is the only entry point that decides whether to run server or forward mode. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
No EOL
1.8 KiB
JavaScript
53 lines
No EOL
1.8 KiB
JavaScript
const { spawn } = require('child_process');
|
|
const path = require('path');
|
|
|
|
console.log('Starting development mode...');
|
|
|
|
// Determine what to watch based on arguments
|
|
const watchServer = !process.argv.includes('--client-only');
|
|
|
|
// Initial build of assets and CSS
|
|
console.log('Initial build...');
|
|
require('child_process').execSync('node scripts/ensure-dirs.js', { stdio: 'inherit' });
|
|
require('child_process').execSync('node scripts/copy-assets.js', { stdio: 'inherit' });
|
|
require('child_process').execSync('npx tailwindcss -i ./src/client/styles.css -o ./public/bundle/styles.css', { stdio: 'inherit' });
|
|
|
|
// Build the command parts
|
|
const commands = [
|
|
// Watch CSS
|
|
['npx', ['tailwindcss', '-i', './src/client/styles.css', '-o', './public/bundle/styles.css', '--watch']],
|
|
// Watch assets
|
|
['npx', ['chokidar', 'src/client/assets/**/*', '-c', 'node scripts/copy-assets.js']],
|
|
// Watch client bundle
|
|
['npx', ['esbuild', 'src/client/app-entry.ts', '--bundle', '--outfile=public/bundle/client-bundle.js', '--format=esm', '--sourcemap', '--watch']],
|
|
// Watch test bundle
|
|
['npx', ['esbuild', 'src/client/test-terminals-entry.ts', '--bundle', '--outfile=public/bundle/terminal.js', '--format=esm', '--sourcemap', '--watch']]
|
|
];
|
|
|
|
// Add server watching if not client-only
|
|
if (watchServer) {
|
|
commands.push(['npx', ['tsx', 'watch', 'src/cli.ts']]);
|
|
}
|
|
|
|
// Start all processes
|
|
const processes = commands.map(([cmd, args], index) => {
|
|
const proc = spawn(cmd, args, {
|
|
stdio: 'inherit',
|
|
shell: process.platform === 'win32'
|
|
});
|
|
|
|
proc.on('error', (err) => {
|
|
console.error(`Process ${index} error:`, err);
|
|
});
|
|
|
|
return proc;
|
|
});
|
|
|
|
// Handle exit
|
|
process.on('SIGINT', () => {
|
|
console.log('\nStopping all processes...');
|
|
processes.forEach(proc => proc.kill());
|
|
process.exit(0);
|
|
});
|
|
|
|
console.log(`Development mode started (${watchServer ? 'full' : 'client only'})`); |