purescript-deprecated / gulp-purescript

Gulp plugin providing PureScript compiler tasks
34 stars 8 forks source link

Updates for 0.7 #43

Closed garyb closed 9 years ago

garyb commented 9 years ago

This isn't ready yet, but I wanted to see what you thought @ethul

Changes involved: removal of psc, renamed pscMake to psc, added src 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 used promise from npm for this, but q, bluebird, etc. would work too, if you have a preference.

Still to do: add a task for pscBundle, update dotPsci and pscDocs (if needed), remove a bunch of now uneeded stream-related stuff.

ethul commented 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.

garyb commented 9 years ago

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.

garyb commented 9 years ago

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:

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:

ethul commented 9 years ago

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?

garyb commented 9 years ago

Sounds good to me :+1:

garyb commented 9 years ago

I had the version set as 0.5.0-rc.2 in here so we'll need to update that before releasing.

ethul commented 9 years ago

Will do. Thanks for the heads up.