Skip to content

Commit

Permalink
Merge branch 'master' into deterministic-fragment-matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
eddeee888 authored Feb 2, 2025
2 parents 55ffbe0 + 62dd4c7 commit 0fd681d
Show file tree
Hide file tree
Showing 109 changed files with 1,936 additions and 1,815 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,31 @@ jobs:
yarn run generate:examples:${{matrix.method}}
git diff --exit-code -- dev-test/
dev-tests:
name: Examples
name: Examples - Normal
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup env
uses: the-guild-org/shared-config/setup@main
with:
nodeVersion: 18
- name: Build
run: yarn build
env:
CI: true
- name: Generate and Diff Codegen Artifacts
run: |
EXAMPLE_TYPE=normal yarn examples:codegen
git diff --exit-code -- examples/
- name: Build Examples
run: |
EXAMPLE_TYPE=normal yarn examples:build
- name: End2End Test Examples
run: |
EXAMPLE_TYPE=normal yarn examples:test:end2end
dev-tests-swc:
name: Examples - SWC
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -80,14 +104,14 @@ jobs:
CI: true
- name: Generate and Diff Codegen Artifacts
run: |
yarn examples:codegen
EXAMPLE_TYPE=swc yarn examples:codegen
git diff --exit-code -- examples/
- name: Build Examples
run: |
yarn examples:build
EXAMPLE_TYPE=swc yarn examples:build
- name: End2End Test Examples
run: |
yarn examples:test:end2end
EXAMPLE_TYPE=swc yarn examples:test:end2end
esm:
name: Testing exports integrity
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
22
8 changes: 7 additions & 1 deletion dev-test/gql-tag-operations-masking/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n fragment TweetFragment on Tweet {\n id\n body\n ...TweetAuthorFragment\n }\n': typeof types.TweetFragmentFragmentDoc;
'\n fragment TweetAuthorFragment on Tweet {\n id\n author {\n id\n username\n }\n }\n': typeof types.TweetAuthorFragmentFragmentDoc;
'\n fragment TweetsFragment on Query {\n Tweets {\n id\n ...TweetFragment\n }\n }\n': typeof types.TweetsFragmentFragmentDoc;
'\n query TweetAppQuery {\n ...TweetsFragment\n }\n': typeof types.TweetAppQueryDocument;
};
const documents: Documents = {
'\n fragment TweetFragment on Tweet {\n id\n body\n ...TweetAuthorFragment\n }\n':
types.TweetFragmentFragmentDoc,
'\n fragment TweetAuthorFragment on Tweet {\n id\n author {\n id\n username\n }\n }\n':
Expand Down
7 changes: 6 additions & 1 deletion dev-test/gql-tag-operations-urql/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query Foo {\n Tweets {\n id\n }\n }\n': typeof types.FooDocument;
'\n fragment Lel on Tweet {\n id\n body\n }\n': typeof types.LelFragmentDoc;
'\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': typeof types.BarDocument;
};
const documents: Documents = {
'\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument,
'\n fragment Lel on Tweet {\n id\n body\n }\n': types.LelFragmentDoc,
'\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': types.BarDocument,
Expand Down
7 changes: 6 additions & 1 deletion dev-test/gql-tag-operations/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query Foo {\n Tweets {\n id\n }\n }\n': typeof types.FooDocument;
'\n fragment Lel on Tweet {\n id\n body\n }\n': typeof types.LelFragmentDoc;
'\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': typeof types.BarDocument;
};
const documents: Documents = {
'\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument,
'\n fragment Lel on Tweet {\n id\n body\n }\n': types.LelFragmentDoc,
'\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': types.BarDocument,
Expand Down
7 changes: 6 additions & 1 deletion dev-test/gql-tag-operations/graphql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query Foo {\n Tweets {\n id\n }\n }\n': typeof types.FooDocument;
'\n fragment Lel on Tweet {\n id\n body\n }\n': typeof types.LelFragmentDoc;
'\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': typeof types.BarDocument;
};
const documents: Documents = {
'\n query Foo {\n Tweets {\n id\n }\n }\n': types.FooDocument,
'\n fragment Lel on Tweet {\n id\n body\n }\n': types.LelFragmentDoc,
'\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': types.BarDocument,
Expand Down
4 changes: 2 additions & 2 deletions examples/persisted-documents-string-mode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"@graphql-typed-document-node/core": "3.2.0",
"jest": "28.1.3",
"babel-jest": "29.7.0",
"@graphql-codegen/cli": "5.0.3",
"@graphql-codegen/cli": "5.0.4",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.24.7"
"@babel/preset-typescript": "7.26.0"
},
"scripts": {
"test": "jest",
Expand Down
5 changes: 4 additions & 1 deletion examples/persisted-documents-string-mode/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import * as types from './graphql';
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query HelloQuery {\n hello\n }\n': typeof types.HelloQueryDocument;
};
const documents: Documents = {
'\n query HelloQuery {\n hello\n }\n': types.HelloQueryDocument,
};

