You wrote a sweet React component! Releasing it on NPM seems like the obvious next step. Right?
Try it. Not as easy to do from scratch as you might think.
So here's a plug-and-play NPM package template that offers the following features:
-
Support for the latest ES6 + JSX goodies with
eslint
uber alles. -
Automated
lodash
cherry-picking withbabel-plugin-lodash
. -
Front & back-end testing with
mocha
,chai
, and the React Testing Library. Includes examples and a sweet testing console! -
Code formatting at every save & paste with
prettier
. -
Automated documentation of your API with
jsdoc-to-markdown
and assembly of your README withconcat-md
. -
One-button release to GitHub & publish to NPM with
release-it
.
Click here for full template documentation & instructions!
If you want to create a non-React NPM package, try my regular NPM Package Template instead!
import { MyComponent } from '@karmaniverous/react-component-npm-package-template`;
Wraps children in an h1
tag with a specified data-test-id
attribute.
Using lodash purely to demonstrate Babel cherry-picking.
Kind: global function
Component:
Example
<MyComponent testid="testid">Hello, world!</MyComponent>;
// <h1 data-testid="testid">Hello, world!</h1>
See more great templates and other tools on my GitHub Profile!