nenoNaninu / TypedSignalR.Client.TypeScript

TypeScript source generator to provide strongly typed SignalR clients by analyzing C# type definitions.
MIT License
98 stars 11 forks source link

Generate TypeScript files upon build #249

Open Thijmen opened 2 weeks ago

Thijmen commented 2 weeks ago

Hi there,

First of all; this package looks very promising! Is it possible to add this to an existing csproj and have it generate the files during build time? Ideally that's what I want to do, and not manually with running the tool cli.

Please note I have not that much experience with the tool cli, perhaps it is already possible - perhaps it's a good idea to share that in the README 😄

WhiteOlivierus commented 1 week ago

You can add this to your csproj. This will generate everytime you build.

<Target Name="SignalRClientGeneration" AfterTargets="PostBuildEvent" Condition=" '$(Configuration)' == 'Debug' ">
    <Exec EnvironmentVariables="ASPNETCORE_ENVIRONMENT=Development" Command="dotnet tsrts --project project.csproj --output generated" />
</Target>

I might create a PR later this week if I have time.

mansellan commented 3 days ago

It would be superb if there was a package that could just be installed into the project, like the C# source generator. That would make it trivial to get working on a CI server. Yes, I'm that lazy :-)

nenoNaninu commented 1 hour ago

I recommend using the dotnet tsrts command to generate code in your CI, such as GitHub actions.