Create an NPM Environment

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:

npm init

Follow the instructions and it’ll attempt to create a proper package.json for your project.

Installing Dependencies

npm install --save react-redux
npm install --save-dev babel-core

Global installation

npm install -g eslint

Useful Dev Tools

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.

Use GitHub Repo as the Public NPM Package

npm i git:// --save

File structure of GitHub repo if you want to use it as a public package: library-name/ demo/ dist/ src/

Posted in Web Development with Package Manager, GitHub