Publish React Component
Boilerplate for publishing react component to npm
Just clone this repo and start developing your custom, testable react component
git clone https://github.com/damaera/publish-react-component && cd publish-react-component
Install npm dependencies
Adding New Component
All React Components are in
srcdirectory.Components can use ES6 or ES5 standardization.
Reference : ReactStoryBook.
Storybook is a UI development environment for your UI components. With it, you can visualize different states of your UI components and develop them interactively.
Storybook runs outside of your app. So you can develop UI components in isolation without worrying about app specific dependencies and requirements.
Adding New Stories
Add new file at
storiesdirectory, for example can be seen on
/stories/test.stories.js. The file must match the following format
Adding Custom Head Tags (css/js/etc)
Reference : ReactStoryBook
Adding new file Simply create a file called
preview-head.htmlinside the Storybook config directory
project └─── .storybook └─── addons.js └─── config.js └─── preview-head.html
<link href="https://link.com/style.css" /> <srcipt src="https://link.com/app.js"></script> <script> yourFunction() </script>
Adding Local Resource
For example, Place the
style.cssinto the directory
.storybook, and next import
./style.cssfrom the file
Adding New Testing
Place your tests file in the directory
Publishing to NPM
Import your React Component into
index.js which is in the root project.
All React components that are in the
srcdirectory, will be converted to es5 into
distdirectory to be read as npm package. Are you can do it manually
yarn run prepublish
Please visit the folowing file CHANGELOG.md