Skip to content

An ES6 NPM package project template featuring a CLI, test support, automated API docs, release management & more!

Notifications You must be signed in to change notification settings

karmaniverous/npm-package-template

Repository files navigation

NPM Package Template

You wrote a sweet piece of code! Releasing it on NPM seems like the obvious next step. Right?

Try it! Not as easy to do as you might think. At high quality. From scratch.

So here's a plug-and-play NPM package template that offers the following features:

  • Tree-shakable support for the latest ES6 goodies with eslint uber alles.

  • CJS distributions targeting specific browser support scenarios.

  • Command line interfaces for your widget with commander.

  • Automated lodash cherry-picking with babel-plugin-lodash.

  • mocha & chai for testing, with examples, and a sweet testing console.

  • In-code access to package.json data, with no warnings to ignore.

  • Code formatting at every save & paste with prettier.

  • Automated documentation of your API with jsdoc-to-markdown and assembly of your README with concat-md.

  • One-button release to GitHub & publish to NPM with release-it.

Click here for full documentation & instructions!

If you want to create a React component in an NPM package, use my React Component NPM Package Template instead!

Command Line Interface

Usage: mycli [options]

Foos your bar.

Options:
  -b, --bar <string>  foo what?
  -h, --help          display help for command

API Documentation

import { foo, PACKAGE_INFO } from '@karmaniverous/npm-package-template`;

foo(value) ⇒ any

Returns whatever value is passed.

Kind: global function
Returns: any - Whatever value it was passed.

Param Type Description
value any Any value.

See more great templates and other tools on my GitHub Profile!