Setup "graphql-codgen"
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
|
src/lib/graphql/generated
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module.exports = {
|
|||||||
extends: ['airbnb', 'airbnb-typescript', 'prettier'],
|
extends: ['airbnb', 'airbnb-typescript', 'prettier'],
|
||||||
plugins: ['@typescript-eslint', 'no-relative-import-paths', 'prettier', 'header'],
|
plugins: ['@typescript-eslint', 'no-relative-import-paths', 'prettier', 'header'],
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: ['./tsconfig.json', './tools/scripts/tsconfig.json'],
|
project: ['./tsconfig.json', './tsconfig.node.json', './tools/scripts/tsconfig.json'],
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|||||||
37
gql_codegen.ts
Normal file
37
gql_codegen.ts
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) Contributors to the Suwayomi project
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { CodegenConfig } from '@graphql-codegen/cli';
|
||||||
|
|
||||||
|
const config: CodegenConfig = {
|
||||||
|
overwrite: true,
|
||||||
|
schema: 'http://localhost:4567/api/graphql',
|
||||||
|
documents: [
|
||||||
|
'src/lib/graphql/queries/**',
|
||||||
|
'src/lib/graphql/mutations/**',
|
||||||
|
'src/lib/graphql/subscriptions/**',
|
||||||
|
'src/lib/graphql/Fragments.ts',
|
||||||
|
],
|
||||||
|
ignoreNoDocuments: true,
|
||||||
|
generates: {
|
||||||
|
'src/lib/graphql/generated/graphql.ts': {
|
||||||
|
plugins: ['typescript', 'typescript-operations'],
|
||||||
|
config: {
|
||||||
|
namingConvention: {
|
||||||
|
typeNames: 'change-case-all#pascalCase',
|
||||||
|
transformUnderscore: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'src/lib/graphql/generated/apollo-helpers.ts': {
|
||||||
|
plugins: ['typescript-apollo-client-helpers'],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -11,7 +11,8 @@
|
|||||||
"build-zip": "cd build && rev=$(git rev-list HEAD --count) && echo r$rev > revision && zip -9 -r ../buildZip/Tachidesk-WebUI-r$rev *",
|
"build-zip": "cd build && rev=$(git rev-list HEAD --count) && echo r$rev > revision && zip -9 -r ../buildZip/Tachidesk-WebUI-r$rev *",
|
||||||
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
|
"lint": "eslint src --ext .ts,.tsx,.js,.jsx",
|
||||||
"createChangelog": "ts-node tools/scripts/createReleaseChanglog.ts",
|
"createChangelog": "ts-node tools/scripts/createReleaseChanglog.ts",
|
||||||
"updateDeps": "yarn outdated && yarn upgrade && yarn syncyarnlock -s -k && yarn && git add package.json yarn.lock && git commit -m \"Update dependencies\""
|
"updateDeps": "yarn outdated && yarn upgrade && yarn syncyarnlock -s -k && yarn && git add package.json yarn.lock && git commit -m \"Update dependencies\"",
|
||||||
|
"gql:codegen": "graphql-codegen --config gql_codegen.ts"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
@@ -51,6 +52,10 @@
|
|||||||
"vite-tsconfig-paths": "^4.2.1"
|
"vite-tsconfig-paths": "^4.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@graphql-codegen/cli": "^5.0.0",
|
||||||
|
"@graphql-codegen/client-preset": "^4.1.0",
|
||||||
|
"@graphql-codegen/typescript-apollo-client-helpers": "^2.2.6",
|
||||||
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
||||||
"@types/apollo-upload-client": "^17.0.2",
|
"@types/apollo-upload-client": "^17.0.2",
|
||||||
"@types/node": "^20.6.2",
|
"@types/node": "^20.6.2",
|
||||||
"@types/react": "^18.2.21",
|
"@types/react": "^18.2.21",
|
||||||
|
|||||||
@@ -8,6 +8,6 @@
|
|||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"vite.config.ts",
|
"vite.config.ts",
|
||||||
"vite.config.ts"
|
"gql_codegen.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user