Commit ca14867
refactor: consolidate configuration file resolving (#10619)
### Description
This PR refactors the codebase to deduplicate the logic for resolving
`turbo.json` and `turbo.jsonc` configuration files.
- Introduced `resolve_turbo_config_path` in Rust
(`crates/turborepo-lib/src/turbo_json/mod.rs`) and
`resolveTurboConfigPath` in TypeScript
(`packages/turbo-utils/src/getTurboConfigs.ts`).
- Replaced duplicated file existence checks and conflict resolution with
calls to these new utility functions.
- Ensures that the behavior for handling `turbo.json` and `turbo.jsonc`
(precedence, error on both existing) remains unchanged.
### Testing Instructions
- The refactor is purely internal, and existing tests cover the
behavior.
- Run `cargo test` in the Rust workspace.
- Run `pnpm check-types` in the root to verify TypeScript changes.
---------
Co-authored-by: Cursor Agent <[email protected]>1 parent 2185590 commit ca14867
File tree
4 files changed
+80
-58
lines changed- crates/turborepo-lib/src
- commands
- config
- turbo_json
- packages/turbo-utils/src
4 files changed
+80
-58
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 149 | + | |
169 | 150 | | |
170 | 151 | | |
171 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
454 | 454 | | |
455 | 455 | | |
456 | 456 | | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
| 457 | + | |
472 | 458 | | |
473 | 459 | | |
474 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
39 | 70 | | |
40 | 71 | | |
41 | 72 | | |
| |||
327 | 358 | | |
328 | 359 | | |
329 | 360 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | 361 | | |
336 | 362 | | |
337 | 363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
20 | 52 | | |
21 | 53 | | |
22 | 54 | | |
| |||
189 | 221 | | |
190 | 222 | | |
191 | 223 | | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
204 | 229 | | |
205 | 230 | | |
206 | 231 | | |
207 | 232 | | |
208 | 233 | | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
213 | 242 | | |
214 | 243 | | |
215 | 244 | | |
| |||
0 commit comments