feat(tools): add Rush monorepo support#176
Open
clanzhang wants to merge 1 commit into
Open
Conversation
Add Rush monorepo detection and route pnpm agent to use when running inside a Rush workspace. Rush provides as a CLI-compatible wrapper around pnpm, so only the executable name needs to change — no argument construction logic is affected. - Add to BaseOptions - Add with isRushMonorepo() and findRushRoot() - Pre-check for rush.json in getPackageManager() before package-manager-detector - Resolve pnpm executable dynamically in pnpm agent based on options.rush Closes antfu#139
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #139
Add support for Rush monorepos by detecting
rush.jsonand usingrush-pnpmas the executable in the pnpm agent.How it works
Rush provides
rush-pnpm— a transparent wrapper around the user'spnpmbinary that configures it to work within the Rush monorepo.Since
rush-pnpmaccepts the same CLI arguments aspnpm, we onlyneed to swap the executable.
Detection strategy:
package-manager-detector, check forrush.jsonby traversing up fromcwd.options.rush = trueand return'pnpm'as the agent.options.rushand usesrush-pnpminstead ofpnpm.Changes
types/base.ts— Add optionalrush?: booleantoBaseOptionsutils/rush.ts— New module:isRushMonorepo()andfindRushRoot()agent-entry/detect.ts— Pre-check for Rush beforepackage-manager-detectoragents/pnpm/list.ts— Resolve executable dynamically viaresolveExecutable()Notes
rush-pnpmis CLI-compatible withpnpm, sopnpm ls,pnpm root, etc.work identically. No argument construction logic changes.
getCatalogs()returns{}automatically for Rush projects since theydon't have
pnpm-workspace.yaml.Validations