Open aorinevo opened 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?
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?
Thanks for adding more details! Responding to each point:
ts-node
won't leave us open to using ESM packages without further changes. We'd need to set up our TypeScript config to emit ESM and set an appropriate type inpackage.json
. But once we do that, the transpiled code would just work for consumers; there's no need to directly execute untranspiled TypeScript.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.
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
Alternatives