Skip to content

Commit cb1a959

Browse files
committed
refactor(codegen): replace custom kebabToPascal with inflekt toPascalCase
Use the standard toPascalCase from inflekt instead of a hand-rolled kebabToPascal helper. inflekt already handles kebab-case input correctly (e.g. 'find-first' → 'FindFirst').
1 parent 87dccb1 commit cb1a959

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

graphql/codegen/src/core/codegen/cli/table-command-generator.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
resolveInnerInputType,
1313
ucFirst,
1414
lcFirst,
15+
toPascalCase,
1516
getCreateInputTypeName,
1617
getPatchTypeName,
1718
} from '../utils';
@@ -276,13 +277,6 @@ function buildArgvType(): t.TSTypeAnnotation {
276277
);
277278
}
278279

279-
/**
280-
* Convert a kebab-case string to PascalCase: "find-first" → "FindFirst"
281-
*/
282-
function kebabToPascal(str: string): string {
283-
return str.split('-').map((s) => ucFirst(s)).join('');
284-
}
285-
286280
function buildSubcommandSwitch(
287281
subcommands: string[],
288282
handlerPrefix: string,
@@ -291,7 +285,7 @@ function buildSubcommandSwitch(
291285
const cases = subcommands.map((sub) =>
292286
t.switchCase(t.stringLiteral(sub), [
293287
t.returnStatement(
294-
t.callExpression(t.identifier(`${handlerPrefix}${kebabToPascal(sub)}`), [
288+
t.callExpression(t.identifier(`${handlerPrefix}${toPascalCase(sub)}`), [
295289
t.identifier('argv'),
296290
t.identifier('prompter'),
297291
]),

0 commit comments

Comments
 (0)