Replies: 1 comment 1 reply
-
I've actually thought about this a bit, as I've used bazel quite a bit in the past. I agree, using the dir name only is not the best solution, as the chance of conflicts is very high. I was thinking about something like this: projects:
globs: [...]
globNamePattern: 'dir-path' # file-name, some others? This would result in project IDs using the dir path, relative from the workspace root, so something like As for the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Overall I really like Moon, but coming from many years of using Bazel and its cousins, I really got used to using file paths in target patterns instead of project names (or scopes) as in Moon. I really wish there was an easy way to invoke tasks based on the folder structure of the repo instead of an additional nomenclature of projects/scope that moon imposes.
Imagine a directory structure like this, where each of those folders has its own
moon.yml
file:With moon I have 2 options for targeting tasks in those projects:
None of these options are flexible enough to let me invoke tasks in arbitrary subtrees of the repo, so there's an additional concept in moon such as tags and layers, which I could bolt on to have more flexibility, e.g. to invoke
#frontend:build
task on all the frontend packages.In summary, my point is that the repo already has some defined structure which developers are familiar with — folders, which moon doesn't really take advantage of, forcing you to either replicate this structure with additional concepts, or coming up with a separate structure, which is unclear for someone who's just starting with moon.
In Bazel and its cousins (Buck2, Pants, Please, etc.) things are much easier. What's scope in moon is called label in Bazel, and it's very flexible. Translating this idea to moon it could look something like this:
moon run //backend/...:build
— runbuild
task on all the descendant packages underbackend
directory.moon run :update-deps
(or //:update-deps) — runupdate-deps
task in the root of the repo, provided it has its ownmoon.yml
. Currently in moon this would run the task in all the projects.moon run //frontend/packages/auth-client:test //frontend/apps/...:test
— runtest
target, combining explicit project name and wildcard in disjoint subtrees.You can see more examples of target patterns in Bazel docs.
I don't know if something like this could be added to moon at any point, and whether you'd be interested in that, but this one thing starts being kind of a deal-breaker for me. I'm not saying moon should implement exactly the way Bazel does it, but I think it would be really helpful if moon would be able to take advantage of the existing structure of the repository at least as an option.
For example, maybe when defining globs in the moon workspace, there could be an optional flag to make it use entire paths as scope names instead of just the name of the leaf directory?
Beta Was this translation helpful? Give feedback.
All reactions