Skip to content

Local dependency paths are incorrect when packages.dhall is in another directory #244

Closed
@elliotdavies

Description

@elliotdavies

I'm rolling out Spago in a monorepo where we have multiple packages, each with their own spago.dhall, and a single packages.dhall so that all the dependencies stay in sync.

The folder structure looks like:

- packages.dhall
- package-a
  - spago.dhall
- package-b
  - spago.dhall

The packages.dhall contains something like:

let additions = {
  package-a =
    mkPackage
      ./package-a/spago.dhall
      "./package-a"
      "v1.0.0"

, package-b =
    mkPackage
      ./package-b/spago.dhall
      "./package-b"
      "v1.0.0"
}

And then package-a lists package-b as a dependency in its spago.dhall.

package-b's path is listed as "./package-b" and this is read by Spago and passed straight to the compiler (with src/**/*.purs appended). However, because the packages.dhall has been moved up one level this doesn't resolve: the actual path to b from a should be ../package-b.

I put together an SSCCE here that you can run: https://github.com/elliotdavies/spago-dependencies-example

My proposed solution would be to modify Spago so that it checks the location of packages.dhall and generates the correct relative path. I'm happy to do that work if you think it's a good idea!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions