Skip to content

build: nx build caching, dependency-cruiser deps lint, ts emits#9100

Open
mikehardy wants to merge 9 commits into
mainfrom
monorepo-tooling
Open

build: nx build caching, dependency-cruiser deps lint, ts emits#9100
mikehardy wants to merge 9 commits into
mainfrom
monorepo-tooling

Conversation

@mikehardy

Copy link
Copy Markdown
Collaborator

Summary

  • Nx local prepare cacheyarn lerna:prepare runs through the Lerna/Nx runner with scoped inputs, declared outputs, and CI .nx/cache (no Nx Cloud); devDependency graph enforces build order across 17 packages.
  • dependency-cruiser lint:deps — cycles, relative-dist imports, and hub/satellite import boundaries are linted in CI via yarn lint.
  • TypeScript declaration maps — package builds emit declarationMap for IDE go-to-definition into lib/ sources.
  • Jest AI mock gating — global setup skips network fetches on non-AI test runs; Jest 30 --testPathPatterns handled.
  • Benchmark scriptscripts/benchmark-prepare.sh captures cold install, full rebuild, no-op, and single-package edit scenarios.

Prepare benchmark (macOS, scripts/benchmark-prepare.sh)

Scenario Name Pre-Nx median (s) Post-Nx median (s) Speedup
A Cold install 125.6 95.1 ~1.3×
B Full rebuild 23.7 1.9 ~12.6×
C No-op rebuild 23.7 1.4 ~16.8×
D Single-package edit 23.8 1.5* ~16.3×

*Scenario D first run is a cache miss (~5.3s); median uses warm cache hits on iterations 2–3.

Test plan

  • yarn lerna:prepare deterministic (Nx cache hits on repeat)
  • yarn lint (incl. lint:deps), yarn tsc:compile, yarn compare:types, yarn tests:jest
  • Full-tier e2e: macOS 710/0/34, iOS 848/0/85, Android 878/0/54

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces significant improvements to the monorepo build infrastructure by integrating Nx for local computation caching and formalizing the package dependency graph. These changes, combined with new dependency-cycle linting and TypeScript declaration maps, enhance build reliability, developer productivity, and IDE support. The PR also includes comprehensive documentation for these new tooling decisions and a benchmark script to validate the performance gains.

Highlights

  • Nx Build Caching: Implemented local Nx computation caching via nx.json to significantly accelerate rebuilds and prepare tasks, with neverConnectToCloud enabled for local-only operation.
  • Dependency Linting: Introduced dependency-cruiser as yarn lint:deps to enforce architectural boundaries, prevent circular dependencies, and restrict cross-package imports.
  • TypeScript Improvements: Enabled declarationMap in package builds to support IDE go-to-definition functionality directly into the source code.
  • Build Graph Optimization: Encoded the build graph using devDependencies to ensure deterministic, correctly-ordered package builds across the monorepo.
  • Test Infrastructure: Gated AI mock network fetches to run only during AI-specific test runs, improving determinism and cacheability of the prepare task.
Ignored Files
  • Ignored by pattern: .github/workflows/** (5)
    • .github/workflows/linting.yml
    • .github/workflows/tests_e2e_android.yml
    • .github/workflows/tests_e2e_ios.yml
    • .github/workflows/tests_e2e_other.yml
    • .github/workflows/tests_jest.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces monorepo tooling enhancements for React Native Firebase, including the integration of Nx local caching, deterministic build ordering via devDependencies, dependency-cycle linting with dependency-cruiser, and TypeScript declaration maps. Additionally, AI test mock fetching is moved to a gated Jest global setup to ensure build determinism, and a benchmark script is added. The review feedback is highly constructive and should be fully addressed: it suggests replacing the glob in the dependency linter to support Windows, hardening the Jest global setup argument parsing to prevent redundant mock fetches, replacing deprecated perl invocations with Node.js in the benchmark script, and using standard array indexing instead of .at(0) for backward compatibility.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread package.json Outdated
Comment thread scripts/jest-ai-mocks-global-setup.js Outdated
Comment thread scripts/benchmark-prepare.sh
Comment thread scripts/fetch_ai_mock_responses.ts
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.64%. Comparing base (1bad118) to head (68d318a).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9100      +/-   ##
============================================
- Coverage     58.66%   58.64%   -0.02%     
+ Complexity     1617     1616       -1     
============================================
  Files           503      503              
  Lines         39180    39180              
  Branches       5807     5743      -64     
============================================
- Hits          22981    22973       -8     
+ Misses        14800    14743      -57     
- Partials       1399     1464      +65     
Flag Coverage Δ
android-native 53.56% <ø> (-<0.01%) ⬇️
e2e-ts-android 49.98% <ø> (-0.02%) ⬇️
e2e-ts-ios 53.94% <ø> (-0.01%) ⬇️
e2e-ts-macos 41.49% <ø> (ø)
ios-native 53.94% <ø> (-0.01%) ⬇️
jest 49.58% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Successfully merging this pull request may close these issues.

1 participant