Skip to content

Ignore nested workspaces #951

@JordanMartinez

Description

@JordanMartinez

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:

  1. Throw an error - disable this entirely.
  2. Use the workspace defined in the subdirectory? - use the root for root things and the server for server things
  3. Merge the two workspaces?
  4. Ignore the nested workspace

The answers are:

  1. No. Throwing an error shouldn't be done so that multirepos can be supported.
  2. No. But it's not clear to me why. Perhaps because one doesn't always want to build server when building shared?
  3. 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.
  4. Yes.

See https://github.com/purescript/spago/blob/master/spaghetto/src/Spago/Config.purs#L154-L155 for where this todo originated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions