Closed garyb closed 9 years ago
Thanks for kick-starting these updates @garyb. I think they look good.
I have some parallel changes (nothing major), but I can merge them in after you're ready with this PR.
Regarding using promises, I could really go either way. I think either a callback-based psc
entry function or a promise-based one would work. Both are easy to use through gulp. If you keep the promise approach, the promise
module looks like a good choice to me.
One question I had was about the src
option for accepting globs. From what I gather, the haskell System.FilePath.Glob and the javascript glob module (as just one example of a glob module we may need to use) have differing syntax for globbing.
This doesn't pose an issue for psc
, but if we want to generate a .psci
file, I believe we'll need to ensure that what we are able to glob with javascript will be the same as what will end up being globbed by the purescript compiler. Therefore, I was wondering if we should only allow limited glob capabilities (by parsing the user's glob string and validating it). But maybe this isn't really an issue. I am curious on your thoughts.
Ah, that's an excellent point with the globbing syntax - I suppose we probably should validate the globs and at least raise a warning if it looks like the pattern is unsuitable. Perhaps for now we just make it work though, and then refine later. I suspect most people won't be using anything more advanced than the bower_components/purescript-*/**/*.purs
, type glob anyway for PureScript projects.
Ok, this is mostly ready now, I've ham-fisted my way through most of the changes, but there's some things I couldn't quite figure out how to do:
pscBundle
is done now as a promisified task and has an output
option, but ideally I'd like to be able to use it as a stream so we can pipe it to a file, or another process, or whatever as with the old psc
task.dotPsci
I've made an options parser so we pass it src
and ffi
options to include both :m
and :f
(foreign) commands in the generated file, but I've not touched the task as again I'm not really sure what I'm doing when it comes to producing streams.Would you mind having a look when you get a minute? Hopefully it'll be a quick change for someone who knows what they're doing :smile:
Awesome! Thank you for the updates. I will take a look at the streaming.
By the way, what do you think of renaming dotPsci
to just psci
?
Sounds good to me :+1:
I had the version set as 0.5.0-rc.2
in here so we'll need to update that before releasing.
Will do. Thanks for the heads up.
This isn't ready yet, but I wanted to see what you thought @ethul
Changes involved: removal of
psc
, renamedpscMake
topsc
, addedsrc
option for accepting source file globs rather than the previous stream of files from gulp.Since we don't have a stream anymore, I wrapped the task in a
Promise
instead, as this way you can still use it in gulp tasks without having to manually pipe callbacks in with the task definition. This part in particular I wonder if you have any thoughts on - maybe there's a better way? Also I just usedpromise
from npm for this, butq
,bluebird
, etc. would work too, if you have a preference.Still to do: add a task for
pscBundle
, updatedotPsci
andpscDocs
(if needed), remove a bunch of now uneeded stream-related stuff.