Skip to content

Latest commit

 

History

History
161 lines (108 loc) · 7.45 KB

README.md

File metadata and controls

161 lines (108 loc) · 7.45 KB

Hylo Monorepo

THIS REPOS IN ITS CURRENT STATE WAS THE RESULT OF THESE COMMANDS:

  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:

  • Get apps/backend (hylo-node) working in a modules environment as it is a blended CommonJS and ESM project currently
  • Get apps/mobile issues resolved around babel parsing emoji data, etc
  • Update CircleCI configuration for web and backend, including getting yarn berry working there
  • CircleCI and Bitrise triggers, etc configuration update for new paths

nx-generated README follows# Hylo

✨ Your new, shiny Nx workspace is ready ✨.

Learn more about this workspace setup and its capabilities or run npx nx graph to visually explore what was created. Now, let's get you up to speed!

Run tasks

To run tasks with Nx use:

npx nx <target> <project-name>

For example:

npx nx build myproject

These targets are either inferred automatically or defined in the project.json or package.json files.

More about running tasks in the docs »

Versioning and releasing

To version and release the library use

npx nx release

Pass --dry-run to see what would happen without actually releasing the library.

Learn more about Nx release »

Add new projects

While you could add new projects to your workspace manually, you might want to leverage Nx plugins and their code generation feature.

To install a new plugin you can use the nx add command. Here's an example of adding the React plugin:

npx nx add @nx/react

Use the plugin's generator to create new projects. For example, to create a new React app or library:

# Genenerate an app
npx nx g @nx/react:app demo

# Generate a library
npx nx g @nx/react:lib some-lib

You can use npx nx list to get a list of installed plugins. Then, run npx nx list <plugin-name> to learn about more specific capabilities of a particular plugin. Alternatively, install Nx Console to browse plugins and generators in your IDE.

Learn more about Nx plugins » | Browse the plugin registry »

Set up CI!

Step 1

To connect to Nx Cloud, run the following command:

npx nx connect

Connecting to Nx Cloud ensures a fast and scalable CI pipeline. It includes features such as:

Step 2

Use the following command to configure a CI workflow for your workspace:

npx nx g ci-workflow

Learn more about Nx on CI

Install Nx Console

Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.

Install Nx Console »

Useful links

Learn more:

And join the Nx community: