I have a TypeScript project that contains a couple other file types that I need to transpile as part of the build process. I can create an NPM script like tsc && other-tool
, which works but once you have 3 or 4 tools setup like this the NPM script can start to become a bit complicated. I would like to step things up a bit and create an actual build script (e.g., build.js
). I am not to the point where I need some heavyweight build infrastructure like gulp, just a simple .js script with a few lines.
However, I cannot figure out how to turn tsc
at the command line (which uses a tsconfig.json
for compilation) into a nodejs function call. How can I call tsc
from within a nodejs script? I would strongly prefer to not just shell out to TSC CLI, as it seems crazy to me to shell out to a JS script from within a JS script instead of just calling the JS script directly.