Lerna Starter Kit
The main focus of the starter kit is to enable you to have multiple React components published as separate packages under a single repo (we get this ability from Lerna and the ability to run them all in one place which we get from Storybook. By running them all in one place we can rapidly develop new React components, test them and deploy all from the same cmd line!
It could probably be adapted for Vue & React Native components also.
All commands in this project use
yarn but feel free to use
npm if you would prefer.
- Clone the project:
git clone email@example.com:garmeeh/lerna-starter.git
- Update the
package.jsonwith your details
- Setup project:
Demo / Example Package
yarn start will spin up Storybook and navigating to http://localhost:9001/ you will be able to see the example package showcased in Storybook. This is only a simple example package included to get you up and running with a demo. If you want to skip this part just delete this package and skip to Creating a Package or have a look at the scripts available.
Versioning By default this project mimics lerna and operates on Fixed/Locked mode.
If you want to increment package versions independently of each other, open
lerna.json and update the versions to be
"independent", this will run Lerna in independent mode.
A look at the scripts that are available:
- To bootstrap your packages and start your UI development environment run:
- To easily install all the dependencies in your individual packages at once run:
- Run all your packages tests and generate coverage report:
- To export your storybook as a static app:
- It will be placed in
.out/To test locally after export:
cd .out python -m SimpleHTTPServer
- Create a new release of the packages that have been updated. Prompts for a new version and updates all the packages on git and npm:
This project is powered by Lerna so all Lerna commands are also available. If you do wish to use these.
Creating A Package
To get started with your first package:
- Create a new directory for your package:
A basic package structure will look like:
package-name/ ├──src/ | ├──index.js * Entry point for you package | ├──index.spec.js * Test file for entry point | └──styles/ * Styled components directory | └──styledComponent.js │ ├──index.story.js * Storybook story for entry point ├──.gitignore * .gitignore specific to this package ├──README.md * README specific to this package └──package.json * Info for this independent package
yarn startwhich will bootstrap your package and run Storybook.
Start building out your Component/Package and use the Story to view it as you develop.
Write Tests and Publish!
The main purpose of this repository is to continue to evolve Lerna starter kit. Lerna starter kit is to enable you to have multiple React components published as separate packages under a single repo. Have a look at our Contributing Guide
Gary Meehan https://github.com/garmeeh
Thanks goes to these wonderful people (emoji key):
💻 📖 💡 🤔 🚇 👀 ⚠️
This project follows the all-contributors specification. Contributions of any kind welcome!