fix: detect dependencies from monorepo workspace packages#1868
Open
lucamorettibuilds wants to merge 1 commit intoupstash:masterfrom
Open
fix: detect dependencies from monorepo workspace packages#1868lucamorettibuilds wants to merge 1 commit intoupstash:masterfrom
lucamorettibuilds wants to merge 1 commit intoupstash:masterfrom
Conversation
detectProjectDependencies only scanned package.json in the given cwd directory, missing dependencies declared in workspace packages. For monorepos using pnpm workspaces or npm/yarn workspaces, only the root package.json was parsed — sub-packages under patterns like 'packages/*' were ignored entirely. Add getWorkspaceDirs() to detect workspace packages by reading pnpm-workspace.yaml (with lightweight YAML parsing) or the 'workspaces' field in package.json. Each discovered workspace package directory is scanned for its own package.json dependencies, which are merged into the final dependency list. Supports: - pnpm workspaces (pnpm-workspace.yaml) - npm/yarn workspaces (package.json 'workspaces' field) - Single-star glob patterns (packages/*, apps/*) - Exact path patterns (tools/foo) Closes upstash#1860
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.
Fixes #1860
detectProjectDependenciesonly scanspackage.jsonin the givencwddirectory. In monorepos using pnpm/npm/yarn workspaces, dependencies declared in sub-packages are completely missed.This adds workspace detection:
getWorkspaceDirs(cwd)checkspnpm-workspace.yamlandpackage.jsonworkspaces fieldresolveWorkspaceGlobs(cwd, patterns)resolvespackages/*style patterns into directoriespackage.jsondependenciesNo new dependencies added. Backwards compatible — non-monorepo projects work exactly as before.
Supports pnpm workspaces, npm workspaces, and yarn workspaces.