diff --git a/.changeset/tough-bags-hunt.md b/.changeset/tough-bags-hunt.md new file mode 100644 index 00000000000..e02788786e2 --- /dev/null +++ b/.changeset/tough-bags-hunt.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/cli': patch +--- + +fix the default output directory for init command diff --git a/packages/graphql-codegen-cli/src/init/questions.ts b/packages/graphql-codegen-cli/src/init/questions.ts index fd875a5fb12..9d0b2561a0e 100644 --- a/packages/graphql-codegen-cli/src/init/questions.ts +++ b/packages/graphql-codegen-cli/src/init/questions.ts @@ -172,7 +172,7 @@ function normalizeTargets(targets: Tags[] | Tags[][]): Tags[] { export function getOutputDefaultValue(answers: Answers) { if (answers.targets.includes(Tags.client)) { - return 'src/gql'; + return 'src/gql/'; } if (answers.plugins.some(plugin => plugin.defaultExtension === '.tsx')) { return 'src/generated/graphql.tsx'; diff --git a/packages/graphql-codegen-cli/tests/__snapshots__/init.spec.ts.snap b/packages/graphql-codegen-cli/tests/__snapshots__/init.spec.ts.snap index fab692c6fd3..60bfd31140c 100644 --- a/packages/graphql-codegen-cli/tests/__snapshots__/init.spec.ts.snap +++ b/packages/graphql-codegen-cli/tests/__snapshots__/init.spec.ts.snap @@ -9,7 +9,7 @@ const config: CodegenConfig = { schema: "http://localhost:4000", documents: "graphql/*.ts", generates: { - "src/gql": { + "src/gql/": { preset: "client", plugins: [] }, @@ -51,7 +51,7 @@ const config: CodegenConfig = { schema: "http://localhost:4000", documents: "src/**/*.tsx", generates: { - "src/gql": { + "src/gql/": { preset: "client", plugins: [] } @@ -108,7 +108,7 @@ const config: CodegenConfig = { schema: "http://localhost:4000", documents: "src/**/*.tsx", generates: { - "src/gql": { + "src/gql/": { preset: "client", plugins: [] }