Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

generator-universal-module

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generator-universal-module

A Yeoman generator for creating universal JavaScript modules that work everywhere using ES2015, Babel, Webpack, Mocha, Chai, Karma, Isparta, ESLint

  • 1.3.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Universal JavaScript Module Generator

NPM version Build Status Dependency Status

UJSM

A Yeoman generator for creating universal JavaScript modules that work everywhere using ES2015, Babel, Webpack, Mocha, Chai, Sinon, Karma, Isparta, and ESLint

Features

  1. 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;
  1. ES2015 Tests - Mocha flag --compilers js:babel-core/register (it's already preconfigured in the npm npm run test-server script) allows to transpile Mocha tests written with ES2015 on the fly.
  2. Universal Tests - UJSM uses Karma to make sure that code works in the browser. A npm script test-browser does the job. Feel free to run the same tests in both environments - it can be preconfigured by answering No on Would you like to keep your server/client tests separate? question during generator initialization.
  3. 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.
  4. TDD - The package has a particular npm script npm run tdd (and npm run tdd-browser for the browser testing) to start a Mocha watch task that reruns tests on file changes.
  5. Git Hooks - Every time before commiting, husky runs npm tasks conveniently configured in the package.json (in this case it automatically starting both test and build tasks). You can temporary disable this feature by adding --no-verify flag (i.e $ git commit -am "Beep bop" --no-verify). The list of all available hooks can be found here.

UJSM

Installation

# Install Yeoman and the UJSM generator globally
$ npm install -g yo generator-universal-module

# Make a new folder & open it
$ mkdir my-shiny-module && cd $_

# Run the generator
$ yo universal-module

Workflow

  • 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 for npm 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;

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 variable
Solution

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 clean

License

MIT © Philipp Alferov

Keywords

FAQs

Package last updated on 19 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc