impressiver / generator-combo-module

A Yeoman generator for writing JavaScript modules that work everywhere

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

generator-combo-module Build Status

A generator for Yeoman that lets you write JavaScript modules in plain Node.js, and transpile them into every permutation you (or anyone else) might need.

Write modules in Node.js, get them in the browser for free

The purpose of this generator is not to end up with a complete web application, but rather a modular component that could be used in any application.

WORK IN PROGRESS: I'm still experimenting a bit and things might change. I welcome feedback and suggestions; I'd like this to be genuinely useful in the end.

combo-module generates a complete skeleton for developing in Node.js, testing, optimizing, versioning, and transpiling to all of the internet's favorite module formats. You end up with a publishable npm module for use on the server, AMD (RequireJS), CommonJS (Browserify), UMD, and/or a standalone script to use in the browser.

The transpile process is a source-to-source translation, generating a separate build tree for each module flavor. This intermediary step is useful not only for debugging in the browser, but also for reducing bloat by defering bundling/minifying to the web application. This way only the parts needed by the app will be wrappled into the final bundle. But if all you want is a single optimized file that works everywhere, you get that too.

Bits and Pieces:

Getting Started

Requirements

  • npm (comes with Node.js)

Setup Yeoman

Make sure you have Yeoman installed:

$ npm install -g yo
...

Install this generator (like a plug-in for Yeoman) from npm:

$ npm install -g generator-combo-module

Generate a new combo-module

Create a directory for the project, and cd into it:

$ mkdir ~/dev/fancy-new-module && cd $_

Finally, initiate the generator:

$ yo combo-module

Generator Options

The generator will prompt you for several config settings before generating the project files. Where possible, all settings are saved in the project's package.json under the config hash, and any time an npm lifecycle script or Grunt task is run it will look there first for config values. So you'll be able to make changes to the config if you change your mind later.

TODO

  • Transpile
  • Node.js to AMD/UMD
  • to combined.js
  • optimized/minified w/wo dependencies
  • Test
  • Node.js
  • browser (RequireJS, Browserify, globals)
  • publishing (npm)

License

MIT License

About

A Yeoman generator for writing JavaScript modules that work everywhere

License:MIT License


Languages

Language:JavaScript 100.0%