jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.22k stars 507 forks source link

feature: shebang banner #957

Closed huozhi closed 3 years ago

huozhi commented 3 years ago

Use rolloup.output.banner to add shebang header into bundle. Resolves #338

Changes

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/formium/tsdx/odwnhztnj
✅ Preview: https://tsdx-git-fork-huozhi-bin-support.formium.vercel.app

huozhi commented 3 years ago

not sure why it's failed with node 12 + macOS, I'm currently using those as my local development env and installation + tests are passed locally.. 😂

huozhi commented 3 years ago

got it, thanks for clarifying @agilgur5

huozhi commented 3 years ago

@agilgur5 is that ok to use rollup-plugin-preserve-shebang to implement this feature? I can file another PR for it if the idea is acceptable for you

agilgur5 commented 3 years ago

@huozhi unfortunately that will run into the same issue, it won't fix the index.js file. You might notice from the codebase/repo that TSDX actually used it at one point (before it was partially removed).

The optimal solution is a good bit more complicated as it requires a nuanced Rollup plugin and refactoring several internals. I have a branch that does it, but haven't gotten around to testing it or prioritizing it (mostly because of issues written in my current status)

huozhi commented 3 years ago

understood, manually generating index.js of cjs bundle is definitely a blocker for that solution. thanks for your patient explanation! 🙏