oac.js 654 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env node
  2. 'use strict';
  3. const { execFileSync } = require('child_process');
  4. const path = require('path');
  5. const fs = require('fs');
  6. const cliDist = path.join(__dirname, '..', 'packages', 'cli', 'dist', 'index.js');
  7. if (!fs.existsSync(cliDist)) {
  8. console.error('Error: OAC CLI not built yet. Run: npm run build -w packages/cli');
  9. process.exit(1);
  10. }
  11. try {
  12. execFileSync('bun', [cliDist, ...process.argv.slice(2)], { stdio: 'inherit' });
  13. } catch (err) {
  14. if (err.code === 'ENOENT') {
  15. console.error('Error: Bun is required to run OAC CLI. Install from https://bun.sh');
  16. process.exit(1);
  17. }
  18. process.exitCode = err.status ?? 1;
  19. }