Commit graph

14 commits

Author SHA1 Message Date
Charly POLY
565a2fafac
refactor(examples/with-typescript-graphql): use codegen TypedDocumentNode and GraphQL Yoga for better DX and smaller bundle size (#36240)
Improve the Next.js with TypeScript + GraphQL example:

- [x] use GraphQL Code Generator instead of `graphql-let`: more widespread tool and smaller bundle size (types only generation vs code generation)
- [x] use GraphQL Yoga instead of Apollo Server Micro: for lighter bundle size as [stated here](https://github.com/vercel/next.js/pull/36155)
- [x] introduces GraphQL Code Generator on the API side for Resolvers typing

Co-authored-by: JJ Kasper <22380829+ijjk@users.noreply.github.com>
2022-05-23 16:58:27 +00:00
Jan Beseda
bb81f2e6a6
fix(example): with-typescript-graphql graphql-let package migrate (#29996)
## Bug

- Partially fixes #25854 
- Badly specified package dependency version (`graphql-let`). The new major version required manual migration. As specified [here](https://github.com/piglovesyou/graphql-let/releases/tag/v0.18.0).
- In `lib/resolvers.ts`
```Module '"*.graphqls"' has no exported member 'MutationResolvers'. Did you mean to use 'import MutationResolvers from "*.graphqls"' instead?ts(2614)```


## Fixes

- Migrate as described in migration guide for `graphql-let` above.
- Update some npm packages along the way.
2022-02-06 17:48:51 +00:00
U-ya
75be56fed7
[with-typescript-graphql] fixes breaking changes in graphql-let v0.18.0 (#32681)
* Migrate graphql-let v0.18.0 according to the documentation

* lint-fix

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2022-02-06 11:20:55 -06:00
matcha
6be8a04335
fixes with-typescript-graphql: unable to resolve dependency tree (#28637)
Example `with-typescript-graphql`has unmatched dependency tree in `react-test-renderer` lead to error in #28582, I changed version of `react-test-renderer` to `^17.0.1` and fix that issue.

Closes https://github.com/vercel/next.js/issues/28582
2021-09-07 15:26:32 +00:00
Luc Leray
f52955ec94
Clean up examples package.json (#27121)
Clean up package.json files in the `examples` directory:
- Add `private: true`
- Remove `version` (because they are irrelevant for packages that are not meant to be published)
- Remove `name` (because they are optional for packages that are not meant to be published, and when someone clones an example, they often rename it and the property becomes stale)
- Remove `author`
- Remove `description`
- Remove `license`

Also remove `with-dynamic-app-layout` example completely, since it does the same as `layout-component` (https://github.com/vercel/next.js/pull/27121#discussion_r668178408).

## Documentation / Examples

- [x] Make sure the linting passes
2021-07-12 19:58:03 +00:00
Nick Babcock
5629223407
Update examples to use React 17 (#26133)
[With next 11 requiring react 17](https://nextjs.org/blog/next-11#upgrade-guide), most of the examples
need to be updated, so the following snippet updated all the examples to
a compatible react version.

```bash
cd examples/
fd -g 'package.json' | xargs sed -r -i 's/"react": ".*"/"react": "^17.0.2"/
fd -g 'package.json' | xargs sed -r -i 's/"react-dom": ".*"/"react-dom": "^17.0.2"/'

# exclude experimental react version
git checkout with-reason-relay/package.json
```
2021-06-16 16:43:26 +00:00
Pavel Mineev
f18ce55d8a
(example/with-typescript-grapql): fix deps (#26010)
### Documentation / Examples

Fixed one of the items from #25854

- [x] add `@graphql-codegen/import-types-preset`
- [x] remove depriceated field `schemaEntrypoint`
- [x] add the StackBlitz button
- [x] Make sure the linting passes

[Live demo on StackBlitz](https://stackblitz.com/github/akellbl4/next.js/tree/example/with-typescript-graphql/fix-deps/examples/with-typescript-graphql)
2021-06-13 16:40:28 +00:00
Joe Haddad
f17d435166
Ensure all examples are MIT licensed (#16691) 2020-08-29 22:32:35 -04:00
Soichi Takamura
04c990678e
Update with-typescript-graphql (#16101) 2020-08-29 22:15:50 -04:00
Luis Alvarez D
43271821f2
[Examples] Move with-typescript-graphql to SSG (#13854)
Related to https://github.com/vercel/next.js/issues/11014
2020-06-10 04:14:53 +00:00
Soichi Takamura
790800305b
[examples/with-typescript-graphql] Add "createResolverContext" hook, etc. (#11681)
* Update deps

* Run "node-check-update -u"
* "graphql" keeps ^14 since other libs expect it
* Install apollo-link and apollo-cache because @apollo/react-common
wants it as peer-deps

* Add graphql-let/schema/loader

* This enables HMR from modifying *.graphqls.

* Add resolver context

* Remove JSDoc, respect TypeScript defs

* ncu -u

* Keep using graphql@^14.6.0 for the other deps

* fix: Migrate to graphql-let@0.10.0

* Removed duplicated deps

* Updated check

Co-authored-by: Luis Alvarez <luis@zeit.co>
2020-05-04 17:09:39 -05:00
kkobiela
7227824b4a
Update dependencies (#11707) 2020-04-06 13:37:54 -05:00
Soichi Takamura
ccb42b0ed5
Update example "with-typescript-graphql" (#10637)
* add peerDeps of graphql-let

* ncu -u && typesync

* Use resolver types for resolver implementation
2020-02-25 01:44:09 -05:00
Soichi Takamura
5fafd1a75b Proposing a new example "with-typescript-graphql" (#9803)
* New example with-typescript-graphql

* Update newer graphql-let

* Apply @lfades 's suggestions

* Use "lib" for tools directory
* Move config decorator to next.config.js
* Apply stricter tsconfig
* mod: hide the word "apollo" from users

* mod: Use variable name `withApollo`

* Use the later version of graphql-let

* Only pages can be in pages

* Life improvements

* fix: .grpahql-let.yml point to the wrong document path

* Use a wider glob for less pitfalls
* Add a note about it in README.md

Co-authored-by: Luis Alvarez D. <luis@zeit.co>
2020-01-08 13:39:00 -05:00