felixSchl / neodoc

Beautiful, hand-crafted commandline interfaces for node.js
https://felixschl.github.io/neodoc
MIT License
226 stars 9 forks source link

Babel transform #82

Open felixSchl opened 7 years ago

felixSchl commented 7 years ago

Write a babel transform that transforms the neodoc source text into a JSON structure which would in any case would always be faster than parsing the help text. It would probably live in it's own companion project? ... I probably won't find time to do this anytime soon but feedback would be great anyway. I think this is a more elegant approach over #66

moll commented 7 years ago

Does this have to be related to Babel? Couldn't you just provide a single "parse" function for anyone who wants to preprocess will call themselves? I could, for one, just use a Make target to parse .txt to .json. :)

felixSchl commented 7 years ago

Yeah you're right. The overarching issue here is how to provide users of neodoc w/ a way to pre-parse the help text before shipping, doesn't have to be babel of course, and probably doesn't make much sense to be. Neodoc does expose a parse function whose output can be fed into the run function: https://github.com/felixSchl/neodoc/blob/development/lib/neodoc.js. But if downstream users want to retain the ability to just write their help text in their source files, we need to find a way to apply this optimization w/ least amount of friction