Commit 4689ffb
feat: walk up directory tree to find JS lockfile in monorepos (#431)
* feat: walk up directory tree to find JS lockfile in monorepos
Add parent-traversal logic to Base_javascript.validateLockFile and
_buildDependencyTree, matching the existing Cargo provider pattern.
When a nested package.json has no lockfile in its directory, the
provider now walks up looking for package-lock.json/yarn.lock/
pnpm-lock.yaml, stopping at a package.json with "workspaces" field
(the workspace root boundary) or the filesystem root.
This enables single-file stack analysis to work for modules in
JS/TS monorepos where the lockfile lives at the workspace root.
TRUSTIFY_DA_WORKSPACE_DIR still takes precedence as an explicit
override (no walk-up when set).
Assisted-by: Claude Code
Ref: TC-3891
* fix: pass correct cwd to commands and trim unnecessary comments
Address Qodo review: #executeListCmd and #createLockFile now pass
{ cwd: manifestDir } to #invokeCommand so commands run from the
lockfile directory, not the manifest directory.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Ref: TC-3891
* fix: add pnpm-workspace.yaml as workspace root boundary
Address Qodo review: _findLockFileDir now also stops at directories
containing pnpm-workspace.yaml, preventing the walk-up from escaping
pnpm workspace roots that don't use package.json#workspaces.
Ref: TC-3891
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 7144952 commit 4689ffb
File tree
10 files changed
+131
-14
lines changed- src/providers
- test/providers
- provider_manifests
- npm
- workspace_member_with_lock
- packages/module-a
- workspace_member_without_lock
- packages/module-a
- pnpm/workspace_member_without_lock
- packages/module-a
10 files changed
+131
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
116 | | - | |
117 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
118 | 173 | | |
119 | | - | |
| 174 | + | |
120 | 175 | | |
121 | 176 | | |
122 | 177 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 178 | + | |
127 | 179 | | |
128 | 180 | | |
129 | 181 | | |
| |||
188 | 240 | | |
189 | 241 | | |
190 | 242 | | |
191 | | - | |
192 | | - | |
| 243 | + | |
193 | 244 | | |
194 | 245 | | |
195 | 246 | | |
| |||
310 | 361 | | |
311 | 362 | | |
312 | 363 | | |
313 | | - | |
| 364 | + | |
314 | 365 | | |
315 | 366 | | |
316 | 367 | | |
| |||
332 | 383 | | |
333 | 384 | | |
334 | 385 | | |
335 | | - | |
336 | | - | |
337 | 386 | | |
338 | 387 | | |
339 | 388 | | |
340 | 389 | | |
341 | 390 | | |
342 | | - | |
| 391 | + | |
343 | 392 | | |
344 | 393 | | |
345 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
| |||
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
171 | 207 | | |
Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
test/providers/provider_manifests/npm/workspace_member_without_lock/packages/module-a/package.json
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
0 commit comments