dotnet / tye

Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
MIT License
5.28k stars 520 forks source link

Automatically add javascript SPAs #546

Open Frosco opened 4 years ago

Frosco commented 4 years ago

What should we add or change to make your life better?

It would be really cool if Tye recognised javascript SPAs (e.g. React-frontends) that are part of the folder structure. Tye would include them when you use tye run and display them in the dashboard.

Currently I would either create a Dockerfile to generate an image and instruct Tye to use it or run "npm start" and "tye run" simultaneously while adding an ingress to tye.yaml and configure the frontend to use it. If I was a beginner I would have loved to have Tye do this for me.

Why is this important to you?

Lots of projects I hear about from colleagues use different .NET backend services together with a React/Angular/Vue frontend. These would be deployed on the same cluster as part of the microservice-project. Including SPAs to tye would take away further difficulty for newcomers.

davidfowl commented 4 years ago

Unless it was part of the .NET application itself or there was a convention that > 90% of people use for their front end apps that was pretty much de-factor, automatic discovery is a losing battle. It woudl be much easier to support calling npm start on a declared folder with package.json though.

MrCrimp commented 4 years ago

A temporary workaround could be a .csproj file in the web app directory with dotnet publish support, running npm run start/build in MSBUILD tasks, like those that Visual Studio SPA templates create? Gets the job done.

Eg. https://docs.microsoft.com/en-us/aspnet/core/client-side/spa-services?view=aspnetcore-3.1#publish-the-app

tebeco commented 4 years ago

It would be much easier to support calling npm start on a declared folder with package.json though.

That look like a "standard" for front developper

Personnal opinion: tye init and tye run could/should works for npm start without the existence / usage / having to rely on MsBuild as much as possible, the only exception is only when developper explicitly try to wrap SPA within an existing csproj project

Node/Npm:

If a discovery can be made, then is it possible to have it done by relying on the OS FileSystem:

concider either:

jkotalik commented 4 years ago

Another thing we could consider is supporting the new js proj files: https://docs.microsoft.com/en-us/visualstudio/javascript/javascript-in-vs-2019?view=vs-2019.

However, I think it will be significantly more common to not have those files.

tebeco commented 4 years ago

Please concider that teams just do not open Visual Studio for SPA (they don't want to)

They higthly uses VsCode and just "Open Folder" That's why simply relying on the presence of the package.json should be concidered as a "first citizen"

Also it's probably possible to also look for vsproj or anything else. For example, as of today the tye init adds litereally everything that can starts, well that would just be "one more entry" :D

onionhammer commented 3 years ago

Unless it was part of the .NET application itself or there was a convention that > 90% of people use for their front end apps that was pretty much de-factor, automatic discovery is a losing battle. It woudl be much easier to support calling npm start on a declared folder with package.json though.

Being able to call 'npm start' or some NPM command as a tye service would be tremendous

onionhammer commented 2 years ago

Was this idea rejected or just removed from the backlog without discussion?