By Kevin Hou
1 minute read
First, you need to create an NPM environment for your library so that NPM knows what dependencies and scripts are associated with the library. Run:
1npm init 2
Follow the instructions and it'll attempt to create a proper package.json for your project.
1npm install --save react-redux 2
1npm install --save-dev babel-core 2
Global installation
1npm install -g eslint 2
Linter: Check for coding errors — saves a trip to the browser (Airbnb's linter is useful) Webpack: For building and compiling JSX, ES6, etc. It will create static site with the option to serve it up locally on the localhost.
1npm i git://github.com/user/project.git#commit-ish --save 2
File structure of GitHub repo if you want to use it as a public package:
1library-name/ 2 demo/ 3 dist/ 4 src/ 5