An example of a monorepo
structure with nextjs, lerna and yarn monorepo.
This project shows a simple use case with monorepo
structure. It has a home
page made with ssr
and a shareable components package inside project core
.
You need to have the last version of node
in yor machine
In the project directory, you can see the follow structure:
stereo/
- In the root folder you can run one of these scripts:
yarn
- installs all the dependenciesyarn build
- build every packageyarn bootstrap
- bootstrap the packages, Installs all of their dependencies and links any cross-dependencies.yarn storybook:start
- start the storybook to view all components locally locahost:5555yarn test
- Launches the test runner through all packages.yarn coverage
- run coverage through all packages
stereo/packages/core
- Inside the
design
package you can run:yarn build
- will build this currently package and create the/lib
folder
stereo/packages/home
- Inside the
home
ssr app, you can run one of the nextjs methods:yarn dev
- start a dev-server with hot-reloading
yarn add --dev -W package
- Use this command inside/stereo
to install package in workspace. After that you only need to add it in yourpackage
dependency.
- 🐉 Lerna - The Monorepo manager
- 📦 Yarn Workspaces - Sane multi-package management
- 🚀 React - JavaScript library for user interfaces
- 💅 styled-components - CSS in JS elegance
- 🛠 Babel - Compiles next-gen JavaScript
- 📖 Storybook - UI Component Environment
- 🃏 Jest - Unit/Snapshot Testing
- 📦 NextJS - The React Framework
- Marcio Mendes - mmendesas
This project is licensed under the MIT License