Open
Description
Which packages are impacted by your issue?
@graphql-codegen/cli
Describe the bug
First of all, Thanks again for all your great work.
If codegen.ts is generated with the default output directory in the initial wizard, codegen cannot be executed as is.
See the reproduce section for more information.
Your Example Website or App
https://github.com/MH4GF/reproduce-codegen-init-bug
Steps to Reproduce the Bug or Issue
- Run initialization wizard, with default answers
yarn graphql-code-generator init
yarn run v1.22.15
$ /Users/mh4gf/tmp/test-codegen/node_modules/.bin/graphql-code-generator init
Welcome to GraphQL Code Generator!
Answer few questions and we will setup everything for you.
? What type of application are you building? Application built with React
? Where is your schema?: (path or url) https://swapi-graphql.netlify.app/.netlify/functions/index
? Where are your operations and fragments?: src/**/*.tsx
? Where to write the output: src/gql
? Do you want to generate an introspection file? No
? How to name the config file? codegen.ts
? What script in package.json should run the codegen? codegen
Fetching latest versions of selected plugins...
Config file generated at codegen.ts
$ npm install
To install the plugins.
$ npm run codegen
To run GraphQL Code Generator.
✨ Done in 15.47s.
- Comment out documents because we are not adding any operations.
- Running codegen will result in an error.
yarn codegen
yarn run v1.22.15
$ graphql-codegen --config codegen.ts
✔ Parse Configuration
⚠ Generate outputs
❯ Generate to src/gql
✔ Load GraphQL schemas
✖
Unable to find any GraphQL type definitions for the following pointers:
-
◼ Generate
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected behavior
The default output directory is src/gql/
, not src/gql
.
Screenshots or Videos
No response
Platform
- OS: macOS
- NodeJS: 16.16.0
graphql
version: 16.6.0@graphql-codegen/*
version(s): 3.2.1
Codegen Config File
import type { CodegenConfig } from '@graphql-codegen/cli';
const config: CodegenConfig = {
overwrite: true,
schema: "https://swapi-graphql.netlify.app/.netlify/functions/index",
// documents: "src/**/*.tsx",
generates: {
"src/gql": {
preset: "client",
plugins: []
}
}
};
export default config;
Additional context
related: #8684