Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Updates 0.7 #29

Merged
merged 5 commits into from
May 10, 2015
Merged

Updates 0.7 #29

merged 5 commits into from
May 10, 2015

Conversation

garyb
Copy link
Member

@garyb garyb commented May 9, 2015

More changes :)

  • The ffi option I added wasn't very useful in its previous form, as you'd always have to specify the full list of file paths or use glob to do the work - figured I may as well integrate that into the plugin.
  • Added docgen option for psc-docs - it works a bit like codegen for psc: psc-docs now requires all the input files, so this option lets you filter what modules to generate the docs for. It has a few permutations that are acceptable in the config:
// Write individual files for the specified modules. The process writes nothing to stdout in this case.
purescript.pscDocs({
  docgen: {
    "Prelude": "docs/Prelude.md"
    "Prelude.Unsafe": "docs/Prelude.Unsafe.md"
  }
})

// Only generate docs for one module
purescript.pscDocs({
  docgen: "Prelude"
})

// Only generate docs for the listed modules, all included in the output
purescript.pscDocs({
  docgen: ["Prelude", "Prelude.Unsafe"]
})

mkPathArray key opt = concat $ mkString key <$> (NullOrUndefined <<< Just)
<$> (fromMaybe [] (runNullOrUndefined opt) >>= expandGlob)

mkDocgen :: String -> NullOrUndefined Foreign -> [String]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not necessarily sure the implementation of this option is in the spirit of things, so if you have a better idea for how it might be done, please say!

@garyb
Copy link
Member Author

garyb commented May 9, 2015

I can squash the commits if you prefer also.

@ethul
Copy link
Contributor

ethul commented May 9, 2015

Looks good! Thanks for the updates.

Can you please add the docgen option to the README? Also, regarding the version bump to 0.5.0, should we wait to bump this until PureScript 0.7 is out? Or would you like version 0.5.0 up on NPM to use presently?

Regarding using glob for the ffi option, is it possible for files to sneak into the result of the glob. Do we only want directory paths as a result? Maybe I don't fully understand the ffi option usage yet.

And I am okay with the commits, no need to squash. But I will leave it up to you.

@garyb
Copy link
Member Author

garyb commented May 9, 2015

Ah yep, good point about the README!

ffi should only have files in it actually, it's basically the same as the inputs for .purs, but for .js files for things that have been foreign imported. At a command line level it'd be used something like this:

psc --ffi=X.js --ffi=Y.js --ffi=Z.js X.purs Y.purs Z.purs

The JS and PS will be associated by scanning the JS files for a comment like // module X rather than using filenames or anything.

Yeah, I wouldn't publish it just yet, just figured I'd bump the version for when it's ready.

@ethul
Copy link
Contributor

ethul commented May 9, 2015

Thanks for clarifying. Makes sense.

Can we say something in the README for the ffi options like:
Sets one or more --ffi=<string> that specifies files for code...

I just removed the words location of, but I think it helps indicate we want files as values.

Noted on the publishing. The bump works for me, but I will hang off on putting it on NPM until purescript 0.7 is out (unless we need it sooner).

@ethul
Copy link
Contributor

ethul commented May 9, 2015

Ah, and I am wondering if any exceptions will be thrown with glob.sync. Should we handle an error that may crop up here?

@garyb
Copy link
Member Author

garyb commented May 9, 2015

What do you suggest we do for that - fail silently and return []? There's not really a way of handling errors in the option building at the moment, is there?

@ethul
Copy link
Contributor

ethul commented May 9, 2015

You're right there is no way currently to handle errors during the option building.

I was testing out when exceptions would be thrown by glob, and it seems to only throw on input that is not a string. So I think we already enforce a string is required as input to glob. Perhaps leaving it as-is is the best thing to do. I think that works.

ethul added a commit that referenced this pull request May 10, 2015
@ethul ethul merged commit a108ca3 into master May 10, 2015
@ethul ethul deleted the updates-0.7 branch May 10, 2015 13:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants