nomad-xyz / nomad-monorepo

Contracts, off-chain agents, and libraries for Nomad
https://nomad.xyz
78 stars 16 forks source link

design: Monorepo Refactor -> Multiple Repositories #142

Open yourbuddyconner opened 2 years ago

yourbuddyconner commented 2 years ago

We currently live in package dependency hell -- the monorepo's property that all code is co-located in the same filesystem ended up being a little bit of a crutch and we made some bad code hygiene decisions out of expediency.

We're going to claw ourselves out of Dante's Typescript Inferno via Yarn Workspaces, adding some enforced rules on dependencies and the relationships between typescript packages to make things intuitive and easy.

Goal:

Sequencing:

We're going to refactor nomad-monorepo into a series of smaller monorepo work trees.

How do we get here?

In this order:

1. Disable solidity tests
2. Create unified config
    - Parsers in rs/ts
3. Refactor rust & TS to use unified config
    - rust nomad-base config loader
    - ts sdk
    - ts deploy process
4. Split up repos
5. Make sure everything still works

Post-move to new repo structure

Not in any order, doesn't need to happen immediately

- Split up sdk into multiple packages
- Split up nomad-xapps into multiple packages
- Rewrite readmes
- Set up new CI in each new repo

Notable Changes:

Outstanding Questions:

.
├── nomad-sol/
│   ├── config (submodule -> nomad-config)
│   └── packages/
│       ├── core/
│       │   ├── typechain (aka @nomad-xyz/contract-interfaces)
│       │   └── contract-code 
│       ├── xapp-base
│       ├── bridge
│       ├── example-xapp
│       └── deploy (depends on @nomad-xyz/contract-interfaces and @nomad-xyz/sdk)
├── nomad-config/
│   ├── development
│   ├── staging
│   └── production 
├── nomad-rs/
│   ├── config (submodule -> nomad-config)
│   └── packages/
│       ├── agents
│       ├── chains
│       ├── nomad-base
│       ├── nomad-core
│       ├── nomad-test
│       └── tools
├── nomad-ts/
│   ├── config (submodule -> nomad-config)
│   └── packages/
│       ├── multi-provider
│       ├── sdk
│       ├── bridge
│       ├── govern
│       └── example-ui
└── nomad-services/
    ├── config (submodule -> nomad-config)
    └── packages/
        ├── nomad-indexer
        ├── nomad-monitor 
        ├── keymaster 
        └── local-environment

What do we do when we add a new network?

Say we're adding a new network to the dev environment, what happens now?

mhluongo commented 2 years ago

Reading this and I'm excited for you :grin:

yourbuddyconner commented 2 years ago

Wow, it has been such a journey between the time I wrote this and now 🤩