So You Want Your JavaScript Library to Run Everywhere?

Guess this is going to be a running-edit post as the more I dig, the more I find… Damn it, this should be easier.

Originally I wrote:

A very helpful post on SitePen.com: Run-Anywhere JavaScript

All I have to say is what a #*&^Q mess… Suppose it’s not too bad once you work through the details and arrive at stable implementation pattern for your library but it’s a serious mess if you just wander in cold off the street and try to understand the various JavaScript module packaging options in use.

One fairly straight-forward example that seems to cover the bases is is available in the node-uuid module (boofa/node-uuid) on GitHub. I’m reading the SitePen.com blog post in one browser instance and looking at the node-uuid source in another to audit my understanding. Helpful.

Edit (and I’ll leave it here and cover what I learn in another post):

node-uuid seems to be leveraging a boilerplate approach. The SitePen.com blog post is several years old and the most recent comment (a year old) on uRequire appears to be the correct vector from my starting point in the zone of ignorance.

This also will drag me through several topics on the list of things I need to know. For example Yeoman (and everything else required to set up an actually defensible/sensible build and test environment for the ONMjs library which today, although it “works” in the browser, and encapsulates a bunch of really useful ideas (says me) is not the holistic little generally useful library I want it to be).

Advertisements

About Chris Russell

http://www.chrisrussell.net
This entry was posted in Open Source, Software and tagged , , , , , . Bookmark the permalink.

3 Responses to So You Want Your JavaScript Library to Run Everywhere?

  1. anodynos says:

    Thanks for the mention – I am http://uRequire.org ‘s author and I do also think it is the right way for the “write once, run everywhere” mantra, while avoiding UMD and similar boilerplates and automating javascript modules conversion & true interoperability.
    The project is actively maintained and has evolved a lot since last year!

  2. Agelos Pikoulas @agelospik @uRequire write via Twitter:
    “@AlpineLakes check out https://github.com/anodynos/urequire-grunt … I think it shapes the idea for an awesome @uRequire @gruntjs (@yeoman genrtor?) build system”

    I took a quick look over the weekend and think this is going to be quite useful. And, the timing of this kick-in-the-right-direction from Agelos could not be more perfectly timed: I’ve got the ONMjs library ported to CommonJS and published as a node package as of a couple days ago and am right now in need of a good way to maintain a single source code base, and get out of my Grunt build all the various generated resources that I require for browser and node.js package deployment.

Comment on this article

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s