vibetunnel/web/scripts/dev.js
Mario Zechner 762ebc0196 feat: Replace CodeMirror with Monaco Editor
- Add Monaco Editor (v0.52.2) as dependency
- Create MonacoEditor Lit component with normal and diff modes
- Support inline/side-by-side diff switching with responsive behavior
- Replace CodeMirror in file browser with Monaco
- Add /api/fs/diff-content endpoint for fetching original/modified content
- Update build system to use esbuild with Monaco plugin
- Add proper Monaco asset handling and bundling
- Style Monaco with VibeTunnel dark theme

Note: There are rendering artifacts that need to be addressed

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-23 03:14:45 +02:00

81 lines
No EOL
2.5 KiB
JavaScript

const { spawn } = require('child_process');
const path = require('path');
const esbuild = require('esbuild');
const { devOptions } = require('./esbuild-config.js');
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']],
];
// Add server watching if not client-only
if (watchServer) {
commands.push(['npx', ['tsx', 'watch', 'src/cli.ts']]);
}
// Set up esbuild contexts for watching
async function startBuilding() {
try {
// Create esbuild contexts
const clientContext = await esbuild.context({
...devOptions,
entryPoints: ['src/client/app-entry.ts'],
outfile: 'public/bundle/client-bundle.js',
});
const testContext = await esbuild.context({
...devOptions,
entryPoints: ['src/client/test-terminals-entry.ts'],
outfile: 'public/bundle/terminal.js',
});
// Start watching
await clientContext.watch();
await testContext.watch();
console.log('ESBuild watching client bundles...');
// Start other 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', async () => {
console.log('\nStopping all processes...');
await clientContext.dispose();
await testContext.dispose();
processes.forEach(proc => proc.kill());
process.exit(0);
});
console.log(`Development mode started (${watchServer ? 'full' : 'client only'})`);
} catch (error) {
console.error('Failed to start build:', error);
process.exit(1);
}
}
startBuilding();