Skip to content

refactor: structure as a monorepo and migrate to Changesets#370

Draft
stipsan wants to merge 5 commits into
currentfrom
cursor/monorepo-changesets-f1dc
Draft

refactor: structure as a monorepo and migrate to Changesets#370
stipsan wants to merge 5 commits into
currentfrom
cursor/monorepo-changesets-f1dc

Conversation

@stipsan

@stipsan stipsan commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Restructures react-rx into a proper pnpm monorepo and replaces the semantic-release release flow with Changesets, mirroring the setup used in the sanity-io/plugins monorepo. Releases now publish to npm through the shared reusable Changesets workflow using npm Trusted Publishing (OIDC) — which is already configured on npm for the release.yml workflow in this repo.

Monorepo structure

The published library moved from the repo root into packages/react-rx, and the root became a private workspace root (react-rx-monorepo).

.
├─ packages/
│  └─ react-rx/        # the published npm package (moved from the repo root)
│     ├─ src/
│     ├─ package.json  # library deps, peerDeps, build/test tooling
│     ├─ package.config.ts, tsconfig*.json, vitest*.ts
│     ├─ CHANGELOG.md  # existing changelog, preserved
│     └─ README.md     # npm-facing readme
├─ website/            # docs site (kept at the repo root — see note below)
├─ .changeset/
├─ package.json        # private root: shared tooling + Changesets, orchestration scripts
└─ pnpm-workspace.yaml # packages/* + website
  • File moves were done with rename detection so history is preserved.
  • Manifests were split: library runtime/build/test deps live in packages/react-rx/package.json; shared tooling (eslint, prettier, typescript) and Changesets tooling live in the root.
  • Root scripts orchestrate via filters: build, test, watchreact-rx; devreact-rx-website; lint/format run across the workspace; releasechangeset publish.

Changesets migration

  • Added .changeset/config.json (@changesets/changelog-github, access: public, baseBranch: current, privatePackages: false).
  • Removed semantic-release: deleted .releaserc.json and dropped semantic-release + @sanity/semantic-release-preset; added @changesets/cli and @changesets/changelog-github.
  • .github/workflows/release.yml — on push to current, calls sanity-io/.github/.github/workflows/changesets.yml@main to open/update the "Version Packages" PR and publish via OIDC trusted publishing (secrets: inherit, id-token: write).
  • .github/workflows/changesets-from-conventional-commits.yml — auto-adds changesets to Renovate (renovate[bot]) and React Compiler (squiggler-legacy[bot]) dependency PRs based on their conventional-commit titles, preserving the previous "dependency fix: updates trigger a release" behavior.
  • .github/workflows/ci.yml — trimmed to build + test (the release job is gone); both jobs use a shared .github/actions/setup composite action.

Release flow after this PR

  1. Add a changeset in a PR: pnpm changeset.
  2. On merge to current, release.yml opens/updates a "Version Packages" PR.
  3. Merging that PR publishes react-rx to npm via trusted publishing (no npm token needed).

This PR itself contains no changeset — it's a repo restructure that doesn't change the published package's code or version (4.2.2), so merging it won't trigger a release.

