Skip to content

Question: How to migrate specs from old dhall to yaml on spago@next #969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
hedefalk opened this issue Jun 30, 2023 · 2 comments
Closed

Comments

@hedefalk
Copy link

hedefalk commented Jun 30, 2023

Hi,

I have this .spec.dhall:

let conf = ./spago.dhall

in conf // {
  sources = conf.sources # [ "test/**/*.purs" ],
  dependencies = conf.dependencies # [ "spec", "spec-discovery", "effect", "aff", "control", "either" ]
}

And I'm trying to understand how to correctly migrate to the yaml format for spago@next. The test field lets me specify extra library deps but not sources? Is this instead hardwired to "src" and "test/spec"?

I now ran the migrate command on spago classic to get a yaml for my main spago.dhall. Then I added a test block to the package:

  test:
    main: Test.Main
    dependencies:
      - spec
      - spec-discovery
      - effect
      - aff
      - control
      - either

and I needed to state this is a module or it would complain on no main() exported:

  bundle:
    type: module

So my full yaml now is:

package:
  name: kb-parsers
  dependencies:
    - foldable-traversable
    - integers
    - maybe
    - numbers
    - parsing
    - prelude
    - string-parsers
    - strings
    - tuples
  bundle:
    type: module
  test:
    main: Test.Main
    dependencies:
      - spec
      - spec-discovery
      - effect
      - aff
      - control
      - either

workspace:
  extra_packages: {}
  package_set:
    url: https://raw.githubusercontent.com/purescript/package-sets/psc-0.15.9-20230619/packages.json
    hash: sha256-fasqPSTP+iHLBxmgt294mT40HnUOnvLK1ZMiyJJGhu4=

And both spago test and spago bundle now works. The only thing I'm wondering about is the fact that I haven't clearly separated spec sources from main sources like before - the bundle previously didn't even have access to the spec sources but now they might do?

Or is this a non-issue with minification?

@thomashoneyman
Copy link
Member

esbuild will discard unused code in your project, so any code not reachable from your Main module will be discarded (including your test code and test dependencies).

@f-f
Copy link
Member

f-f commented Jul 3, 2023

The only thing I'm wondering about is the fact that I haven't clearly separated spec sources from main sources like before

By convention Spago will only include the src folder when compiling (and bundling) the package, and include the test folder only when running spago test

This might change with #967 though, keep an eye on that one too.

I'd consider this ticket resolved for now, but feel free to reopen if there are any other questions

@f-f f-f closed this as completed Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants