UNPKG

@sprouted/create-vibes

Version:
44 lines (36 loc) 1.12 kB
#!/usr/bin/env node /** * Vibes CLI for Generated Projects * This is a minimal launcher that runs the TypeScript CLI directly using tsx */ import { spawn } from 'child_process'; import path from 'path'; import { fileURLToPath } from 'url'; import { existsSync } from 'fs'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const projectRoot = path.resolve(__dirname, '..'); const typeScriptFile = path.join(__dirname, 'vibe.ts'); async function main() { // Check if the TypeScript file exists if (!existsSync(typeScriptFile)) { console.error('Vibes TypeScript CLI not found at:', typeScriptFile); process.exit(1); } // Run the TypeScript file directly with tsx const args = process.argv.slice(2); const child = spawn('npx', ['tsx', typeScriptFile, ...args], { stdio: 'inherit', cwd: projectRoot }); child.on('error', (error) => { console.error('Failed to start CLI:', error); process.exit(1); }); child.on('exit', (code) => { process.exit(code || 0); }); } main().catch(error => { console.error('Error:', error); process.exit(1); });