I've been catching up with the modern client-side JS ecosystem and reading up on CommonJS and AMD (incl. associated tools - browserify, requirejs, onejs, jam, dozens of others).  If I'm writing a Javascript library, how do I modularize/package it such that it can be most broadly accessible (ideally by users who swear by CommonJS, AMD, and especially neither)?Popular libraries like jQuery seem to just use old-school file concatenation for building itself and dynamically detect whether it should write to an exports or the global context.  I'm currently doing the same thing, but the main downside is that if I (unlike jQuery) depend on a few libraries, it's nice to not have to ask users to manually pre-include the transitive set.  (Though I currently just have two dependencies.)  And of course global namespace pollution.Or perhaps it's cleanest to generate multiple versions of my library, for each context?I'm also wondering about packaging and publishing.  There are several systems, but I believe the major one is bower, which is easy to deal with since all it does is fetch.  However, I'm wondering if I should also be targeting other package systems like component (which requires CommonJS).Are there other relevant aspects I should be aware of?  Are there any good example projects to follow for all of this?
How to modularize and package a client-side Javascript library today?
javascript;modules;packages