UNPKG

bunjs-env

Version:

Cross-platform environment variable setter for Bun.js

30 lines (25 loc) 663 B
#!/usr/bin/env bun /** * Binary entry point for bunjs-env CLI tool * Executes the compiled index.js with provided CLI arguments * * @module bunjs-env * @requires path * @requires bun */ import { join } from 'path'; import { spawn } from 'bun'; const indexPath = join(import.meta.dir, '..', 'dist', 'index.js'); const args = process.argv.slice(2); try { const proc = spawn({ cmd: ['bun', indexPath, ...args], stdio: ['inherit', 'inherit', 'inherit'], cwd: process.cwd() }); const exitCode = await proc.exited; process.exit(exitCode); } catch (error) { console.error('❌ Failed to start bunjs-env:', error); process.exit(1); }