Share React components without using npm
Sometimes you find that you have a React component that you want to share, but not on NPM. This might be because you want it to be private, or simply because it is not a good fit for NPM.
Example: our author React component
We wanted the author component used at our blog section to be shareable, but it does not make sense bloat the NPM registry with something that no-one else has any interest in installing.
The solution
Git. Git is the solution. NPM supports installs from Git, so all it takes is to create a repository for the module and not exclude the build files in the .gitignore file. You then do the NPM install a bit different:
npm install <git-host>:<git-user>/<repo-name>
Using our react-author module as example:
npm install github:snowballdigital/react-author#1.3.0
Or using yarn:
yarn add github:snowballdigital/react-author#1.3.0
Note that we are using tags to specify versions.