Skip to content

Hylozoic/hylo

Repository files navigation

Hylo Monorepo

Thanks for checking out our code. The documentation below may be incomplete or incorrect. We welcome pull requests! But we're a very small team, so we can't guarantee timely responses.

❤️, Tibet, Loren, Tom

Code Climate Test Coverage

Quick Start

  1. Install and use nvm to install the correct version of node. You can just do nvm install to ensure the correct version is installed and then nvm use

  2. Install yarn and foreman

npm install -g yarn foreman
  1. Install dependencies
yarn install
  1. Build shared packages
yarn build-packages
  1. Backend specific setup here

  2. Web/frontend specific setup here

  3. Once the back-end and front-end are setup you can run the app locally with: Terminal 1:

yarn backend:dev

Terminal 2:

yarn web:dev
  1. Mobile app specific setup here

  2. Desktop app specific setup here

Details on the setup of this Monorepo

How we got here:

  1. Created bare nx monorepo:
npx create-nx-workspace hylo --workspaceType integrated  --preset ts --packageManager yarn --useGitHub --nxCloud skip
cd hylo
npx nx add @nx/node
npx nx add @nx/react
npx nx add @nx/react-native
git commit -a -m "Add base nx plugins"
  1. Merged in Hylo Backend, Web, and Mobile keeping history:

Prepare individual legacy repos to be merged, and then merge into the monorepo using this sequence for each app (https://nx.dev/recipes/adopting-nx/preserving-git-histories):

cd <hylo-node|hylo-evo|HyloReactNative|hylo-shared>
git pull
git checkout -b monorepo-setup

# assuming this repo is checked out at ../hylo relative to the legacy repo root,
# where apps/web could be apps/<web|backend|mobile> or libs/shared
../hylo/move-mono.sh

git commit -m "Move files in preparation for monorepo migration (<backend|web|mobile|hylo-shared>)"
git push -u

# then merge each repo into the new monorepo generated above
cd ../hylo
git remote add <backend|web|mobile|shared> <repository url>
git fetch <backend|web|mobile|shared>
git merge <backend|web|mobile|shared>/monorepo-setup --allow-unrelated-histories
  1. Tried some yarn workspaces / monorepo stuff:
  • Goal: nx run-many -t dev to start every app in dev mode at once... This should "just work" if we add dev to scripts in each app's package.json set to do the right thing.
  • Goal: nx release prerelease --first-release --dry-run gives us expected results... MOSTLY DOES now, however needs to configure this to what we really want.
    • Need to configure versioning for React Native such that more than just package.json is updated (like react-native-version already does, likely can still use that)
    • Are we good with moving to Conventional Commits format for all our commits (or standardizing on squash commits and always using CC for our squash commit messages)?
  • Question: pnpm is somewhat the new hotness and shouldn't be difficult to switch to, also pnpm+nx is said to be a great combination. Do we switch to this?

Remaining work:

  • Update CircleCI configuration for web and backend, including getting yarn berry working there
  • CircleCI and Bitrise triggers, etc configuration update for new paths

Linting

Since this is a monorepo, your IDE will need to be setup to make sure the linting files for each of the apps and packages is respected.

For example, for VS Code based IDEs: https://stackoverflow.com/questions/60178254/vscode-eslint-configuration-for-a-two-projects-workspace

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 16