moonrepo / moon

A build system and monorepo management tool for the web ecosystem, written in Rust.
https://moonrepo.dev/moon
MIT License
2.9k stars 157 forks source link

[feature] Add `backend` project type #1255

Closed rhuanbarreto closed 8 months ago

rhuanbarreto commented 10 months ago

Is your feature request related to a problem? Please describe.

Today we have 3 types of projects in our monorepo:

For applications and libraries I can simply set the type: application or type: library and set the common tasks in the .moon/tasks/typescript-application.yml.

For backends I need to use the unknown type because it's not supported to have a backend type. Therefore my request here.

Describe the solution you'd like

The ability to set the type field to backend. Maybe as a stretch goal to allow other strings. But the use case of having a Backend-only project type is important to any developer to categorize its applications and improve DX.

Describe alternatives you've considered

Using tags doesn't actually represent the type because it would also be good to have it categorized inside the VScode extension.

milesj commented 10 months ago

IMO to me a backend application is just that, an application. Do you need a distinction between frontend and backend?

What's your situation where backend and frontend tasks differ?

rhuanbarreto commented 10 months ago

for example: build steps for backends are different from SPAs. Backends will load all sources to build a docker image. SPAs will build the HTML/JS/CSS files and upload it to the hosting service.

Maybe adding the possibility to create a customized type with the constraints would make it easier.

milesj commented 10 months ago

@rhuanbarreto You can probably use a tag for this: https://moonrepo.dev/docs/concepts/task-inheritance#scope-by-project-metadata

This is how we offer reusable configs to inherit. An example for Next.js: https://github.com/moonrepo/moon-configs/tree/master/javascript/next

rhuanbarreto commented 10 months ago

Using tags doesn't actually represent the type because it would also be good to have it categorized inside the VScode extension.

So how do I use the tags to categorize the list in the VScode extension then?

milesj commented 10 months ago

Have an idea of how you want the extension to work?

rhuanbarreto commented 10 months ago

It would be good to categorize the applications in the projects view then by tags once tags are the entity to get more context about them.

milesj commented 9 months ago

I added a "Tags" view to the vs code extension.

rhuanbarreto commented 9 months ago

Just checked it. Great addition! Maybe a future improvement could be to add tags as a sub entity in the Projects Tree? Like Applications -> #tag-a -> project_name. Then you could segment the main types for projects with the same tag.

milesj commented 9 months ago

Yeah definitely. I want to revisit it at some point, since the projects/tags is sharing a lot of code and it kind of made it a bit overengineered.

milesj commented 9 months ago

Been thinking about this more, and right now I'm gravitating to a new stack setting, which would accept backend, frontend, and maybe infra.

rhuanbarreto commented 8 months ago

I like it! I already use this concept on Pulumi: https://www.pulumi.com/docs/concepts/stack/

Then the metadata could help me group backends/frontends/libraries by which stack I'm working with.

milesj commented 8 months ago

Added a stack setting in 1.22. https://moonrepo.dev/blog/moon-v1.22

Will update the extension shortly to support this.

rhuanbarreto commented 8 months ago

Will stack also be available for creating a specific task file for it?

milesj commented 8 months ago

I'll put it on the roadmap.