Skip to content

# Flow diagram for production package job (build-<package>) #5

@Dargon789

Description

@Dargon789

Reviewer's Guide

Introduces a comprehensive CircleCI deployment pipeline (deploy.yml) that builds and publishes each package in the monorepo to NPM for both production (main) and staging/alpha (develop) branches, with caching, gating on alpha version tags, and per-package Node images and workflows.

Flow diagram for production package job (build-)

flowchart TD
  A[Start production job build-<package>] --> B[Checkout repo into ~/web3-onboard-monorepo/<package-path>]
  B --> C[Restore build.flag cache by package.json checksum]
  C --> D{build.flag exists}
  D -->|yes| E[Halt job early]
  D -->|no| F[Test package version for alpha tag break true]

  F --> G{package.json version contains -alpha}
  G -->|yes| H[Echo true]
  H --> I[Halt job early]
  G -->|no| J[Echo false]
  J --> K[Generate yarn.lock for workspace]

  K --> L[Restore dependencies cache by yarn.lock checksum]
  L --> M[Run yarn]
  M --> N[Run yarn type-check]
  N --> O[Run yarn build]
  O --> P[Save dependencies cache]

  P --> Q[Create ~/.npmrc with npm_TOKEN]
  Q --> R[npm publish --access public]

  R --> S[Create build.flag file]
  S --> T[Save build.flag to cache keyed by package.json checksum]
  T --> U[End production job]
Loading

Flow diagram for staging/alpha package job (build-staging-)

flowchart TD
  A[Start staging job build-staging-<package>] --> B[Checkout repo into ~/web3-onboard-monorepo/<package-path>]
  B --> C[Restore build.flag cache by package.json checksum]
  C --> D{build.flag exists}
  D -->|yes| E[Halt job early]
  D -->|no| F[Test package version for alpha tag break false]

  F --> G{package.json version contains -alpha}
  G -->|yes| H[Echo true]
  G -->|no| I[Echo false]
  I --> J[Halt job early]

  H --> K[Generate yarn.lock for workspace]
  K --> L[Restore dependencies cache by yarn.lock checksum]
  L --> M[Run yarn]
  M --> N[Run yarn type-check]
  N --> O[Run yarn build]
  O --> P[Save dependencies cache]

  P --> Q[Create ~/.npmrc with npm_TOKEN]
  Q --> R[npm publish --tag next --access public]

  R --> S[Create build.flag file]
  S --> T[Save build.flag to cache keyed by package.json checksum]
  T --> U[End staging job]
Loading

File-Level Changes

Change Details Files
Add reusable build and publish command chains with alpha-version gating and build flag optimization.
  • Define aliases for Docker images, alpha-tag checks, cache restoration/saving, lockfile generation, and npm publishing behaviors (normal and next tag).
  • Introduce node-build-steps and node-staging-build-steps commands that checkout a package, skip if a build flag cache exists, enforce alpha-version rules differently for main vs develop, install dependencies, type-check, build, and publish to NPM.
  • Add a build flag mechanism (file + cache) to prevent repeated builds/publishes across jobs keyed by package.json checksum.
.circleci/deploy.yml
Configure per-package CircleCI jobs using appropriate Node versions and shared build commands.
  • Create individual build jobs for each package under packages/*, setting the working_directory per package and choosing specific cimg/node versions where needed (e.g., ledger, walletconnect, metamask, trezor, particle).
  • Wire each job to use either node-build-steps (production) or node-staging-build-steps (staging) to keep job definitions minimal and consistent.
.circleci/deploy.yml
Define workflows to run per-package production and staging builds based on branch filters.
  • Set up deploy_production_filters and deploy_staging_filters aliases to scope jobs to main and develop branches respectively.
  • Create a workflow per package (e.g., core, common, walletconnect, metamask, etc.) that runs both the production and staging jobs with the appropriate branch filters.
  • Ensure that each package is built and published independently, enabling fine-grained control and visibility per module in CircleCI.
.circleci/deploy.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Originally posted by @sourcery-ai[bot] in #3 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions