NerdWalletOSS / shepherd

A utility for applying code changes across many repositories.
Apache License 2.0
229 stars 40 forks source link

feat(ts-node): BREAKING CHANGE execute ts files directly #740

Open aorinevo opened 5 months ago

aorinevo commented 5 months ago

BREAKING CHANGE

Background

The motivation behind this change is to explore what is possible with TypeScript (TS). Whether or not we actually want to move to executing TS directly is still an open question that comes with non-trivial tradeoffs. For example,

Changes

Currently we transpile ts files to js, as files are executed in NodeJS environment which doesn't support direct execution of ts files. These changes enable ts files to be executed directly through ts-node.

This PR also contains:

Notes

  1. Assumes ts-node is installed globally.
  2. ts-node is widely adopted in the NodeJS and TS communities for executing TS code directly without requiring a separate compilation step.
    • Download count on npm: 19.5+M/week
    • Last update: 4 months ago

Alternatives

  1. Instead of ts-node, use Deno
nwalters512 commented 5 months ago

Can you say more about the motivations behind this change? What do we gain by directly executing TS files and forcing consumers to have ts-node globally installed?

aorinevo commented 5 months ago

Can you say more about the motivations behind this change? What do we gain by directly executing TS files and forcing consumers to have ts-node globally installed?

@nwalters512, I hope all is well. I've added more details to the PR description to address these questions. Thoughts?

nwalters512 commented 5 months ago

Thanks for adding more details! Responding to each point:

If all you're worried about is the experience of folks developing Shepherd, we can certainly use ts-node in dev flows. Or even https://github.com/privatenumber/tsx, which I personally like much better since in my experience it supports native ESM much more seamlessly. But I see no reason to change how things work for folks who are just installing the package. I see no upsides, just downsides.