Graphql-code-generator: Unable to find template plugin matching 'typescript'

Created on 15 Oct 2020  路  3Comments  路  Source: dotansimha/graphql-code-generator

Describe the bug
Cannot generate types when the repo/directory name contains a "." (period) character.

To Reproduce

  1. Clone example repo: https://github.com/danielleknudson/test2.0
  2. cd test2.0 && yarn install
  3. Generate types: yarn generate
  1. My GraphQL schema:
  # This "Book" type defines the queryable fields for every book in our data source.
  type Book {
    title: String
    author: String
  }

  # The "Query" type is special: it lists all of the available queries that
  # clients can execute, along with the return type for each. In this
  # case, the "books" query returns an array of zero or more Books (defined above).
  type Query {
    books: [Book]
  }
  1. My GraphQL operations:
query GetBooks {
        books {
            title
            author
        }
}
  1. My codegen.yml config file:
overwrite: true
schema: "server/index.js"
documents: "src/**/*.{ts,tsx}"
generates:
  src/generated/types.ts:
    plugins:
      - "typescript"
      - "typescript-operations"
      - "typescript-react-apollo"

Expected behavior
Types generated without issue

Environment:

  • OS: Catalina 10.15.5
  • @graphql-codegen/...: 1.17.10
  • NodeJS: v12.18.0

Additional context
After digging into some of the cli code, I am certain the trouble generating types has to do with the directory name: test2.0 in my case. My company has a repo with 2.0 in the directory name. After changing the name to test2, the types generate without errors.

See makeDefaultLoader() in the cli/bin.js code.

bug core waiting-for-release

Most helpful comment

@macgyver2k sorry for the delay. Will release today :)

All 3 comments

Yes, it's all about dots in the path. There is already a PR done #4860 by @adambrgmn. Let's hope the new release will be out soon.

@macgyver2k sorry for the delay. Will release today :)

Fixed in @graphql-codegen/[email protected]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quolpr picture quolpr  路  3Comments

dotansimha picture dotansimha  路  3Comments

fvisticot picture fvisticot  路  3Comments

steebchen picture steebchen  路  3Comments

iamdanthedev picture iamdanthedev  路  3Comments