Expand Down
4 changes: 2 additions & 2 deletions examples/persisted-documents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
"@graphql-typed-document-node/core": "3.2.0",
"jest": "28.1.3",
"babel-jest": "29.7.0",
"@graphql-codegen/cli": "5.0.3",
"@graphql-codegen/cli": "5.0.4",
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.3",
"@babel/preset-typescript": "7.24.7"
"@babel/preset-typescript": "7.26.0"
},
"scripts": {
"test": "jest",
Expand Down
5 changes: 4 additions & 1 deletion examples/persisted-documents/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query HelloQuery {\n hello\n }\n': typeof types.HelloQueryDocument;
};
const documents: Documents = {
'\n query HelloQuery {\n hello\n }\n': types.HelloQueryDocument,
};

Expand Down
10 changes: 5 additions & 5 deletions examples/programmatic-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"dependencies": {
"@graphql-codegen/core": "4.0.2",
"@graphql-codegen/plugin-helpers": "5.1.0",
"@graphql-codegen/typed-document-node": "5.0.12",
"@graphql-codegen/typescript": "4.1.2",
"@graphql-codegen/typescript-operations": "4.4.0",
"@graphql-codegen/typescript-resolvers": "4.4.1",
"@graphql-codegen/typed-document-node": "5.0.13",
"@graphql-codegen/typescript": "4.1.3",
"@graphql-codegen/typescript-operations": "4.4.1",
"@graphql-codegen/typescript-resolvers": "4.4.2",
"@graphql-tools/graphql-file-loader": "8.0.1",
"@graphql-tools/load": "8.0.2",
"@graphql-tools/schema": "10.0.6",
Expand All @@ -24,7 +24,7 @@
"prettier": "2.8.8"
},
"devDependencies": {
"@types/node": "20.16.1",
"@types/node": "22.10.7",
"tsup": "8.2.4"
}
}
8 changes: 4 additions & 4 deletions examples/react/apollo-client-defer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"graphql-yoga": "5.7.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/cli": "^5.0.4",
"@types/jest": "^27.5.2",
"@types/node": "^20.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.10",
"@vitejs/plugin-react": "^4.0.0",
"cypress": "13.13.3",
"cypress": "14.0.0",
"serve": "14.2.3",
"start-server-and-test": "2.0.5",
"typescript": "5.5.4",
"vite": "^5.0.0"
"vite": "^6.0.0"
},
"scripts": {
"dev": "vite",
Expand Down
6 changes: 5 additions & 1 deletion examples/react/apollo-client-defer/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n fragment SlowFieldFragment on Query {\n slowField(waitFor: 5000)\n }\n': typeof types.SlowFieldFragmentFragmentDoc;
'\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n\n ... @defer {\n inlinedSlowField: slowField(waitFor: 5000)\n }\n }\n': typeof types.SlowAndFastFieldWithDeferDocument;
};
const documents: Documents = {
'\n fragment SlowFieldFragment on Query {\n slowField(waitFor: 5000)\n }\n': types.SlowFieldFragmentFragmentDoc,
'\n query SlowAndFastFieldWithDefer {\n fastField\n ...SlowFieldFragment @defer\n\n ... @defer {\n inlinedSlowField: slowField(waitFor: 5000)\n }\n }\n':
types.SlowAndFastFieldWithDeferDocument,
Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client-swc-plugin/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
schema: 'https://graphql.org/graphql/',
documents: ['src/**/*.tsx', '!src/gql/**/*'],
generates: {
'./src/gql/': {
Expand Down
4 changes: 2 additions & 2 deletions examples/react/apollo-client-swc-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
},
"devDependencies": {
"@graphql-codegen/client-preset-swc-plugin": "0.2.0",
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/cli": "^5.0.4",
"@vitejs/plugin-react-swc": "^3.3.0",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"typescript": "5.5.4",
"vite": "^5.0.0"
"vite": "^6.0.0"
},
"scripts": {
"dev": "vite",
Expand Down
6 changes: 5 additions & 1 deletion examples/react/apollo-client-swc-plugin/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n': typeof types.AllFilmsWithVariablesQueryDocument;
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n': typeof types.FilmItemFragmentDoc;
};
const documents: Documents = {
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':
types.AllFilmsWithVariablesQueryDocument,
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':
Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client-swc-plugin/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from './App';
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';

const client = new ApolloClient({
uri: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
uri: 'https://graphql.org/graphql/',
cache: new InMemoryCache(),
});

Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { type CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
schema: 'https://graphql.org/graphql/',
documents: ['src/**/*.tsx'],
generates: {
'./src/gql/': {
Expand Down
8 changes: 4 additions & 4 deletions examples/react/apollo-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/cli": "^5.0.4",
"@vitejs/plugin-react": "^4.0.0",
"@types/jest": "^27.5.2",
"@types/node": "^20.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.0.15",
"@types/react-dom": "^18.0.10",
"typescript": "5.5.4",
"serve": "14.2.3",
"cypress": "13.13.3",
"cypress": "14.0.0",
"start-server-and-test": "2.0.5",
"vite": "^5.0.0"
"vite": "^6.0.0"
},
"scripts": {
"dev": "vite",
Expand Down
6 changes: 5 additions & 1 deletion examples/react/apollo-client/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n': typeof types.AllFilmsWithVariablesQueryDocument;
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n': typeof types.FilmItemFragmentDoc;
};
const documents: Documents = {
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':
types.AllFilmsWithVariablesQueryDocument,
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':
Expand Down
2 changes: 1 addition & 1 deletion examples/react/apollo-client/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import App from './App';
import { ApolloClient, InMemoryCache, ApolloProvider } from '@apollo/client';

const client = new ApolloClient({
uri: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
uri: 'https://graphql.org/graphql/',
cache: new InMemoryCache(),
});

Expand Down
2 changes: 1 addition & 1 deletion examples/react/http-executor/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { type CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
schema: 'https://graphql.org/graphql/',
documents: ['src/**/*.tsx'],
generates: {
'./src/gql/': {
Expand Down
8 changes: 4 additions & 4 deletions examples/react/http-executor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@graphql-codegen/cli": "^5.0.3",
"@graphql-codegen/cli": "^5.0.4",
"@vitejs/plugin-react": "^4.0.0",
"@types/jest": "^27.5.2",
"@types/node": "^20.0.0",
"@types/node": "^22.0.0",
"@types/react": "^18.0.17",
"@types/react-dom": "^18.0.10",
"typescript": "5.5.4",
"serve": "14.2.3",
"cypress": "13.13.3",
"cypress": "14.0.0",
"start-server-and-test": "2.0.5",
"vite": "^5.0.0"
"vite": "^6.0.0"
},
"scripts": {
"dev": "vite",
Expand Down
4 changes: 2 additions & 2 deletions examples/react/http-executor/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Film from './Film';
import { graphql, DocumentType } from './gql';

const executor = buildHTTPExecutor({
endpoint: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
endpoint: 'https://graphql.org/graphql/',
});

const AllFilmsWithVariablesQuery = graphql(/* GraphQL */ `
Expand All @@ -21,7 +21,7 @@ const AllFilmsWithVariablesQuery = graphql(/* GraphQL */ `
`);

// we could also define a client:
// `const client = new GraphQLClient('https://swapi-graphql.netlify.app/.netlify/functions/index')`
// `const client = new GraphQLClient('https://graphql.org/graphql/')`
// and use:
// `client.request(allFilmsWithVariablesQueryDocument, { first: 10 })`

Expand Down
6 changes: 5 additions & 1 deletion examples/react/http-executor/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
*/
const documents = {
type Documents = {
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n': typeof types.AllFilmsWithVariablesQueryDocument;
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n': typeof types.FilmItemFragmentDoc;
};
const documents: Documents = {
'\n query allFilmsWithVariablesQuery($first: Int!) {\n allFilms(first: $first) {\n edges {\n node {\n ...FilmItem\n }\n }\n }\n }\n':
types.AllFilmsWithVariablesQueryDocument,
'\n fragment FilmItem on Film {\n id\n title\n releaseDate\n producers\n }\n':
Expand Down
2 changes: 1 addition & 1 deletion examples/react/nextjs-swr/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { CodegenConfig } from '@graphql-codegen/cli';

const config: CodegenConfig = {
schema: 'https://swapi-graphql.netlify.app/.netlify/functions/index',
schema: 'https://graphql.org/graphql/',
documents: ['components/**/*.tsx', 'pages/**/*.tsx'],
generates: {
'./gql/': {
Expand Down
Loading

0 comments on commit 0fd681d

Please sign in to comment.