https://github.com/karmaniverous/npm-package-template
An ES6 NPM package project template featuring a CLI, test support, automated API docs, release management & more!
https://github.com/karmaniverous/npm-package-template
chai docs es6 javascript mocha npm package release template testing
Last synced: 2 months ago
JSON representation
An ES6 NPM package project template featuring a CLI, test support, automated API docs, release management & more!
- Host: GitHub
- URL: https://github.com/karmaniverous/npm-package-template
- Owner: karmaniverous
- Created: 2022-07-14T07:12:39.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-12T05:55:05.000Z (over 1 year ago)
- Last Synced: 2025-09-13T10:38:50.301Z (3 months ago)
- Topics: chai, docs, es6, javascript, mocha, npm, package, release, template, testing
- Language: JavaScript
- Homepage: https://karmanivero.us/blog/npm-package-template/
- Size: 612 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# NPM Package Template
You wrote a sweet piece of code! Releasing it on [NPM](https://www.npmjs.com/)
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`](https://www.npmjs.com/package/eslint) _uber alles_.
- CJS distributions targeting specific browser support scenarios.
- Command line interfaces for your widget with
[`commander`](https://www.npmjs.com/package/commander).
- Automated [`lodash`](https://www.npmjs.com/package/lodash) cherry-picking with
[`babel-plugin-lodash`](https://www.npmjs.com/package/babel-plugin-lodash).
- [`mocha`](https://www.npmjs.com/package/mocha) &
[`chai`](https://www.npmjs.com/package/chai) for testing, with examples, and a
sweet testing console.
- In-code access to
[`package.json`](https://github.com/karmaniverous/npm-package-template/blob/main/package.json)
data, with no warnings to ignore.
- Code formatting at every save & paste with
[`prettier`](https://www.npmjs.com/package/prettier).
- Automated documentation of your API with
[`jsdoc-to-markdown`](https://www.npmjs.com/package/jsdoc-to-markdown) and
assembly of your README with
[`concat-md`](https://www.npmjs.com/package/concat-md).
- One-button release to GitHub & publish to NPM with
[`release-it`](https://www.npmjs.com/package/release-it).
**[Click here](https://karmanivero.us/blog/npm-package-template/) for full
documentation & instructions!**
_If you want to create a React component in an NPM package, use my
[React Component NPM Package Template](https://github.com/karmaniverous/react-component-npm-package-template)
instead!_
# Command Line Interface
```text
Usage: mycli [options]
Foos your bar.
Options:
-b, --bar foo what?
-h, --help display help for command
```
# API Documentation
```js
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](https://github.com/karmaniverous)!