https://github.com/loopmode/cra-yarn-lerna-docker-workspace
https://github.com/loopmode/cra-yarn-lerna-docker-workspace
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/loopmode/cra-yarn-lerna-docker-workspace
- Owner: loopmode
- Created: 2019-02-12T12:24:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T03:57:06.000Z (over 3 years ago)
- Last Synced: 2025-01-08T16:26:26.815Z (over 1 year ago)
- Language: Shell
- Size: 1.59 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# create-react-app yarn workspace
This is a boilerplate project for a `create-react-app` application inside a `yarn` and `lerna` workspace.
There is a main `app` package that uses a webpack development server by means of the default CRA setup (via `react-scripts`).
Any additional packages can be transpiled and watched and they are available for import in the app.
## Local setup
- install [Node.js](https://nodejs.org/en/download/)
- install [yarn](https://yarnpkg.com/lang/en/docs/install/) (e.g. using `npm install --global yarn`)
Run `yarn` or `yarn install` in the project root to install the dependencies and create the package symlinks.
## Local scripts
**yarn start**
This starts both the `app` and `watch` scripts in parallel.
**yarn app**
This starts the development server for the `app` package.
**yarn watch**
This runs `yarn watch` in all packages that do have a `watch` script defined in their `package.json`.
**scripts/create-package.sh**
This creates a new package with some defaults, based on `scripts/templates/package`.
The package will automatically have a `build` script that transpiles `src/` to `lib/`, and a `watch` script that does the same but recompiles upon file change.
## Docker setup
- [install Docker](https://runnable.com/docker/getting-started/)
In this scenario, you don't need to have node/npm/yarn installed locally.
When using VS Code as editor, this is recommended as it has integrated auto-formatting and does not rely on the node_modules (eslint, prettier).
## Docker scripts
**scripts/docker-develop.sh**
This starts the development environment inside a Docker container. _Note: `yarn docker` is an alias for this script!_
**scripts/docker-start.sh**
This starts the production client using nginx inside a Docker container.
**docker-compose up**
Note that in order for `docker-compose up` to work, you must have used `scripts/docker-prepare.sh` to create the `.docker-packages` folder.
That's why it is recommended to use `scripts/docker-develop.sh` or `yarn docker` instead.