jiti.js 376 B

12345678910111213141516
  1. #!/usr/bin/env node
  2. const { resolve } = require('path')
  3. const script = process.argv.splice(2, 1)[0]
  4. if (!script) {
  5. // eslint-disable-next-line no-console
  6. console.error('Usage: jiti <path> [...arguments]')
  7. process.exit(1)
  8. }
  9. const pwd = process.cwd()
  10. const jiti = require('..')(pwd)
  11. const resolved = process.argv[1] = jiti.resolve(resolve(pwd, script))
  12. jiti(resolved)