Sharing script for dotnet watch -> autogen typescript

assuming I’m not the first person to connect these dots but hadn’t seen it published this way yet, so sharing in case handy for others.

the gist here is a powershell script that captures the stdout from dotnet watch of a servicestack webapi project, looking for the “project running again” trigger string to automatically call “x typescript”.

my front end is in react so running both “npm start” on one side of vscode split terminal and running this dotnet watch monitor on the other side becomes a powerful workflow… e.g. add a property to C# DTO, hit save on that .cs file, and then shortly thereafter be able to access that new property in a react .tsx file via intellisense

of course there’s also the usual benefit of seeing the webapi console output for debugging purposes, e.g. ORM queries, etc… and you’ll see i’ve evolved the basic idea to include personal preferences like watching for database specific errors, switching console text color to catch the eye; and implement a small menu of key commands to clear the debug window, force recompile, etc

the code is very quick and dirty and i expect folks to strip it down and customize to their own needs.

big THANK YOU to mythz for creating such a fertile ecosystem to build on top of.

“dotnet watch” output monitor to autorun other tooling (github.com)

1 Like

Awesome that looks like a nice improvement to the dev workflow, thanks for sharing!