Skip to content

feat(tools): add Rush monorepo support#176

Open
clanzhang wants to merge 1 commit into
antfu:mainfrom
clanzhang:feat/rush-monorepo-support
Open

feat(tools): add Rush monorepo support#176
clanzhang wants to merge 1 commit into
antfu:mainfrom
clanzhang:feat/rush-monorepo-support

Conversation

@clanzhang

Copy link
Copy Markdown

Description

Closes #139

Add support for Rush monorepos by detecting
rush.json and using rush-pnpm as the executable in the pnpm agent.

How it works

Rush provides rush-pnpm — a transparent wrapper around the user's
pnpm binary that configures it to work within the Rush monorepo.
Since rush-pnpm accepts the same CLI arguments as pnpm, we only
need to swap the executable.

Detection strategy:

  1. Before falling back to package-manager-detector, check for
    rush.json by traversing up from cwd.
  2. If found, set options.rush = true and return 'pnpm' as the agent.
  3. The pnpm agent reads options.rush and uses rush-pnpm instead of pnpm.

Changes

  • types/base.ts — Add optional rush?: boolean to BaseOptions
  • utils/rush.ts — New module: isRushMonorepo() and findRushRoot()
  • agent-entry/detect.ts — Pre-check for Rush before package-manager-detector
  • agents/pnpm/list.ts — Resolve executable dynamically via resolveExecutable()

Notes

  • rush-pnpm is CLI-compatible with pnpm, so pnpm ls, pnpm root, etc.
    work identically. No argument construction logic changes.
  • getCatalogs() returns {} automatically for Rush projects since they
    don't have pnpm-workspace.yaml.
  • No new dependency is introduced.

Validations

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

feat: add support for rush monorepos

1 participant