npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-universal-module

v1.4.2

Published

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

Downloads

3

Readme

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;

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