Hey,
I'd love to be able to use this library from the client through browserify. There are a few issues currently preventing that from working. First and foremost, browserify cannot detect dynamic require()s, so child libraries aren't loaded.
Eg;
var cls = require("./api/v" + this.version);
needs to be replaced with an if statement, with each branch explicitly requireing its version.
Similarly, in v3.0.0/index.js, the fancy forEach at the bottom has to be replaced with
Util.extend(proto, require("./gists"));
Util.extend(proto, require("./gitdata"));
Util.extend(proto, require("./issues"));
Util.extend(proto, require("./authorization"));
Util.extend(proto, require("./orgs"));
Util.extend(proto, require("./statuses"));
Util.extend(proto, require("./pullRequests"));
Util.extend(proto, require("./repos"));
Util.extend(proto, require("./user"));
Util.extend(proto, require("./events"));
Util.extend(proto, require("./releases"));
Util.extend(proto, require("./search"));
Util.extend(proto, require("./markdown"));
Util.extend(proto, require("./gitignore"));
Util.extend(proto, require("./misc"));
Uglier code, perhaps, but it would work on Browserify. Well, that's the first step - use of fs to read JSON would need to be replaced with requireing instead. I didn't make it past that =)
Would be understandable to not support this as well, of course. But would be pretty cool to have.
Cheers!
Hey,
I'd love to be able to use this library from the client through browserify. There are a few issues currently preventing that from working. First and foremost, browserify cannot detect dynamic
require()s, so child libraries aren't loaded.Eg;
needs to be replaced with an if statement, with each branch explicitly
requireing its version.Similarly, in
v3.0.0/index.js, the fancyforEachat the bottom has to be replaced withUglier code, perhaps, but it would work on Browserify. Well, that's the first step - use of
fsto read JSON would need to be replaced withrequireing instead. I didn't make it past that =)Would be understandable to not support this as well, of course. But would be pretty cool to have.
Cheers!