Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monorepo Setup for Open-RPC Repositories #608

Open
BelfordZ opened this issue Oct 2, 2024 · 0 comments
Open

Monorepo Setup for Open-RPC Repositories #608

BelfordZ opened this issue Oct 2, 2024 · 0 comments

Comments

@BelfordZ
Copy link
Member

BelfordZ commented Oct 2, 2024

Monorepo Setup for Open-RPC Repositories

We are moving to a monorepo setup to simplify dependency management, build processes, and ensure common versions of shared tools (like TypeScript, Jest, React). The following repositories will be merged into a single monorepo:

Goal

The objective is to set up a monorepo that:

  1. Unifies package management using npm workspaces.
  2. Automates builds and publishing with Turborepo for efficient builds.
  3. Supports conventional commits for automated versioning and changelog generation using Lerna.
  4. Publishes packages to both npm and GitHub releases.
  5. Provides a clean CI/CD pipeline using GitHub Actions.

Tasks

1. Monorepo Initialization

  • Create a new repository for the monorepo.
  • Set up npm workspaces to manage multiple packages inside the repo. Each package should be in its own folder under packages/ (e.g., packages/inspector, packages/logs-react, etc.).
  • Migrate the source code of each of the repos listed above into the appropriate package folder.

2. Turborepo Setup

  • Install and configure Turborepo to handle the build process for all packages.
  • Ensure that Turborepo correctly handles the dependencies between packages (e.g., package-a depending on package-b).
  • Set up Turborepo to only rebuild packages that have changed, optimizing the build process.

3. Lerna Setup for Versioning and Changelogs

  • Install and configure Lerna for automated versioning and changelog generation.
  • Set up Lerna to follow the conventional commits spec for determining version bumps (major, minor, patch).
  • Configure Lerna to create changelogs and bump versions when releasing.

4. Automating npm & GitHub Releases

  • Set up Lerna to publish packages to npm.
  • Configure Lerna to create GitHub releases with associated changelogs for each version bump.
  • Add necessary GitHub secrets (e.g., NPM_TOKEN, GITHUB_TOKEN) to authenticate publishing.

5. GitHub Actions for CI/CD

  • Create a GitHub Actions workflow to automate the following steps when code is pushed to the main branch:
    • Install dependencies using npm ci.
    • Run Turborepo to build the changed packages.
    • Run tests for the affected packages.
    • Run Lerna to handle versioning and changelogs.
    • Publish packages to npm.
    • Create a GitHub release with the changelog.

6. Testing the Monorepo

  • Test the full workflow: build, versioning, changelog creation, publishing to npm and GitHub releases.
  • Ensure that each package is correctly built and published independently, and that the dependency graph is respected during builds.

Acceptance Criteria

  • A fully functional monorepo containing the four listed repositories.
  • Turborepo set up to optimize builds across all packages.
  • Lerna handling conventional commits, version bumps, and changelog generation.
  • Successful publishing of all packages to npm and GitHub releases using GitHub Actions.

Please use this issue to track progress and ask questions. Let's make sure we streamline the workflow while maintaining clean, maintainable code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant