https://github.com/do-community/sample-yarn-lerna-monorepo
https://github.com/do-community/sample-yarn-lerna-monorepo
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/do-community/sample-yarn-lerna-monorepo
- Owner: do-community
- Created: 2021-06-21T15:16:48.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-21T15:17:08.000Z (about 5 years ago)
- Last Synced: 2025-03-28T00:44:04.492Z (about 1 year ago)
- Language: JavaScript
- Size: 80.1 KB
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lerna monorepo example
This is an example monorepo that uses lerna. There are two packages in the repo: `workspace-a`, and `workspace-b`. Both packages start HTTP servers using `yarn serve`, each returning different responses.
## Local Testing
1. Start at the repo root
1. Run `yarn install` to install all dependencies
* Note that `package.json` contains a `postinstall` script that runs `lerna bootstrap`.
* This instruct yarn to run `lerna bootstrap` after `yarn install` has finished. This allows lerna to install any required dependencies and also link the `workspace-a` and `workspace-b` packages. By doing this as part of the install step, App Platform can cache the dependencies installed by lerna.
* Important: if you do not configure a similar `postinstall` command, you will need to manually run `lerna bootstrap`.
1. Change into either workspace directory:
* `cd packages/workspace-a`; or
* `cd packages/workspace-b`
1. Run the example build command: `yarn build`
1. Start the server: `yarn serve`
## Deploying to App Platform
1. Select your git repo
1. Keep the source directory set to the default, `/`
1. Set the build command to:
```
yarn bootstrap
cd packages/workspace-b
yarn build
```
1. Set the run command to:
```
cd packages/workspace-b
yarn serve
```