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

v1.7.0

Published

npm module (UMD, CJS, ES6) boilerplate generator

Downloads

13

Readme

generator-module-boilerplate

npm version David

⚙️ This generator generates a (universal) npm module boilerplate

What does module-boilerplate offer?

  • Project structure to create a cross build npm module
  • Linting: via ESLint
  • Testing: with Coverage via Jest
  • CommonJS: build (/dist/cjs) via Babel
  • ES2015: build (/dist/es) via Babel
  • UMD build: (/dist/umd) via Rollup (unminified & minified version)
  • Watch scripts: npm run (test|build):watch
  • Git hooks: precommit, prepush hooks defined in package.json
  • prepublish (before publishing to npm) script npm run build
  • Only publish what's needed (files field in package.json)

Nice to haves

+ Invisible contract which states that you will use gitmoji for commits 🤘 (just kidding, but you should)

You should probably enable greenkeeper (keeps your dependencies up to date)

Getting Started

Dependencies

install yeoman & this module globally via yarn

(this is one of the 'never install modules globally' exceptions)

yarn global add yo
yarn global add generator-module-boilerplate

or via npm

npm install yo -g
npm install generator-module-boilerplate -g

Running the generator

yo module-boilerplate

Getting Started / Scripts

watch 👀

Testing via Jest in interactive watch mode

npm run test:watch

CommonJS build (/dist/cjs) via Babel

npm run build:watch

ℹ️ use a split terminal window for maximum developer experience

build ⚙️

npm run build

The build command runs the following steps:

  1. Linting via ESLint (+ optional Flow typechecking)
  2. Testing (with Coverage) via Jest
  3. CommonJS build (/dist/cjs) via Babel
  4. ES2015 build (/dist/es) via Babel
  5. UMD builds (/dist) via Rollup

which equals to:

  1. npm run lint
  2. npm run test:coverage
  3. npm run build:cjs
  4. npm run build:es
  5. npm run build:umd

testing :white_check_mark:

Tests your src folder via Jest, (test env is included in .babelrc)

npm run test

or with coverage (also used in precommit / prepush / prepublish)

npm run test:coverage

releasing 🔖

ℹ️ more info on webpro/release-it ℹ️ premajor = x.x.x-beta.x

⚠️ watch out, semver has different rules pre 1.0.0

npm run release (premajor|patch|minor|major)
  1. Creates a version bump in package.json
  2. Commits a change with this message '🔖 vX.X.X'
  3. Creates a tag (github release) with the name 'vX.X.X' and as description 'Version X.X.X'
  4. Push to remote (with tags)
  5. npm publish (with npm run build as prepublish script)

⚠️ don't forget to answer Y on the 'publish to npm' question

You can change the release settings in the .release.json file in the root of your module folder.

Git Hooks ⛏

There are 2 git hooks defined in scripts in package.json they check for broken builds and prevent push or commit.

prepush and precommit trigger:

  1. Linting via ESLint (+ optional Flow typechecking)
  2. Testing via Jest

License

The code is available under the MIT license.