Skip to content

Commit

Permalink
Include @graphql-codegen/client-preset in @graphql-codegen/cli by def…
Browse files Browse the repository at this point in the history
…ault (#9601)

* include client preset in @graphql-codegen/cli by default

* add changeset

* Update docs

* chore(dependencies): updated changesets for modified dependencies

* remove dependecy from example

* fix types

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
beerose and github-actions[bot] authored Oct 25, 2023
1 parent 1efda78 commit e176eab
Show file tree
Hide file tree
Showing 27 changed files with 27 additions and 34 deletions.
5 changes: 5 additions & 0 deletions .changeset/@graphql-codegen_cli-9601-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphql-codegen/cli": patch
---
dependencies updates:
- Added dependency [`@graphql-codegen/client-preset@^4.1.0` ↗︎](https://www.npmjs.com/package/@graphql-codegen/client-preset/v/4.1.0) (to `dependencies`)
5 changes: 5 additions & 0 deletions .changeset/quiet-flies-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@graphql-codegen/cli': patch
---

Include @graphql-codegen/client-preset in @graphql-codegen/cli by default
1 change: 0 additions & 1 deletion examples/persisted-documents-string-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"jest": "28.1.3",
"babel-jest": "29.6.4",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@babel/core": "7.22.11",
"@babel/preset-env": "7.22.10",
"@babel/preset-typescript": "7.22.11"
Expand Down
1 change: 0 additions & 1 deletion examples/persisted-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"jest": "28.1.3",
"babel-jest": "29.6.4",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@babel/core": "7.22.11",
"@babel/preset-env": "7.22.10",
"@babel/preset-typescript": "7.22.11"
Expand Down
1 change: 0 additions & 1 deletion examples/react/apollo-client-defer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@types/jest": "^27.5.2",
"@types/node": "^18.11.18",
"@types/react": "^18.0.15",
Expand Down
1 change: 0 additions & 1 deletion examples/react/apollo-client-swc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"devDependencies": {
"@graphql-codegen/client-preset-swc-plugin": "0.2.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-codegen/cli": "^5.0.0",
"@vitejs/plugin-react-swc": "^3.3.0",
"@types/react": "18.2.21",
Expand Down
1 change: 0 additions & 1 deletion examples/react/apollo-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-react": "^3.1.0",
"@types/jest": "^27.5.2",
"@types/node": "^18.11.18",
Expand Down
1 change: 0 additions & 1 deletion examples/react/http-executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-react": "^3.1.0",
"@types/jest": "^27.5.2",
"@types/node": "^18.11.18",
Expand Down
6 changes: 3 additions & 3 deletions examples/react/nextjs-swr/hooks/use-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ export function useGraphQL<TResult, TVariables>(
document.definitions.find(isOperationDefinition)?.name,
variables,
] as const,
async (_key, variables) =>
async (_key: string, variables: any) =>
executor({
document: document as any,
variables: variables as any,
document,
variables,
}) as Promise<ExecutionResult<TResult>>
);
}
1 change: 0 additions & 1 deletion examples/react/nextjs-swr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-codegen/schema-ast": "4.0.0",
"@graphql-codegen/client-preset-swc-plugin": "0.2.0",
"@types/node": "^18.11.18",
Expand Down
1 change: 0 additions & 1 deletion examples/react/tanstack-react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-react": "^3.1.0",
"@types/jest": "^27.5.2",
"@types/node": "^18.11.18",
Expand Down
1 change: 0 additions & 1 deletion examples/react/urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.10",
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-react": "^3.1.0",
"typescript": "5.2.2",
"serve": "14.2.1",
Expand Down
3 changes: 1 addition & 2 deletions examples/typescript-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"version": "0.0.0",
"private": true,
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0"
"@graphql-codegen/cli": "5.0.0"
},
"dependencies": {
"@graphql-typed-document-node/core": "3.2.0",
Expand Down
1 change: 0 additions & 1 deletion examples/typescript-graphql-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"babel-jest": "29.6.4",
"jest": "28.1.3"
},
Expand Down
1 change: 0 additions & 1 deletion examples/vite/vite-react-cts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"cypress": "12.17.4",
Expand Down
1 change: 0 additions & 1 deletion examples/vite/vite-react-mts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"cypress": "12.17.4",
Expand Down
1 change: 0 additions & 1 deletion examples/vite/vite-react-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@types/react": "^18.0.27",
"@types/react-dom": "^18.0.10",
"cypress": "12.17.4",
Expand Down
1 change: 0 additions & 1 deletion examples/vue/apollo-composable/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-vue": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^4.1.0",
Expand Down
1 change: 0 additions & 1 deletion examples/vue/urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-vue": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^4.1.0",
Expand Down
1 change: 0 additions & 1 deletion examples/vue/villus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/client-preset": "^4.1.0",
"@vitejs/plugin-vue": "^4.0.0",
"typescript": "^5.0.0",
"vite": "^4.1.0",
Expand Down
1 change: 0 additions & 1 deletion examples/yoga-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"jest": "28.1.3",
"babel-jest": "29.6.4",
"@graphql-codegen/cli": "5.0.0",
"@graphql-codegen/client-preset": "4.1.0",
"@babel/core": "7.22.11",
"@babel/preset-env": "7.22.10",
"@babel/preset-typescript": "7.22.11"
Expand Down
1 change: 1 addition & 0 deletions packages/graphql-codegen-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"@babel/generator": "^7.18.13",
"@babel/template": "^7.18.10",
"@babel/types": "^7.18.13",
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-codegen/core": "^4.0.0",
"@graphql-codegen/plugin-helpers": "^5.0.1",
"@graphql-tools/apollo-engine-loader": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/docs/getting-started/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ After installing 3 packages:

