spago icon indicating copy to clipboard operation
spago copied to clipboard

Consider `sources` behaviour in `spago.dhall`

Open elliotdavies opened this issue 4 years ago • 4 comments

While implementing #420 I noticed that we get weird behaviour if spago.dhall lists a glob path like src/**/*.js, because we're assume they're all .purs globs.

It's also true since #407 that if you list e.g. src/**/*.purs we will watch src/**/*.js as well, so the globs in spago.dhall aren't a true reflection of the files we're including.

Now that we've iterated on the initial sources idea a few times, I think it'd be good to consider what we want from it and refactor the related code at the same time.

For example, maybe users should just list directories (sources = ["src", "test"]) and we'll find all the relevant files therein? Or we could make the filetypes explicit (sources = ["src/**/*.js", "src/**/*.purs"]) and actually pay attention to them.

elliotdavies avatar Sep 25 '19 22:09 elliotdavies

@elliotdavies great analysis! Something I'd like to add is that PureScript's FFI makes it so that JS files are "implicitly read" by the compiler if they are nearby the .purs files

So I'd say we could keep the current globs behaviour (i.e. specify globs for .purs files), and:

  • ignore globs with .js files
  • ..but watch the .js equivalents of the included .purs globs

f-f avatar Oct 03 '19 08:10 f-f

That sounds good to me - in which case we should document that, and do some checks for .js globs so that we can throw warnings / errors.

elliotdavies avatar Oct 14 '19 10:10 elliotdavies

@elliotdavies Hey, I was wondering if I could take this issue?

juanpaucar avatar Oct 29 '19 20:10 juanpaucar

@juanpaucar Please do! 😁

elliotdavies avatar Oct 30 '19 00:10 elliotdavies

The new Spago does not support sources anymore, closing

f-f avatar Sep 20 '23 16:09 f-f