Replies: 4 comments 11 replies
-
I'm also more in favor of B solution but I think it will make the workspace definition more complex than it is already. What about keeping the {
"name": "workspace",
"root": ".",
"architect": {
"version": {
"builder": "@jscutlery/semver:version",
"options": {
"sync-groups": [
{ "name": "group-a", "packages": ["a", "b"] },
{ "name": "group-b", "packages": ["c", "d"] }
]
},
},
},
} The pro is the workspace definition still look the same as today with no more virtual projects added, the con is that we can't benefit Nx cache. |
Beta Was this translation helpful? Give feedback.
-
I also suggested simply an |
Beta Was this translation helpful? Give feedback.
-
An example of B could be something like: {
"name": "group-a",
"root": "packages/group-a",
"architect": {
"version": {
"builder": "@jscutlery/semver:version"
},
},
} |
Beta Was this translation helpful? Give feedback.
-
ngworkers' use case is that in the ngworker monorepo, we would have:
|
Beta Was this translation helpful? Give feedback.
-
As quickly discussed with the lovely ngworker team @LayZeeDK, @NachoVazquez, @SerkanSipahi, and @santoshyadavdev, it appears that we need to provide a solution for project/package grouping by version.
E.g.: given a repo with 3 packages a, b & c, one should be able to sync versions for a & b but still keep independent versioning for c; meaning that changing a would have to bump b as well.
The tricky part is that the current approach either adds a "version" builder to the whole workspace (sync mode) or to projects individually (independent mode).
We can see the following alternatives:
A: add options to the workspace builder
A.1.: --projects option to construct the group
A.2.: --path option (Suggested by ngworker team ;))
This one is brilliant for the following reasons: a project can't be part of different groups, adding a project to a subfolder of the path will automatically add it to the group without changing the config. "Filesystem structure as config"
Challenge with this approach: how to benefit from nx cache / dep graph. As the command would run on the workspace we can't enjoy something like
nx run my-group-name version
B: create a "group" project in workspace config like we already do in sync mode with a root path set to the the group folder. This way, Nx cache and Nx dep graph might work. I still wonder if it doesn't confuse Nx too much to have files which are part of different projects, i.e. the project and the group.
This will just run the sync mode with a filter of projects that are in the group path. we also have to be careful about the root changelog.
It seems like the idea of folder grouping is the way to go. "B" is my personal favorite... if it works without hacks.
There are probably other solutions we didn't discuss yet. What do you think?
cc. @edbzn
Beta Was this translation helpful? Give feedback.
All reactions