Commit graph

11 commits

Author SHA1 Message Date
Steven
4466ba436b
chore(examples): use default prettier for examples/templates (#60530)
## Description
This PR ensures that the default prettier config is used for examples
and templates.

This config is compatible with `prettier@3` as well (upgrading prettier
is bigger change that can be a future PR).

## Changes
- Updated `.prettierrc.json` in root with `"trailingComma": "es5"` (will
be needed upgrading to prettier@3)
- Added `examples/.prettierrc.json` with default config (this will
change every example)
- Added `packages/create-next-app/templates/.prettierrc.json` with
default config (this will change every template)

## Related

- Fixes #54402
- Closes #54409
2024-01-11 16:01:44 -07:00
Tim Neutkens
ab42da0626
Run next/link codemod for Next.js 13 on examples (#41913) 2022-10-30 21:00:45 +01:00
Charly POLY
792c661264
examples(with-typescript-graphql): migrate to Yoga v3 and codegen new preset: client (#41597)
Co-authored-by: Balázs Orbán <info@balazsorban.com>
2022-10-24 12:03:08 -07:00
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
Sahil Rajput
15133b47ec
Fix typescript types. (#23771)
Fix typescript type for cache and null check in mutation result.

## Bug

- fixes : https://github.com/vercel/next.js/issues/23770

**That issue deals with -**

- Return the codeflow if data is not returned from the mutation, and that fixes this warning.
![Screenshot from 2021-04-07 18-24-44](https://user-images.githubusercontent.com/31458531/113873069-18353a80-97d2-11eb-8c8c-9e9c9d280f95.png)

- Supply typescript typings for the target cache object.
![Screenshot from 2021-04-07 18-52-15](https://user-images.githubusercontent.com/31458531/113873504-80841c00-97d2-11eb-9b14-17d16a524c84.png)

Thanks.!
2021-04-15 18:55:30 +00:00
WeichienHung
a2bea9b492
Add mutation example to with-typescript-graphql (#16742)
Fixes  https://github.com/vercel/next.js/issues/16550

Add a graphql mutation operation in this example.
The changes are:
1. Define mutation in schema `type-defs.graphqls`
2. Add mutation to `viewer.graphql ` that compiled to typescript code.
3. Add mutation resolver in `resolvers.ts`
4. [UI] add a input box and button to submit mutation request to change name. 

screenshot of change
![mutation_example](https://user-images.githubusercontent.com/1462027/91797123-5ffc4e00-ec54-11ea-910b-3ddb399b42f0.gif)
2020-11-10 21:10:54 +00: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
Joe Haddad
dbad9db68c
Update Examples for Fast Refresh (#13068) 2020-05-18 17:44:18 -04: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
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