Skip to content

chore(monorepo): remove versions from private workspaces#7306

Open
KATT wants to merge 2 commits intomainfrom
cursor/repository-versioning-changes-e0d3
Open

chore(monorepo): remove versions from private workspaces#7306
KATT wants to merge 2 commits intomainfrom
cursor/repository-versioning-changes-e0d3

Conversation

@KATT
Copy link
Copy Markdown
Member

@KATT KATT commented Mar 30, 2026

Closes #

🎯 Changes

Remove the redundant version field from private/non-published workspace packages.

Update scripts/version.ts because it previously assumed every package in packages/* declared a local version. Once private workspaces like @trpc/tests stop carrying that field, the script still needs a version source for pinning @trpc/* dependencies, so it now falls back to the repo version from lerna.json.

✅ Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Chores
    • Updated package version management configuration across example projects and the build system.

Co-authored-by: alexander <alexander@n1s.se>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

📝 Walkthrough

Walkthrough

This PR removes hardcoded "version": "11.16.0" fields from 40+ package.json files across the monorepo and updates the version script to derive fallback versions from lerna.json when packages lack explicit version fields.

Changes

Cohort / File(s) Summary
Example package manifests
examples/.experimental/next-app-dir/package.json, examples/.test/*/package.json, examples/bun/package.json, examples/cloudflare-workers/package.json, examples/express-*/package.json, examples/fastify-server/package.json, examples/lambda-*/package.json, examples/lazy-load/package.json, examples/minimal-*/package.json, examples/next-*/package.json, examples/openapi-codegen/package.json, examples/soa/package.json, examples/standalone-server/package.json, examples/vercel-edge-runtime/package.json
Removed "version": "11.16.0" field from all example package.json files; JSON structure adjusted accordingly.
Core monorepo package manifests
packages/tests/package.json, www/package.json, www/og-image/package.json
Removed "version": "11.16.0" field from core and website package manifests.
Version script update
scripts/version.ts
Enhanced script to read lerna.json and use repository version as fallback when individual packages lack explicit version fields; affects downstream version resolution for prerelease suffixes and dependency pinning.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Suggested reviewers

  • juliusmarminge

Poem

🐰 Hop hop, the versions do depart,
From forty files, a cleaner start,
Lerna takes the helm with grace,
One source of truth sets the pace!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: removing version fields from private workspace package.json files across the monorepo.
Description check ✅ Passed The description covers the key changes with specific context about why the script was updated, though test-related checklist items remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/repository-versioning-changes-e0d3

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 30, 2026

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

Project Deployment Actions Updated (UTC)
next-prisma-starter Ready Ready Preview Mar 30, 2026 1:41pm
og-image Ready Ready Preview, Comment Mar 30, 2026 1:41pm

Request Review

@railway-app
Copy link
Copy Markdown

railway-app bot commented Mar 30, 2026

🚅 Deployed to the trpc-pr-7306 environment in trpc-sse-and-websockets

Service Status Web Updated (UTC)
next-sse-chat 😴 Sleeping (View Logs) Web Apr 9, 2026 at 10:53 pm
next-prisma-websockets-starter 😴 Sleeping (View Logs) Mar 30, 2026 at 2:03 pm

@cursor cursor bot changed the title Remove versions from private workspaces chore(monorepo): remove versions from private workspaces Mar 30, 2026
@KATT KATT marked this pull request as ready for review March 30, 2026 13:40
@KATT KATT requested review from a team as code owners March 30, 2026 13:40
Copilot AI review requested due to automatic review settings March 30, 2026 13:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes redundant version fields from private/non-published workspace packages, and updates the version-pinning script so it can still derive a version when a workspace package no longer declares one.

Changes:

  • Removed version from multiple private workspace package.json files (examples, tests, docs site).
  • Updated scripts/version.ts to fall back to the monorepo version in lerna.json when a package lacks a local version.

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated no comments.