```sh npm2yarn
npm i graphql
npm i -D typescript @graphql-codegen/cli @graphql-codegen/client-preset
npm i -D typescript @graphql-codegen/cli
```

and providing a simple configuration:
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/docs/getting-started/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ If you are looking for the **best way to leverage GraphQL Code Generator on your

#### Client

We recommend using [a `client` preset](/plugins/presets/preset-client) that has a recommended configuration for the client applications. You can follow one of the following guides:
We recommend using [a `client` preset](/plugins/presets/preset-client) that has a recommended configuration for the client applications. It's included in the `@graphql-codegen/cli` package by default. Follow one of the following guides to learn more:

- [React](/docs/guides/react-vue)
- [Vue](/docs/guides/react-vue)
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/docs/guides/api-testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ npm i graphql-yoga
Install the following development dependencies:

```sh npm2yarn
npm i -D typescript ts-node @graphql-codegen/cli @graphql-codegen/client-preset jest @babel/core @babel/preset-env @babel/preset-typescript babel-jest @graphql-typed-document-node/core
npm i -D typescript ts-node @graphql-codegen/cli jest @babel/core @babel/preset-env @babel/preset-typescript babel-jest @graphql-typed-document-node/core
```

## Setup
Expand Down
6 changes: 3 additions & 3 deletions website/src/pages/docs/guides/react-vue.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ For most GraphQL clients and frameworks (React, Vue), install the following pack

```bash
yarn add graphql
yarn add -D typescript ts-node @graphql-codegen/cli @graphql-codegen/client-preset
yarn add -D typescript ts-node @graphql-codegen/cli
```

**For npm:**

```bash
npm i -S graphql
npm i -D typescript ts-node @graphql-codegen/cli @graphql-codegen/client-preset
npm i -D typescript ts-node @graphql-codegen/cli
```

**For pnpm:**

```bash
pnpm i graphql @graphql-typed-document-node/core
pnpm i -D typescript ts-node @graphql-codegen/cli @graphql-codegen/client-preset
pnpm i -D typescript ts-node @graphql-codegen/cli
```

<br />
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4513,16 +4513,16 @@
resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.2.tgz#fc25ad9943bcac11cceb8168db4f275e0e72e756"
integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg==

"@types/unist@*", "@types/unist@^2.0.0", "@types/unist@^2.0.2":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==

"@types/unist@^3.0.0":
"@types/unist@*", "@types/unist@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.0.tgz#988ae8af1e5239e89f9fbb1ade4c935f4eeedf9a"
integrity sha512-MFETx3tbTjE7Uk6vvnWINA/1iJ7LuMdO4fcq8UfF0pRbj01aGLduVvQcRyswuACJdpnHgg8E3rQLhaRdNEJS0w==

"@types/unist@^2.0.0", "@types/unist@^2.0.2":
version "2.0.6"
resolved "https://registry.yarnpkg.com/@types/unist/-/unist-2.0.6.tgz#250a7b16c3b91f672a24552ec64678eeb1d3a08d"
integrity sha512-PBjIUxZHOuj0R15/xuwJYjFi+KZdNFrehocChv4g5hu6aFroHue8m0lBP0POdK2nKzbw0cgV1mws8+V/JAcEkQ==

"@types/ws@^8.0.0":
version "8.5.4"
resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.4.tgz#bb10e36116d6e570dd943735f86c933c1587b8a5"
Expand Down

0 comments on commit e176eab

Please sign in to comment.