feat: unify casing libraries — komoji as origin of truth#74
Merged
pyramation merged 2 commits intomainfrom Mar 27, 2026
Merged
Conversation
- Fix toPascalCase bug: consecutive separators (e.g. 'my__double_under') now correctly produce 'MyDoubleUnder' instead of 'MydoubleUnder' - Add ucFirst and lcFirst to komoji - Update inflekt to re-export case transforms from komoji - Add komoji as workspace dependency of inflekt - Mark underscore (use toSnakeCase) and toScreamingSnake (use toConstantCase) as deprecated - Keep inflekt-specific functions: fixCapitalisedPlural, pluralization, matching, naming - All 60 komoji tests and 88 inflekt tests pass with no behavioral changes
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Allows consumers to import the preferred API names directly from inflekt during the migration period.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes
komojithe single origin for all pure case transformations and hasinflektdelegate to it, eliminating duplicate implementations.komoji changes:
toPascalCasenow handles consecutive separators correctly ("my__double_under"→"MyDoubleUnder"instead of"MydoubleUnder")lcFirstanducFirst(moved from inflekt)inflekt changes:
lcFirst,ucFirst,toPascalCase,toCamelCasenow delegate to komojitoSnakeCaseandtoConstantCaseare re-exported directly from komoji (new exports — lets consumers adopt the preferred names without adding komoji as a direct dependency)underscoredelegates to komoji'stoSnakeCase(marked@deprecated)toScreamingSnakedelegates to komoji'stoConstantCase(marked@deprecated)fixCapitalisedPluralremains in inflekt (inflekt-specific)komojias a workspace dependencyAll 60 komoji tests and 88 inflekt tests pass.
Review & Testing Checklist for Human
underscore/toScreamingSnake: The old inflektunderscoresplit every uppercase letter individually ("APIKey"→"a_p_i_key"). Komoji'stoSnakeCasegroups acronyms ("APIKey"→"api_key"). This is arguably better but is a silent behavioral change for downstream callers passing acronym-heavy strings. Grep forunderscore(andtoScreamingSnake(usage across all consumers and verify the new acronym behavior is acceptable.toCamelCasenow handles spaces: Old inflekt only handled-and_delimiters. Komoji also handles spaces and consecutive separators. Verify no downstream code relies on spaces being preserved.toPascalCasebroadened scope: Same as above — now handles spaces and consecutive separators. Verify downstream behavior.workspace:*resolves correctly at publish time: Wheninflektis published to npm,komojimust be published first (or simultaneously) so the workspace protocol resolves to a real version.Recommended test plan: Run the constructive monorepo's full test suite (especially
graphql/codegen,graphql/query,pgpm/export) with these updated packages to verify no downstream breakage from the behavioral differences listed above.Notes
pnpm-lock.yamldiff is large but is almost entirely formatting changes (single quotes vs double quotes from pnpm version). The only meaningful change is the addition of thekomojiworkspace dependency forinflekt.constructive-io/constructive(#913) migratestoScreamingSnake→toConstantCaseandunderscore→toSnakeCaseimports in consumer code.Link to Devin session: https://app.devin.ai/sessions/c92c3a11450342f8875625a60fa1be28
Requested by: @pyramation