On 2015-12-18 8:41 AM, Trevor Parscal wrote:
Be careful when doing this with NPM modules, as their contents are subject to change, and only their index file is configured and trying to automatically know the paths and inclusion order is more of a mad science than an art. Your best bet would be hard-coding and using very specific versions in your package.json to protect from unexpected changes dues to subtle NPM module version differences.
npm modules are modules, not scripts. Even if you knew their execution order you can't just "include" them in any order at all.
Using browserify to build a standalone script with a UMD that exposes a global might be the best bet. Though you'll have to be wary of requiring a module that pulls in a bunch of dependencies.
As for needing some $.extend, URL parsing and reconstructing, and logging. I'm assuming you mean taking client code to the server where jQuery and common browser functionally might not be present. There are many NPM modules that provide shims for these things, including full-on server-side jQuery. Usually the differences are subtle if any. Members of the Paraoid team are very familiar with this space and are probably good people to talk to about this.
URL - Built in to node. Browserify comes with a browser compatible version of the module for when you require('url') it.
extend: - lodash.merge (as part of lodash or the dedicated 'lodash.merge' module) - Some people use xtend or extend - There is also a new native Object.assign built into ES6, which you could include a simple polyfill for
Logging varies very much by what you need. So there's wilson, debug, and a bunch of others.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]