CI / tooling modernization

  • pnpm/setup@v1 — the shared setup composite action now uses a single pnpm/setup@v1 step in place of pnpm/action-setup + actions/setup-node + pnpm install. Since pnpm/setup manages the Node.js runtime via pnpm runtime (which needs pnpm ≥ 11.1.0), the workspace is bumped to pnpm@11.9.0. The CI test matrix selects the runtime (node@lts / node@latest).
  • pnpm 11 config added to pnpm-workspace.yaml: allowBuilds (esbuild/sharp/es5-ext install scripts) and publicHoistPattern (*eslint*/*prettier*, so @sanity/pkg-utils can resolve prettier-plugin-packagejson at build time).
  • Removed the concurrency group from ci.yml.
  • Deleted setup-trusted-publish.yml and its now-unused setup-npm-trusted-publish dependency.
  • Renamed prettier.ymlformat-if-needed.yml (to ease a future move to oxfmt).

Verification

  • pnpm install (frozen, CI-equivalent) ✅ under pnpm 11.9.0
  • pnpm build ✅ → packages/react-rx/dist
  • pnpm lint
  • pnpm test ✅ (48 tests, default + react-compiler projects)
  • pnpm --filter react-rx-website build ✅ (verifies the website resolves the moved package + dist raw import)

Notes

  • website stays at the repo root (not moved under apps/) to avoid breaking the Vercel deployment, whose root directory is website. It's still a workspace member and now references the package at packages/react-rx. Moving it can be a follow-up alongside a Vercel root-directory change.
  • Branch-based release channels dropped. The old semantic-release config also released a prerelease channel from crx-749 (branch no longer exists) and a 2.x maintenance channel from v2 (dormant since Aug 2023). Like the plugins monorepo, this setup releases only from current; a 2.x maintenance release would need a separate workflow/Changesets pre-release setup if ever required.
  • The vitest.workspace.ts deprecation warning is pre-existing (unrelated to this change).
Open in Web Open in Cursor 

cursoragent and others added 2 commits July 1, 2026 11:09
Move the published library from the repo root into `packages/react-rx` and
turn the root into a private pnpm workspace root (`react-rx-monorepo`). The
`website` app stays at the repo root so the Vercel deployment (root directory
`website`) keeps working.

- Move `src`, build/test config, README and CHANGELOG into `packages/react-rx`
- Split manifests: library deps/build in `packages/react-rx/package.json`,
  shared tooling (eslint, prettier, typescript) + Changesets tooling in the
  root `package.json`
- Add `.changeset/config.json` (changelog-github, baseBranch `current`)
- Replace semantic-release with Changesets: drop `.releaserc.json`,
  `semantic-release` and `@sanity/semantic-release-preset`; add
  `@changesets/cli`, `@changesets/changelog-github`,
  `setup-npm-trusted-publish` and a `release` script
- Update `ci.yml` to a build+test workflow using a shared `setup` composite
  action (the release job is handled by the new release workflow)
- Point the website at the moved package (`next.config.ts`, `Sandpack.tsx`)
- Widen eslint/prettier ignores for nested `dist`

Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
- `release.yml`: on push to `current`, calls the shared
  `sanity-io/.github` Changesets workflow to open/update the "Version
  Packages" PR and publish to npm via OIDC trusted publishing
- `changesets-from-conventional-commits.yml`: auto-adds changesets to
  Renovate and squiggler-legacy (React Compiler) dependency PRs
- `setup-trusted-publish.yml`: helper to register a new package on npm
  with trusted publishing for this repo

Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-rx Ready Ready Preview, Comment Jul 1, 2026 6:50pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 6769cf8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@socket-security

socket-security Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​changesets/​changelog-github@​0.7.01001006893100
Addednpm/​@​changesets/​cli@​2.31.09710010095100

View full report

cursoragent and others added 3 commits July 1, 2026 18:49
Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
Replace `pnpm/action-setup` + `actions/setup-node` + `pnpm install` in the
shared `setup` composite action with a single `pnpm/setup@v1` step, which
installs pnpm, the Node.js runtime and dependencies in one go.

`pnpm/setup` manages the Node.js runtime via `pnpm runtime`, which requires
pnpm >= 11.1.0, so bump the workspace to `pnpm@11.9.0`. pnpm 11 also needs
explicit build-script and hoist configuration:

- `allowBuilds` for the deps that ship install scripts (esbuild/sharp/es5-ext)
- `publicHoistPattern` for `*eslint*`/`*prettier*` so @sanity/pkg-utils can
  resolve `prettier-plugin-packagejson` during the build

Other changes:
- CI test matrix now selects the runtime (`node@lts` / `node@latest`)
- Remove the `concurrency` group from the CI workflow
- Delete the `setup-trusted-publish` workflow and its now-unused
  `setup-npm-trusted-publish` dependency

Co-authored-by: Cody Olsen <stipsan@users.noreply.github.com>
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