Releases: piglovesyou/graphql-let
v0.18.5
This patch version includes JEST v26 & v27 support. So nice, @cbmd!
v0.18.4
v0.18.3
v0.18.2
v0.18.1
This release fixes a bug introduced in v0.18.0, described in #495. Thank you for all your investigation, @rtrembecky.
v0.18.0
v0.18.0 release🎉
v0.18.0 fixed #60, which pointed out duplicated generation of schema types are in trouble, especially in production-size GraphQL schema possibly having massive stitched GrpahQL types.
The types, generated by the typescript
plugin, are now all in graphql-let/__generated__/__types__
and shared by the other outputs. This requires you to migrate to use v0.18.0.
Many users realize this release. Thank you for the awesome Preset, @dotansimha. Thanks for your support, @StevenLangbroek, @acao.
Migration guide to v0.18.0
1. Install additional peer dependency
Please install @graphql-codegen/import-types-preset
as an additional peer dependency.
yarn add -D @graphql-codegen/import-types-preset
2. Change .graphql-let.yml
Please change your config file as below. schemaEntrypoint
became obsolete since it's always graphql-let/__generated__/__types__
from v0.18.0. The plugin typescript
is recommended to remove, also because it's always in graphql-let/__generated__/__types__
now.
schema: '**/*.graphqls'
- # "schemaEntrypoint" became obsolete
- schemaEntrypoint: lib/type-defs.graphqls
documents: '**/*.graphql'
plugins:
- # "typescript" is not recommended
- - typescript
- typescript-operations
- typescript-react-apollo
- cacheDir: __generated__
+ # ".cache" is now recommended to distinguish from "graphql-let/__generated__"
+ cacheDir: .cache
Please note that files in cacheDir
are only intermediates. Exclude them from your TypeScript source.
// tsconfig.json
{
+ "excludes": [".cache"]
}
Also, you're still able to have the plugin typescript
in your config to keep importing types from the per-document output (*.graphql.d.ts
). If so, you can skip step 3.
3. Change where you import types from
Again, your schema types are extracted and shared as graphql-let/__generated__/__types__
. Please replace import parts of your source.
- import { User, ViewerDocument } from './viewer.graphql'
+ import { User } from 'graphql-let/__generated__/__types__'
+ import { ViewerDocument } from './viewer.graphql'
Optionally, you may want to have a path alias to it in your tsconfig.json for convenience.
{
"compilerOptions": {
"noEmit": true,
"esModuleInterop": true,
+ "baseUrl": ".",
+ "paths": {
+ "@graphql-types@": ["node_modules/@types/graphql-let/__generated__/__types__"]
+ }
}
}
import { User } from '@graphql-types@'
For Resolver Types users
Resolver Types also go in graphql-let/__generated__/__types__
.
- import { Resolvers } from "./${config.schemaEntrypoint}";
+ import { Resolvers } from "graphql-let/__generated__/__types__";
v0.17.2
Supports silent
option to suppress all the standard output coming from graphql-let.
v0.17.0
New features
babel-plugin-macros support
We now exports graphql-let/macro
. It needs the least configuration. Now Create React App is able to use graphql-let without ejecting.
import { gql, load } from 'graphql-let/macro'
const { useQuery } = load('./a.graphql')
gql()
and load()
support in all entrypoints
gql()
used to be only for Babel Plugin, but now you can use it in webpack loader and babel-plugin-macros.
import { gql, load } from 'graphql-let' // If you use webpack loader or Babel Plugin
import { gql, load } from 'graphql-let/macro' // If you use babel-plugin-macros
const { useNewsQuery } = gql("query News { braa }")
const { useViewerQuery } = load('./viewer.graphql')
Breaking changes
Import named export gql
instead of default export for Babel Plugin
- import gql from 'graphql-let'
+ import { gql } from 'graphql-let'
A config name changes. "typeInjectEntrypoint" from "gqlDtsEntrypoint" in .graphql-let.yml.
- gqlDtsEntrypoint: graphql-let-custom-typings/index.d.ts
+ typeInjectEntrypoint: graphql-let-custom-typings/index.d.ts
Other improvements
More efficient code generation. It used to call GraphQL code generator API for each type (document file, schema file, string literal document) but now it calls it one for all types.