Title: fix: prioritize pnpm-workspace.yaml detection and restrict setup to root package.json by Wenxin-Jiang · Pull Request #45 · SocketDev/socket-patch · GitHub
Open Graph Title: fix: prioritize pnpm-workspace.yaml detection and restrict setup to root package.json by Wenxin-Jiang · Pull Request #45 · SocketDev/socket-patch
X Title: fix: prioritize pnpm-workspace.yaml detection and restrict setup to root package.json by Wenxin-Jiang · Pull Request #45 · SocketDev/socket-patch
Description: Summary Fix workspace detection order: check for pnpm-workspace.yaml before the "workspaces" field in package.json, since pnpm projects often have both for compatibility For pnpm monorepos, the setup command now only adds the postinstall script to the root package.json, not individual workspace package.json files Fixes socket-patch: not found errors in pnpm monorepos where workspaces don't have @socketsecurity/socket-patch as a dependency Root Cause Two issues: Wrong detection order: detect_workspaces checked "workspaces" in package.json before pnpm-workspace.yaml. Many pnpm projects include both for compatibility, so they were misclassified as WorkspaceType::Npm. pnpm-workspace.yaml is the definitive signal for pnpm. Unnecessary workspace postinstalls: The setup command added npx @socketsecurity/socket-patch apply postinstall scripts to all workspace package.json files. In pnpm monorepos with strict module isolation, npx cannot resolve the package in workspaces that don't declare it as a dependency. Why root-only is correct for pnpm socket-patch apply is already monorepo-aware — it recursively searches all workspace node_modules directories from CWD, including following pnpm symlinks. Running it once from the root patches everything across all workspaces. Adding postinstall to individual workspaces was redundant (and broken due to the missing dependency). See: SocketDev/depscan#18843 Changes find.rs: detect_workspaces() now checks pnpm-workspace.yaml before "workspaces" in package.json find.rs: find_package_json_files() returns a PackageJsonFindResult struct containing both the file list and the detected WorkspaceType setup.rs: Filters to root-only when WorkspaceType::Pnpm is detected Test plan All 25 tests pass (including new test for pnpm + workspaces field coexistence) Full cargo check passes 🤖 Generated with Claude Code
Open Graph Description: Summary Fix workspace detection order: check for pnpm-workspace.yaml before the "workspaces" field in package.json, since pnpm projects often have both for compatibility For pnpm monorep...
X Description: Summary Fix workspace detection order: check for pnpm-workspace.yaml before the "workspaces" field in package.json, since pnpm projects often have both for compatibility For pnpm...
Opengraph URL: https://github.com/SocketDev/socket-patch/pull/45
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:c5b92ac3-9363-5b1e-1dbf-65ab16611f4d |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | B90E:47423:3A281B:4D2929:6A4ED916 |
| html-safe-nonce | 82086c811758447a57c74ddfcacae0facf5f52c79fa74565c481f06703f0ab12 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTBFOjQ3NDIzOjNBMjgxQjo0RDI5Mjk6NkE0RUQ5MTYiLCJ2aXNpdG9yX2lkIjoiODY4MzY1NzQxNTkwNjc0NDU5OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ba1f4e48e3904f9068b5b7e84ed885353dc30e9c7e80a1869413047c551ed3b5 |
| hovercard-subject-tag | pull_request:3477789480 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/SocketDev/socket-patch/pull/45/files |
| twitter:image | https://avatars.githubusercontent.com/u/71545489?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/71545489?s=400&v=4 |
| og:image:alt | Summary Fix workspace detection order: check for pnpm-workspace.yaml before the "workspaces" field in package.json, since pnpm projects often have both for compatibility For pnpm monorep... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/SocketDev/socket-patch git https://github.com/SocketDev/socket-patch.git |
| octolytics-dimension-user_id | 69326764 |
| octolytics-dimension-user_login | SocketDev |
| octolytics-dimension-repository_id | 1093661456 |
| octolytics-dimension-repository_nwo | SocketDev/socket-patch |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1093661456 |
| octolytics-dimension-repository_network_root_nwo | SocketDev/socket-patch |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | c37fe3e3f5f306900bd5b6bee97463f66c938b2c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width