Skip to content

Conversation

nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Sep 2, 2025

Description

Title (-:

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Chores
    • Updated build configuration to optimize watch mode and reduce development overhead.
    • Type declaration generation is now conditional: produced for production builds and triggered after successful watch runs.
    • Ensures published packages continue to include type definitions.
    • Added a placeholder changeset entry for release tracking.

Copy link

changeset-bot bot commented Sep 2, 2025

🦋 Changeset detected

Latest commit: aa28c12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

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

Not sure what this means? Click here to learn what changesets are.

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

Copy link
Contributor

coderabbitai bot commented Sep 2, 2025

Walkthrough

The tsup configuration in packages/types/tsup.config.ts now accepts an overrideOptions argument, toggles dts based on overrideOptions.watch, and sets onSuccess to run pnpm build:declarations when watch mode is enabled.

Changes

Cohort / File(s) Summary
tsup config: watch-aware settings
packages/types/tsup.config.ts
Default export signature changed to accept overrideOptions; dts set to !overrideOptions.watch; onSuccess set to 'pnpm build:declarations' when overrideOptions.watch is true, otherwise undefined.
changeset placeholder
.changeset/green-dingos-flow.md
New changeset file added containing placeholder content (---), no runtime or API changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Dev as Developer (runs tsup)
  participant TSUP as tsup defineConfig
  participant Build as Build Process
  participant Scripts as pnpm scripts

  Dev->>TSUP: invoke with overrideOptions
  alt overrideOptions.watch == true
    TSUP->>Build: set dts = false
    TSUP->>Build: set onSuccess = "pnpm build:declarations"
    Build->>Scripts: trigger onSuccess command after successful build
    Scripts-->>Build: run build:declarations
  else overrideOptions.watch == false
    TSUP->>Build: set dts = true
    TSUP->>Build: onSuccess = undefined
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

I twitch my nose at watchful code,
Flip dts when builds are flowed.
On success I hop to spin declarations bright,
A tiny rabbit keeps the types just right. 🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nikos/attempt-to-fix-dev-declaration-maps

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

vercel bot commented Sep 2, 2025

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

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Sep 2, 2025 11:49am

Copy link
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.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/types/tsup.config.ts (2)

3-3: Type the callback parameter for clarity and consistency with guidelines

Explicitly type the callback param; aligns with “explicit types” guidance and improves IDE hints.

-export default defineConfig(overrideOptions => {
+export default defineConfig((overrideOptions: Options) => {

Additionally (outside the selected range), update the import:

import { defineConfig, type Options } from 'tsup';

14-14: Use a dts object to improve type path resolution when not watching

Helps with path aliases and more predictable type outputs during non-watch builds.

-    dts: !overrideOptions.watch,
+    dts: overrideOptions.watch ? false : { resolve: true },

Confirm your tsup version supports dts: { resolve: true }.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e9f538a and 336d210.

📒 Files selected for processing (1)
  • packages/types/tsup.config.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/types/tsup.config.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/types/tsup.config.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/tsup.config.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/types/tsup.config.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/types/tsup.config.ts
packages/*/tsup.config.{js,ts}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

TypeScript compilation and bundling must use tsup.

Files:

  • packages/types/tsup.config.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/types/tsup.config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/types/tsup.config.ts (1)

8-8: Confirm script presence; verify declaration output path

packages/types/package.json already defines "build:declarations": "tsc -p tsconfig.declarations.json". Double-check that tsconfig.declarations.json’s outDir or declarationDir points outside src (e.g. dist or types) to prevent watch-loop writes.

Copy link

pkg-pr-new bot commented Sep 2, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6683

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6683

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6683

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6683

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6683

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6683

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6683

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6683

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6683

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6683

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6683

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6683

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6683

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6683

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6683

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6683

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6683

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6683

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6683

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6683

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6683

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6683

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6683

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6683

commit: aa28c12

Copy link
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.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 336d210 and aa28c12.

📒 Files selected for processing (1)
  • .changeset/green-dingos-flow.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/green-dingos-flow.md
🪛 LanguageTool
.changeset/green-dingos-flow.md

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Static analysis
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: semgrep-cloud-platform/scan

Comment on lines +1 to +2
---
---
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Empty changeset: missing package bump and summary (will break release automation).

Populate the frontmatter with the affected package(s) and a version bump, plus a brief summary.

Apply something like the following (adjust package list and bump as needed):

----
----
+---
+'@clerk/types': patch
+---
+
+fix(types): conditionally generate declarations in watch mode in tsup config
+– Generate d.ts only when not watching; in watch, run `pnpm build:declarations` via `onSuccess`.

If additional packages are impacted by the change in build artifacts, include them in the frontmatter as well.


🏁 Script executed:

#!/bin/bash
FILE=".changeset/green-dingos-flow.md"
if [ -f "$FILE" ]; then
  sed -n '1,20p' "$FILE"
else
  echo "File not found: $FILE"
fi

Length of output: 138


Add package bump and summary to changeset frontmatter
The .changeset/green-dingos-flow.md frontmatter is empty (shown as ---\n---), which will break release automation. Specify the affected package(s) with their bump level and include a concise summary. For example:

---
'@clerk/types': patch
---
fix(types): conditionally generate declarations in watch mode in tsup config
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
---
---
---
'@clerk/types': patch
---
fix(types): conditionally generate declarations in watch mode in tsup config
🧰 Tools
🪛 LanguageTool

[grammar] ~1-~1: Hier könnte ein Fehler sein.
Context: --- ---

(QB_NEW_DE)

🤖 Prompt for AI Agents
In .changeset/green-dingos-flow.md around lines 1 to 2 the frontmatter is empty
("---\n---"), which breaks release tooling; replace the empty frontmatter with
proper changeset metadata by listing the affected package(s) and their version
bump level (major/minor/patch) and add a short summary line under the
frontmatter — e.g., set a package array with its bump type and then a concise
summary sentence — ensuring the file begins with the frontmatter block followed
by the summary text.

@nikosdouvlis nikosdouvlis merged commit 838b83e into main Sep 2, 2025
39 checks passed
@nikosdouvlis nikosdouvlis deleted the nikos/attempt-to-fix-dev-declaration-maps branch September 2, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants