zaaack / foy

A simple, light-weight, type-friendly and modern task runner for general purpose.
http://zaaack.github.io/foy
MIT License
268 stars 15 forks source link

Usage with Pure ESM Packages #18

Closed arimgibson closed 11 months ago

arimgibson commented 1 year ago

Super good job on this tool; extremely easy to use and has made task running very easy.

I'm wondering you could add documentation/support for using pure ESM packages with Foy. It seems like when Foy runs ts-node, it doesn't take the ts-node settings from my tsconfig.json to be able to run ts-node in ESM.

This has resulted in some more modern packages being incompatible with Foy.

Happy to provide a minimal reproducible example as well if it's helpful; thanks!

arimgibson commented 1 year ago

Found myself some time to investigate what is causing the issues... I've isolated the issue here to a couple of things:

  1. Foy doesn't acknowledge tsconfig.json settings and instead overrides them with its own defaults. https://github.com/zaaack/foy/blob/43f49dcf82e9ac3019b20913b2dc9c42dc7cb61a/src/default-cli.ts#L166-L177

  2. Foy would have to ship both ESM and CJS versions to be usable in both environments

@zaaack would you be open to merging a PR that incorporates both of these changes? I'd love to become a frequent contributor to Foy as I love the software and have migrated many scripts at work to Foy.

zaaack commented 11 months ago

@arimgibson sorry to reply late, I'm not familiar with node ESM modules, it would be nice if you can send a PR for this. If you don't have time to handle this, I'll investigate it by myself later. I wrote a PR, not sure it would be working, please review, thanks.