#!/usr/bin/env node /** * `dsh-ieg` — thin JavaScript shim over the compiled terminal interface. * * Node in this environment cannot execute `.ts` (`process.features.typescript * === false`), and the package ships only compiled JavaScript. The interface * itself is authored in TypeScript (`src/bin/ieg.ts`) and compiled to * `lib/bin/ieg.js`; this file exists solely to give the package * a stable `bin` entry point, installed as `dsh-ieg`. It is registered as a * permanent exception in `TYPESCRIPT-MIGRATION.md`. * * A dynamic `import()` is used deliberately: it works whether Node treats this * extensionless file as CommonJS or ESM, so the shim does not depend on module * detection rules. */ // A shell user pipes this command (`dsh-ieg status | head`, `| less` then quit). // When the reader goes away Node raises EPIPE on stdout; without this the CLI // dies with a stack trace and a non-zero status in exactly the pipelines a // terminal user writes. process.stdout.on('error', (error) => { if (error && error.code === 'EPIPE') process.exit(0) throw error }) import('../lib/bin/ieg.js') .then(({ main }) => main(process.argv.slice(2))) .then((code) => { process.exitCode = code }) .catch((error) => { process.stderr.write(`dsh-ieg: fatal: ${error && error.stack ? error.stack : error}\n`) process.exitCode = 1 })