-
Notifications
You must be signed in to change notification settings - Fork 133
Description
Below is my understanding of this request based on the corresponding conversation in Discord. https://discord.com/channels/864614189094928394/865401625249448006/1084363652238413955
A monorepo is a group of packages that can compile together via some master build. A multirepo/polyrepo is a group of packages that cannot be built together; rather, they are just stored together. For context, see https://monorepo.tools/.
In the new spago, a workspace is defined by some folder that contans a spago.yml
file. For example, this repo structure is a monorepo:
foo/Foo.purs
bar/Bar.purs
baz/Baz.purs
spago.yml
However, this repo structure is a multirepo:
client/
Client.purs
spago.yml -- multirepo package - uses JS backend
server/
Server.purs
spago.yml -- multirepo package - uses Erlang backend
shared/
Shared.purs
spago.yml -- Root workspace - backend depends on usage
When building the root spago.yml
, should it also consider things found in the server/spago.yml
? There are a few ways to resolve this issue:
- Throw an error - disable this entirely.
- Use the workspace defined in the subdirectory? - use the root for root things and the server for server things
- Merge the two workspaces?
- Ignore the nested workspace
The answers are:
- No. Throwing an error shouldn't be done so that multirepos can be supported.
- No. But it's not clear to me why. Perhaps because one doesn't always want to build
server
when buildingshared
? - No. Merging the two shouldn't be done because different backends may be used between workspace and it prevents a situation where one workspace uses version A of some package and another workspace version B of the same package. PureScript doesn't support compiling two different versions of the same package as it affects type class resolution and whatnot.
- Yes.
See https://github.com/purescript/spago/blob/master/spaghetto/src/Spago/Config.purs#L154-L155 for where this todo originated.