Skip to content

Commit 55d65b2

Browse files
committed
Convert to underscore before camelize for codegen cli
1 parent b969dfb commit 55d65b2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

graphql/codegen/src/cli/shared.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ export function printResult(result: GenerateResult): void {
139139

140140
const isTopLevel = (_key: string, path: string[]) => path.length === 0;
141141
export const camelizeArgv = (argv: Record<string, any>) =>
142-
inflektTree(argv, (key) => camelize(key, true), {
142+
inflektTree(argv, (key) => {
143+
// inflection.camelize expects underscores, so replace hyphens first
144+
const underscored = key.replace(/-/g, '_');
145+
return camelize(underscored, true);
146+
}, {
143147
skip: (key, path) =>
144148
!isTopLevel(key, path) ||
145149
key === '_' ||

0 commit comments

Comments
 (0)