(filepath: string)
| 6 | // Until pkgroll fixes the shebang bug, this needs to be run postbuild |
| 7 | |
| 8 | const addHashbang = (filepath: string) => { |
| 9 | const path = join(process.cwd(), filepath); |
| 10 | const s = new MagicString(fs.readFileSync(path, 'utf8')); |
| 11 | |
| 12 | // Only add the hashbang if it's not already there |
| 13 | if (!s.toString().startsWith('#!')) { |
| 14 | s.prepend('#!/usr/bin/env node\n'); |
| 15 | fs.writeFileSync(path, s.toString()); |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | addHashbang('dist/cli.mjs'); |
no test coverage detected