thebuilder / react-module-template

Quick start template to create and publish a React Module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-module-template

Greenkeeper badge Travis devDependencies Status styled with prettier

Ready, set, publish!

Zero config template that comes with all the tools you need, to get started with publishing a React module to NPM.

Installation

Install the template by cloning this repository, removing .git and running yarn.

git clone git@github.com:thebuilder/react-module-template.git {PROJECT_NAME}
cd {PROJECT_NAME}
rm -rf .git
yarn

After the node_modules have been installed, you will be prompted to answer a few questions regarding the module you are creating - these are used to update the package.json, readme.md etc.

Tools

  • Babel - All your code is compiled with Babel, so it can be consumed as NPM module.
  • Jest - Easily add some tests with jest and Enzyme.
  • Storybook - React Storybook to showcase your Module.
  • ESLint - The project has configured with the basic eslint-config-react-app, to catch common issues.
  • Prettier - All your sources are prettified with prettier on commit.
  • Travis CI - All commits are tested on Travis CI.
  • Github Pages - Auto deploy to Github Pages when publishing.

Developing

To start development, you can run yarn dev to start Storybook on http://localhost:9000.

Publish

I recommend using the excellent NP, whenever you are ready to release a new version. This ensures everything is versioned, committed and tested, before you publish.

Auto generated docs

react-docgen adds the PropTypes you have defined into the readme.md when the module is published - ensures the props are kept in sync.

Github Pages

Whenever you publish the module, the postpublish script will build the Storybook and publish it to the gh-pages branch using git-directory-deploy.

About

Quick start template to create and publish a React Module

License:MIT License


Languages

Language:JavaScript 96.8%Language:CSS 3.2%