react-es6-npm-component-template v0.0.4
React ES6 Template Component
Empty ES6 npm component module for react. Starter for your own npm module deployment.
Intro
I've been developing applications with create-react-app. However, I could not use it to build a component for use as an NPM module. There are many tutorials about how to do this, but I wanted a simpler "just copy this" repo to pull from. This repo is based off of the work by: gokulkrishh.
1. Clone the repository
git clone https://github.com/jason-henriksen/react-es6-npm-component-template.git newComp
2. Make it your own repository
rm -rf .git
git init
3. Install dependencies
npm install
Folder Structure
.
├── test/
├── dist/
├── demo/
├── src/
│ └── index.js
│ └── styles.css
├── package.json
└── webpack.config.js
Features
Webpack v2
for bundling the dependencies.ES6
support.ESLint
support.Jest
for test cases.Travis CI
support.
Make it your own component
In package.json file change the name from
react-es6-npm-component-template
toyour-component-name
.Open src/index.js and make it behave as your component needs to.
Available scripts
npm run start
- To start webpack dev-server.npm run watch
- To watch a file change and build the component.npm run build
- To produce the build file.npm run deploy
- To deploy the demo folder to gh-pages.npm run test
- To run test cases.
Publish as node module
npm login
npm publish
Make sure your package name, version and other information in package.json
is correct.
License
MIT © Jason Henriksen