Commit 4e048d1
authored
fix(typegen): preserve fmodata customizations with clearOldFiles (#122)
<!-- CURSOR_SUMMARY -->
> [!NOTE]
> **Medium Risk**
> Changes the `clearOldFiles` behavior to delete files *after* regeneration via a recursive cleanup, which could remove unexpected entries if the output path is misconfigured, but is otherwise localized to type generation output.
>
> **Overview**
> Fixes `fmodata` type generation so `clearOldFiles` no longer nukes the output directory before merging with existing files; existing schemas are now always parsed so field-level customizations (e.g. validators) are preserved.
>
> When `clearOldFiles` is enabled, stale files/directories are now removed *after* generation by tracking regenerated files (including `index.ts`) and deleting any other entries in the output tree. Adds an e2e test covering customization preservation plus stale file cleanup, and includes a patch changeset.
>
> <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit ea7f4c2. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 944925b commit 4e048d1
File tree
3 files changed
+85
-6
lines changed- .changeset
- packages/typegen
- src/fmodata
- tests/e2e
3 files changed
+85
-6
lines changedLines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1055 | 1055 | | |
1056 | 1056 | | |
1057 | 1057 | | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | 1058 | | |
1064 | 1059 | | |
1065 | 1060 | | |
1066 | 1061 | | |
1067 | 1062 | | |
| 1063 | + | |
1068 | 1064 | | |
1069 | 1065 | | |
1070 | 1066 | | |
1071 | 1067 | | |
1072 | 1068 | | |
1073 | 1069 | | |
1074 | 1070 | | |
1075 | | - | |
| 1071 | + | |
1076 | 1072 | | |
1077 | 1073 | | |
1078 | 1074 | | |
| |||
1389 | 1385 | | |
1390 | 1386 | | |
1391 | 1387 | | |
| 1388 | + | |
1392 | 1389 | | |
1393 | 1390 | | |
1394 | 1391 | | |
| |||
1406 | 1403 | | |
1407 | 1404 | | |
1408 | 1405 | | |
| 1406 | + | |
1409 | 1407 | | |
1410 | 1408 | | |
1411 | 1409 | | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
1412 | 1434 | | |
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
273 | 323 | | |
0 commit comments