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

v3.0.1

Published

Yeoman generator for scaffolding micro libraries that run in the Browser and Node.js. It has browserify, mocha, chai, sinon, phantomjs, connect, eslint, bit-imports, and grunt as the core stack for linting, building, and testing.

Downloads

28

Readme

generator-libmc Build Status

Yeoman generator for micro libraries that run in the Browser and Node.js. It has browserify, mocha, chai, phantomjs, connect, eslint, bit-imports, and grunt as the core stack for linting, building, and testing.

The primary intent of this generator is to provide a good starting point to compile your code with browserify and run unit tests in the browser and phantomjs with mocha.

Getting Started

What is Yeoman?

Trick question. It's not a thing. It's this guy:

Basically, he wears a top hat, lives in your computer, and waits for you to tell him what kind of application you wish to create.

Not every new computer comes with a Yeoman pre-installed. He lives in the npm package repository. You only have to ask for him once, then he packs up and moves into your hard drive. Make sure you clean up, he likes new and shiny things.

npm install -g yo

Yeoman Generators

Yeoman travels light. He didn't pack any generators when he moved in. You can think of a generator like a plug-in. You get to choose what type of application you wish to create, such as a Backbone application or even a Chrome extension.

To install generator-libmc from npm, run:

npm install -g generator-libmc

Initiate the generator:

yo libmc

And finally, configure your package.json:

npm init

Browserify compilation

Browserify is setup to compile src/index.js in order to create a UMD file dist/index.js. The intent is to have the basic plumbing to get you up and running with a build artifact, so please feel free to adjust Gruntfile.js to use the files of your choice. To build src/index.js, run grunt build. For more details, please see build grunt task below.

Bitimports runs unit tests

Bitimports is the module loader used for running your tests. It runs unit tests in the browser and in PhantomJS. It is wired up with Babel so that you can write your unit tests using ES6 (ES2015) and newer features.

Mocha unit tests

Unit tests are configured in the generated test/SpecRunner.js file, which is where you will need to add other unit test specs. Currently, the generator will give you an overly simplified test/spec/index.js sample file to illustrate the flow of the unit test setup.

All your test files are defined in test/SpecRunner.js. If you wish to add more tests, that's where you add them.

The unit tests are setup to run in the browser and phantomjs. To run unit tests in phantomjs, run grunt test. For more details, please see livereload and test grunt tasks below.

Chai for unit test assertions

Chai is configured alongside mocha to provide assertion functionality for your unit tests.

ESLint linting

Files with .js extensions in the root, src, and test directories are configured to be linted with eslint. The settings that eslint picks up are defined in .eslintrc, which is in the root directory. .eslintrc is the file you want to tweak in order to configure eslint for your particular taste. To run eslint, run grunt eslint. For more details, please see eslint grunt task below.

Grunt tasks

grunt build

Runs eslint and then browserify on src/index.js.

grunt build

grunt serve

Starts a connect server and opens up a browser window that can continuously run unit tests

grunt serve

grunt test

Runs all unit tests one time and reports results in the console

grunt test

grunt eslint

Lints your code and report errors/warnings accordingly.

grunt eslint

License

MIT