Skip to content

Feature Request: remove need for multiple spago.dhall config files by defining output targets in spago.dhall #681

@JordanMartinez

Description

@JordanMartinez

In an attempt to solve #416, I described in this comment the idea of "output targets" (since target already refers to the output file one produces when bundling an app).

Problem

If you want to add "developer dependencies," "test dependencies," or do a mono-repo, you have to define one spago.dhall config file for each output target. Hence, one may find a spago.dhall file, a test.dhall file, an examples.dhall file, and sometimes a benchmark.dhall file.

Rather than duplicating our work, this feature would define all of those targets within a single spago.dhall file.

Below is an example of what spago.dhall would look like after this change:

{-
Welcome to a Spago project!
You can edit this file as you like.
-}
let packages = ./packages.dhall
let main = { packages = packages
           , dependencies = [ "dep1" ,"dep2" ]
           , sources = [ "src/**/*.purs" ]
           }
let test = { packages = packages
           , dependencies = main.dependencies # [ "spec" ]
           , sources = main.sources # [ "test/**/*.purs" ]
           }
-- let otherTarget = --
in { name = "my-project"
   , outputs =
      { main = main
      , test = test
  --  , otherTarget = otherTarget
      }
   }

Unanswered Questions

  1. When would we want to implement this change and how would we handle the transition process since it will be a big breaking change?
  2. How should publishing change in light of this? Could we publish multiple projects from the same repo? (e.g. Halogen Hooks and it's corresponding testing library)
  3. What would the command line argument look like?

For 3, we could "desugar" commands:

  • spago build -> spago --output main build
  • spago run -> spago -o main run
  • spago test -> spago -o test run

I don't think this feature should remove the -x config.dhall part. Both features could exist at the same time.

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