1.3.0 • Published 10 years ago
generator-ujsm v1.3.0
Universal JavaScript Module Generator

A Yeoman generator for creating universal JavaScript modules that work everywhere using ES2015, Babel, Webpack, Mocha, Chai, Sinon, Karma, Isparta, and ESLint
Features
- ES2015 - Universal JavaScript Module Boilerplate (UJSM) uses Babel to transpile ES2015 source code. There are several reasons to use ES2015 alongside with transpilation (instead of plain Node >= 4):
- The transpiled code will work with legacy Node versions;
- Since we're going to run this module in the browsers, it will be necessary to provide cross-browser compatibility;
- Seamless migration after you decide to drop 0.x.x support;
- ES2015 Tests - Mocha flag
--compilers js:babel-core/register(it's already preconfigured in the npmnpm run test-serverscript) allows to transpile Mocha tests written with ES2015 on the fly. - Universal Tests - UJSM uses Karma to make sure that code works in the browser. A npm script
test-browserdoes the job. Feel free to run the same tests in both environments - it can be preconfigured by answeringNoonWould you like to keep your server/client tests separate?question during generator initialization. - UMD - Webpack is preconfigured to integrate the Universal Module Definition (UMD) API (which provides compatibility with the most popular script loaders) to the ouput script.
- TDD - The package has a particular npm script
npm run tdd(andnpm run tdd-browserfor the browser testing) to start a Mocha watch task that reruns tests on file changes. - Git Hooks - Every time before commiting, husky runs npm tasks conveniently configured in the package.json (in this case it automatically starting both
testandbuildtasks). You can temporary disable this feature by adding--no-verifyflag (i.e$ git commit -am "Beep bop" --no-verify). The list of all available hooks can be found here.

Installation
# Install Yeoman and the UJSM generator globally
$ npm install -g yo generator-ujsm
# Make a new folder & open it
$ mkdir my-shiny-module && cd $_
# Run the generator
$ yo ujsmWorkflow
npm run build- Build task that generates both minified and non-minified scripts;npm run test-server- Run Mocha tests once;npm run test-browser- Run Mocha tests in the browser using Karma once;npm run test- Shortcut fornpm run test-server && npm run test-browser;npm run tdd- Run Mocha tests & watch files for changes;npm run tdd-browser- Run Karma (w/ Mocha) tests & watch files for changes;npm run coverage- Run Isparta, a code coverage tool;
Related
ujsm - The original boilerplate;
Possible Windows Issues
Error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variableSolution
http://stackoverflow.com/questions/21365714/nodejs-error-installing-with-npm
Error
Error: EPERM, operation not permitted 'C:\...\node_modules\phantomjs\tmp\phantomjs-1.7.0-windows'Solution
$ npm cache cleanLicense
MIT © Philipp Alferov