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

v0.2.0

Published

Generator for scaffolding out a JavaScript module for Node.js or the browser

Downloads

24

Readme

JavaScript module generator

Build Status

A JavaScript module generator for Yeoman.

Installation

Install Node.js (which comes with npm).

Then globally install Bower, Yo, and this generator.

npm install -g bower yo generator-jsmodule

Make a new directory, and cd into it:

mkdir mymodule && cd $_

Now scaffold out a JS module using the yo command (and optionally passing a name for your module):

yo jsmodule <module-name>

All your dependencies will automatically be installed unless you include the --skip-install option.

Generators

Available generators (to be run in the root directory).

  • jsmodule <module-name> (aka jsmodule:app)
  • jsmodule:browser <module-name>

N.B. You should replace the placeholder GitHub username in the Travis CI build-status paths at the top of the generated README.

jsmodule:app

Generates the boilerplate you need for a simple Node.js module.

Example:

yo jsmodule mymodule

Produces:

.
├── node_modules
│   ├── chai
│   └── mocha
├── test
│   └── test.js
├── .gitignore
├── .jshintrc
├── .travis.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── mymodule.js
└── package.json

jsmodule:browser

Generates the boilerplate you need for a simple client-side JavaScript module.

It setups the Karma test runner to run unit tests in the browser. Unit tests rely on the Mocha test framework and the Chai assertion library.

Example:

yo jsmodule:browser mymodule

Produces:

.
├── components
│   └── chai
├── node_modules
│   └── karma
├── test
│   └── test.js
├── .gitignore
├── .jshintrc
├── .travis.yml
├── CHANGELOG.md
├── LICENSE.md
├── README.md
├── bower.json
├── karma.conf.js
├── mymodule.js
└── package.json

Running your module's tests

Run npm test to trigger the tests.

The client-side JS module uses a local installation of Karma. If you install Karma globally, then this is an easy way to automatch your tests during development:

karma start

For further information about configuring Karma, please refer to the Karma website.