Commit graph

15 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
Michael Novotny
55b29fb351
Updates prettier to latest version. (#51000)
There are some incoming docs / MDX changes where prettier will throw an error when using the older version. Updating prettier before I bring in those changes.

Looks like the most notable change is adding parentheses around `typeof` checks in TypeScript. 

**Before**

```
export type Locale = typeof i18n['locales'][number]
```

**After**

```
export type Locale = (typeof i18n)['locales'][number]
```
2023-06-09 14:58:19 +00: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
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
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
b7e17e09e5
Update references to zeit/next.js (#13463) 2020-05-27 17:51:11 -04:00
Joe Haddad
86160a5190
Upgrade to Prettier 2 (#13061) 2020-05-18 15:24:37 -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
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
f13bf1e2bf [example with-typescript-graphql] Fix type error (#10269)
* fix: Type error

* Improve README.md
2020-01-25 22:32:58 -05:00
David Baumgold
72a898a7be Correct spelling: withApollo (#10055) 2020-01-12 13:24:08 -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