Skip to content

Commit 08d0705

Browse files
committed
fix: update codegen.ts
1 parent 0f5bc04 commit 08d0705

File tree

4 files changed

+1780
-17
lines changed

4 files changed

+1780
-17
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
import type { CodegenConfig } from '@graphql-codegen/cli';
2-
3-
const config: CodegenConfig = {
4-
schema: 'http://myexample.local/graphql',
5-
documents: ['src/**\/*.jsx'],
6-
generates: {
7-
'possibleTypes.json': {
8-
plugins: ['fragment-matcher'],
9-
config: {
10-
module: 'commonjs',
11-
apolloClientVersion: 3,
12-
},
13-
},
14-
},
15-
};
16-
export default config;
1+
import type { CodegenConfig } from "@graphql-codegen/cli";
2+
import dotenv from "dotenv";
3+
dotenv.config();
4+
5+
const baseUrl =
6+
process.env.NEXT_PUBLIC_WORDPRESS_URL || "https://your-wordpress-site.com";
7+
const graphqlPath = process.env.NEXT_PUBLIC_GRAPHQL_PATH || "/graphql";
8+
9+
const config: CodegenConfig = {
10+
schema: `${baseUrl}${graphqlPath}`,
11+
documents: ["src/**/*.jsx"],
12+
generates: {
13+
"possibleTypes.json": {
14+
plugins: ["fragment-matcher"],
15+
config: {
16+
module: "commonjs",
17+
apolloClientVersion: 3,
18+
},
19+
},
20+
},
21+
};
22+
export default config;

examples/next-pages-apollo-authentication/package-lock.json

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/next-pages-apollo-authentication/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"@tailwindcss/postcss": "^4",
2929
"eslint": "^9",
3030
"eslint-config-next": "15.2.0",
31-
"tailwindcss": "^4"
31+
"tailwindcss": "^4",
32+
"dotenv": "16.4.7"
3233
}
3334
}

0 commit comments

Comments
 (0)