Show a summary per file
File Description
www/package.json Remove redundant version from a private workspace package.
www/og-image/package.json Remove redundant version from a private workspace package.
scripts/version.ts Fall back to lerna.json version when packages/*/package.json has no version, preserving @trpc/* dependency pinning.
packages/tests/package.json Remove redundant version from a private workspace package.
examples/vercel-edge-runtime/package.json Remove redundant version from a private workspace package.
examples/standalone-server/package.json Remove redundant version from a private workspace package.
examples/soa/package.json Remove redundant version from a private workspace package.
examples/openapi-codegen/package.json Remove redundant version from a private workspace package.
examples/next-websockets-encoder/package.json Remove redundant version from a private workspace package.
examples/next-sse-chat/package.json Remove redundant version from a private workspace package.
examples/next-prisma-websockets-starter/package.json Remove redundant version from a private workspace package.
examples/next-prisma-todomvc/package.json Remove redundant version from a private workspace package.
examples/next-prisma-starter/package.json Remove redundant version from a private workspace package.
examples/next-minimal-starter/package.json Remove redundant version from a private workspace package.
examples/next-formdata/package.json Remove redundant version from a private workspace package.
examples/next-edge-runtime/package.json Remove redundant version from a private workspace package.
examples/next-big-router/package.json Remove redundant version from a private workspace package.
examples/minimal/package.json Remove redundant version from a private workspace package.
examples/minimal-react/server/package.json Remove redundant version from a private workspace package.
examples/minimal-react/package.json Remove redundant version from a private workspace package.
examples/minimal-react/client/package.json Remove redundant version from a private workspace package.
examples/minimal-content-types/server/package.json Remove redundant version from a private workspace package.
examples/minimal-content-types/package.json Remove redundant version from a private workspace package.
examples/minimal-content-types/client/package.json Remove redundant version from a private workspace package.
examples/lazy-load/package.json Remove redundant version from a private workspace package.
examples/lambda-url/package.json Remove redundant version from a private workspace package.
examples/lambda-api-gateway/package.json Remove redundant version from a private workspace package.
examples/lambda-api-gateway-streaming/package.json Remove redundant version from a private workspace package.
examples/fastify-server/package.json Remove redundant version from a private workspace package.
examples/express-server/package.json Remove redundant version from a private workspace package.
examples/express-minimal/package.json Remove redundant version from a private workspace package.
examples/cloudflare-workers/package.json Remove redundant version from a private workspace package.
examples/bun/package.json Remove redundant version from a private workspace package.
examples/.test/ssg/package.json Remove redundant version from a private workspace package.
examples/.test/ssg-infinite-serialization/package.json Remove redundant version from a private workspace package.
examples/.test/monotest-tsconfig/package.json Remove redundant version from a private workspace package.
examples/.test/monotest-trpc/package.json Remove redundant version from a private workspace package.
examples/.test/monotest-app/package.json Remove redundant version from a private workspace package.
examples/.test/monotest-api/package.json Remove redundant version from a private workspace package.
examples/.test/monotest-api-router01/package.json Remove redundant version from a private workspace package.
examples/.test/internal-types-export/package.json Remove redundant version from a private workspace package.
examples/.test/diagnostics-big-router/package.json Remove redundant version from a private workspace package.
examples/.experimental/next-app-dir/package.json Remove redundant version from a private workspace package.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 30, 2026

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/@trpc/client@7306

@trpc/next

npm i https://pkg.pr.new/@trpc/next@7306

@trpc/openapi

npm i https://pkg.pr.new/@trpc/openapi@7306

@trpc/react-query

npm i https://pkg.pr.new/@trpc/react-query@7306

@trpc/server

npm i https://pkg.pr.new/@trpc/server@7306

@trpc/tanstack-react-query

npm i https://pkg.pr.new/@trpc/tanstack-react-query@7306

@trpc/upgrade

npm i https://pkg.pr.new/@trpc/upgrade@7306

commit: 622797b

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
scripts/version.ts (1)

6-8: Validate lerna.json version before using it.

as string here can mask malformed config and fail later in less obvious places. A small guard makes failures immediate and clearer.

Proposed hardening
-const repoVersion = JSON.parse(
-  fs.readFileSync(path.join(import.meta.dirname, '..', 'lerna.json'), 'utf8'),
-).version as string;
+const lernaConfig = JSON.parse(
+  fs.readFileSync(path.join(import.meta.dirname, '..', 'lerna.json'), 'utf8'),
+) as { version?: unknown };
+
+if (typeof lernaConfig.version !== 'string' || lernaConfig.version.length === 0) {
+  throw new Error('Invalid lerna.json: expected non-empty string "version"');
+}
+
+const repoVersion = lernaConfig.version;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/version.ts` around lines 6 - 8, The code assigns repoVersion using a
blind cast ("as string") which can hide malformed lerna.json; change the
repoVersion initialization (the variable assigned from
fs.readFileSync/JSON.parse) to perform a runtime check that the parsed object
has a truthy string property "version" (e.g., typeof parsed.version === 'string'
&& parsed.version.trim() !== ''), and if not throw or log a clear error
mentioning "lerna.json version missing or invalid" before proceeding; remove the
unsafe "as string" cast and use the validated value for the rest of the script.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/version.ts`:
- Around line 6-8: The code assigns repoVersion using a blind cast ("as string")
which can hide malformed lerna.json; change the repoVersion initialization (the
variable assigned from fs.readFileSync/JSON.parse) to perform a runtime check
that the parsed object has a truthy string property "version" (e.g., typeof
parsed.version === 'string' && parsed.version.trim() !== ''), and if not throw
or log a clear error mentioning "lerna.json version missing or invalid" before
proceeding; remove the unsafe "as string" cast and use the validated value for
the rest of the script.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 956df7ce-da9d-448f-a7f0-85aba8fce69c

📥 Commits

Reviewing files that changed from the base of the PR and between 19c599c and 622797b.

📒 Files selected for processing (43)
  • examples/.experimental/next-app-dir/package.json
  • examples/.test/diagnostics-big-router/package.json
  • examples/.test/internal-types-export/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/.test/monotest-api/package.json
  • examples/.test/monotest-app/package.json
  • examples/.test/monotest-trpc/package.json
  • examples/.test/monotest-tsconfig/package.json
  • examples/.test/ssg-infinite-serialization/package.json
  • examples/.test/ssg/package.json
  • examples/bun/package.json
  • examples/cloudflare-workers/package.json
  • examples/express-minimal/package.json
  • examples/express-server/package.json
  • examples/fastify-server/package.json
  • examples/lambda-api-gateway-streaming/package.json
  • examples/lambda-api-gateway/package.json
  • examples/lambda-url/package.json
  • examples/lazy-load/package.json
  • examples/minimal-content-types/client/package.json
  • examples/minimal-content-types/package.json
  • examples/minimal-content-types/server/package.json
  • examples/minimal-react/client/package.json
  • examples/minimal-react/package.json
  • examples/minimal-react/server/package.json
  • examples/minimal/package.json
  • examples/next-big-router/package.json
  • examples/next-edge-runtime/package.json
  • examples/next-formdata/package.json
  • examples/next-minimal-starter/package.json
  • examples/next-prisma-starter/package.json
  • examples/next-prisma-todomvc/package.json
  • examples/next-prisma-websockets-starter/package.json
  • examples/next-sse-chat/package.json
  • examples/next-websockets-encoder/package.json
  • examples/openapi-codegen/package.json
  • examples/soa/package.json
  • examples/standalone-server/package.json
  • examples/vercel-edge-runtime/package.json
  • packages/tests/package.json
  • scripts/version.ts
  • www/og-image/package.json
  • www/package.json
💤 Files with no reviewable changes (6)
  • examples/.test/monotest-tsconfig/package.json
  • examples/.test/monotest-api-router01/package.json
  • examples/.test/monotest-api/package.json
  • examples/.test/monotest-trpc/package.json
  • examples/.test/ssg-infinite-serialization/package.json
  • examples/.test/monotest-app/package.json

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.

5 participants