Commit 2d7b33c
committed
Standardize extension handling across all file writing methods
- Enhanced ensureCorrectExtension() method to be more robust:
- Handle edge cases with null/empty inputs
- Ensure expectedExt starts with dot
- Better handling of multiple extensions (e.g., .d.ts, .spec.ts)
- Standardized all file writing methods to use ensureCorrectExtension():
- writeTypes(), writeEnums(), writeUtilsEnums()
- writeAstHelpers(), writeWrappedAstHelpers()
- writeCodeToFile(), writeEnumMaps(), writeRuntimeSchema()
- Consistent extension handling for both TypeScript (.ts) and JSON (.json) files
- Updated test snapshots to reflect corrected file extension behavior
- Prevents double extension bugs (e.g., .ts.ts) across all file generation
Co-Authored-By: Dan Lynch <[email protected]>1 parent 22734c9 commit 2d7b33c
File tree
3 files changed
+2187
-14
lines changed- __fixtures__/output/enum-maps/only-str
- packages/proto-parser
- __tests__/__snapshots__
- src
3 files changed
+2187
-14
lines changed
0 commit comments