fix(upgrade): improve CLI usability for monorepos and CI#7874
fix(upgrade): improve CLI usability for monorepos and CI#7874jacekradko wants to merge 5 commits intomainfrom
Conversation
- Traverse parent directories for lockfiles and packageManager field in package.json - Add -w flag for pnpm install/remove at workspace roots - Resolve catalog: protocol versions from pnpm-workspace.yaml - Show actionable example commands in non-interactive error messages - Pass verbose: 0 to jscodeshift for error-level file path logging
🦋 Changeset detectedLatest commit: ece7ff1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughAdds Next.js test fixtures and expands integration tests. Introduces resolveCatalogVersion to traverse parent directories and read pnpm-workspace.yaml; getSdkVersion now consults catalog resolutions. Enhances package-manager detection to traverse upward, adds isInPnpmWorkspace, and updates getInstallCommand/getUninstallCommand/upgradePackage/removePackage to accept cwd and append pnpm -w when in a workspace. Improves CLI non-interactive error messages with example usage. Passes verbose: 0 to codemod runs and changes runner/rendering to report codemod errors separately. 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/upgrade/src/util/detect-sdk.js`:
- Around line 52-77: Add a JSDoc block above the exported function
resolveCatalogVersion(packageName, dir) that documents it as a public API:
describe both parameters (packageName: string — package identifier to search
for; dir: string — starting directory to traverse upward), explain traversal
behavior (walks parent directories until the filesystem root looking for
pnpm-workspace.yaml), explain parsing behavior (reads the file, matches catalog
entries using the existing regex to extract the version for the given package
name), and state the return value and semantics (returns the matched version
string or null if not found or on read/parse errors). Also include
`@export/`@returns/@param tags and mention that errors are swallowed and result in
null.
- Around line 52-67: resolveCatalogVersion currently searches the entire
pnpm-workspace.yaml for the package name and returns the first match, which
returns wrong versions for named catalogs; update getSdkVersion to extract the
catalog name from the incoming version string (e.g., "catalog:peer-react" →
"peer-react") and pass that catalogName into resolveCatalogVersion, and then
change resolveCatalogVersion to first locate the specific catalog section (e.g.,
a YAML mapping like "catalog.<name>:" or "catalog:\n <name>:") and restrict the
package-version regex search to only that section before matching the
packageName, ensuring the returned version comes from the requested catalog;
reference the functions getSdkVersion and resolveCatalogVersion and the
variables packageName and version string when wiring this change.
|
!snapshot |
|
Hey @jacekradko - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/agent-toolkit@0.3.0-snapshot.v20260220160119 --save-exact
npm i @clerk/astro@3.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/backend@3.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/chrome-extension@3.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/clerk-js@6.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/dev-cli@1.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/expo@3.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/expo-passkeys@1.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/express@2.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/fastify@2.7.0-snapshot.v20260220160119 --save-exact
npm i @clerk/localizations@4.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/msw@0.0.1-snapshot.v20260220160119 --save-exact
npm i @clerk/nextjs@7.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/nuxt@2.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/react@6.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/react-router@3.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/shared@4.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/tanstack-react-start@1.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/testing@2.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/ui@1.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/upgrade@2.0.0-snapshot.v20260220160119 --save-exact
npm i @clerk/vue@2.0.0-snapshot.v20260220160119 --save-exact |
Summary
detectPackageManager()now walks up the directory tree to find lockfiles and thepackageManagerfield inpackage.json(Corepack), fixing detection in monorepo subdirectories-wflag:getInstallCommand()andgetUninstallCommand()automatically add-wwhen the target directory containspnpm-workspace.yaml, preventing "Running this command will add the dependency to the workspace root" errorscatalog:protocol versions:getSdkVersion()now resolvescatalog:version specifiers by parsingpnpm-workspace.yamlcatalogs, enabling automatic version detection without requiring--releaseverbose: 0to jscodeshift so error-level logging (file paths + error messages) is printed instead of being swallowed; usesspinner.error()when errors occurTest plan
pnpm buildsucceedsnpx @clerk/upgrade --sdk=nextjs --dir=<monorepo-subdirectory>and verify package manager is detected from parentcatalog:protocol and verify version is resolved--sdkand verify error shows example commandSummary by CodeRabbit
New Features
Improvements
Tests