Skip to content

feat: extract React integration into graph-react - #343

Merged
draedful merged 1 commit into
v2from
codex/graph-react
Sep 10, 2026
Merged

feat: extract React integration into graph-react#343
draedful merged 1 commit into
v2from
codex/graph-react

Conversation

@draedful

@draedful draedful commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

React components, hooks, styles, and tests now belong to @gravity-ui/graph-react. The core @gravity-ui/graph package has no React or ELK runtime dependency, and the React package consumes core through its public entrypoint with a required peer dependency.

For v2 consumers, replace imports from @gravity-ui/graph/react with @gravity-ui/graph-react and import both @gravity-ui/graph/styles.css and @gravity-ui/graph-react/styles.css. The old React subpath is removed. Storybook, E2E applications, and current documentation follow this contract.

The shared build pipeline enforces package source ownership. Packed-package checks install isolated consumers, reject internal core imports and private scheduler leaks, and verify that Graph, Layer, and connection constructors retain their identity across packages. Release Please registration is included for the new package; publishing remains a separate step.

Validation: lint and all workspace typechecks; 349 passing unit tests and 39 release-contract tests; strict packed artifact/type/runtime/browser checks for both packages, including reuse of the supplied core tarball; all 186 E2E tests; Storybook production build; frozen offline dependency installation.

Summary by Sourcery

Extract the React integration into @gravity-ui/graph-react while keeping @gravity-ui/graph framework-independent and validating both packages as isolated public artifacts.

New Features:

  • Add the standalone @gravity-ui/graph-react package for React components, hooks, layouts, and styles.
  • Expose framework-independent graph APIs from @gravity-ui/graph without React, React DOM, or ELK runtime dependencies.

Enhancements:

  • Define a public package boundary in which React consumes core through its public entrypoint and preserves shared runtime class identity.
  • Replace the removed @gravity-ui/graph/react subpath across applications, examples, and documentation with the new package and stylesheet imports.
  • Centralize package builds and enforce source ownership, dependency isolation, and published artifact constraints.

Build:

  • Add shared package build tooling for independently building the core and React packages.

CI:

  • Expand isolated packed-package contract checks to validate core and React artifacts, types, runtime behavior, browser integration, and supplied dependency tarballs.

Deployment:

  • Register @gravity-ui/graph-react with Release Please.

Documentation:

  • Document installation, package boundaries, stylesheet requirements, and v1-to-v2 React import migration.

Tests:

  • Move React unit tests with the integration package and extend end-to-end and package-contract coverage for both public packages.

Chores:

  • Update Storybook, E2E applications, workspace scripts, and development workflows for the split packages.

@sourcery-ai

sourcery-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR splits the React integration into @gravity-ui/graph-react, leaving @gravity-ui/graph framework-independent and exposing the required APIs through its public entrypoint. It adds a shared build pipeline and comprehensive packed-artifact contract tests to enforce package ownership, peer dependency boundaries, runtime identity, styles, and consumer compatibility, then migrates applications and documentation to the new imports and stylesheet contract.

File-Level Changes

Change Details Files
Extracted the React integration into a standalone public package with a core peer dependency.
  • Moved React components, hooks, ReactLayer, layered-layout hook, tests, and React-owned styles into the new package.
  • Changed React source imports to consume only @gravity-ui/graph public exports.
  • Added React package exports, peer dependencies, build metadata, README, and release registration.
  • Removed the @gravity-ui/graph/react export and React runtime dependencies from core.
packages/graph-react/**
packages/graph/package.json
packages/graph/src/react-components/**
packages/graph/src/index.ts
packages/graph/src/styles.css
release-please-config.json
.release-please-manifest.json
Expanded the core public API and centralized package build enforcement to support the package boundary.
  • Re-exported types, scheduler helpers, camera APIs, layered-layout primitives, and other symbols required by the React package.
  • Moved the shared esbuild, declaration-rewrite, package-ownership, and private scheduler checks into scripts/build-package.mjs.
  • Updated core and React build scripts to produce isolated browser, type, and published artifacts.
scripts/build-package.mjs
packages/graph/scripts/build.mjs
packages/graph/src/plugins/layered/index.ts
packages/graph/src/utils/functions/index.ts
packages/graph/src/index.ts
package.json
Reworked package-contract validation around independently packed core and React artifacts.
  • Added isolated vanilla and React consumers covering metadata, exports, strict declarations, native runtime identity, dependency absence, styles, and browser behavior.
  • Added checks for the removed React subpath, required peer dependencies, source ownership, and cross-package Graph, Layer, connection, and signal interoperability.
  • Added support for validating React against a supplied core tarball.
tests/package-contract/**
packages/graph/tests/package-contract/**
packages/graph/scripts/check-playwright-consumer-types.mjs
Migrated applications, documentation, and examples to the new React package contract.
  • Replaced legacy React subpath imports throughout Storybook, E2E fixtures, guides, READMEs, and development instructions.
  • Loaded core and React stylesheets separately in React applications.
  • Updated build, dev, typecheck, and E2E workflows to build and consume both public packages.
apps/e2e/**
apps/storybook/**
packages/graph/README.md
packages/graph/README-ru.md
packages/graph/docs/**
README.md
CLAUDE.md
.github/workflows/e2e.yml

Possibly linked issues

  • #Stage 1.4: The PR directly delivers Stage 1.4 by normalizing builds, separating React, defining exports, and validating packed consumers.

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. This changes the published package boundary, React import path, stylesheet ownership, peer dependencies, and build/declaration contracts, so an error could break React consumers at installation, build, or runtime. Reverting restores the repository implementation, but it would not fully undo external consumers that have already adopted the new package and imports.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@gravity-ui-bot

Copy link
Copy Markdown
Contributor

Preview is ready.

@draedful
draedful merged commit 7ed145e into v2 Sep 10, 2026
8 checks passed
@gravity-ui gravity-ui Bot mentioned this pull request Sep 10, 2026
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.

2 participants