gilamran/tsc-watch

onBeforeCompilationStarted

MasterHarem opened this issue · 4 comments

Following #120

The --onCompilationStarted flag is not blocked, tsc-watch does not wait for the execution of the script to be completed before starting the compilation. Except I am in the use case of tsoa which grabs a typescript file which must then be compiled. So I will need to change the --onCompilationStarted flag so that the compilation waits for the end of execution or the creation of a new flag.

Yea, I guess that it depends on the use case.
it feels like it's time to introduce a config file for tsc-watch :-)

Looking at the code, it's not a simple refactor as I did not "wait" for any task to complete...
I guess that it'll be a good idea to add for version 5.

bard commented

@gilamran since you asked for use cases: this is also necessary when using graphql-codegen, which must be run after a source (containing a GraphQL type definition) is modified, but before sources relying on the generated types are recompiled.

I've investigated this, and it doesn't look like it's possible... tsc-watch is using the installed tsc compiler with --watch flag, and there's no way to stop/halt the compilation once it started...
If there's anyone with an idea on how to hack this, let me know.