Fork me on GitHub
#cljsjs
<
2016-08-09
>
porglezomp16:08:28

I’m trying to package someone else’s library, but it seems like their export structure is bad. How can I apply some namespacing to https://github.com/andrewrk/node-tmx-parser/blob/master/index.js? I’m new to writing externs, and the structure of this is somewhat different from all the examples.

therabidbanana19:08:28

https://github.com/cljsjs/packages/pull/683/files - maybe what I did recently would be helpful to you: I had to write a custom webpack config file - the

libraryTarget: "var",
library: "ReactDateRange"
namespace the exports in https://github.com/Adphorus/react-date-range/blob/master/lib/index.js to be ReactDateRange.DateRange... etc

therabidbanana20:08:44

Not sure if that'll directly translate, but I know webpack by default pulled in all the requires necessary to make it work and built a file that exported those vars.

therabidbanana20:08:21

Oh, though for this project it looks like you'll definitely need to build with browserify, so my thing is probably not a good example at all.

therabidbanana20:08:52

react-google-maps seems to be a relevant example here.

therabidbanana20:08:07

Looks like that one used: http://jmmk.github.io/javascript-externs-generator, and used the browserify "-s ReactGoogleMaps" flag to set up the library on a global var ReactGoogleMaps so that the extern generator could find it