chore: 更新VSCode配置和重构生成文件结构
- 添加推荐的VSCode扩展配置。 - 修改生成文件路径,将GraphQL生成目录从'./graphql/__generated__/'更改为'./generated/graphql/'。 - 重命名文件 fragment-masking.ts。 - 重命名生成的GraphQL文档文件并移除不必要的查询定义。 - 重命名文件并移除无用的查询类型定义。 - 重命名生成的GraphQL索引文件。 - 修正导入路径以反映新的 GraphQL 生成文件位置。
This commit is contained in:
parent
ae97dc0a5f
commit
e10a458dbe
5
.vscode/extensions.json
vendored
Normal file
5
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"graphql.vscode-graphql"
|
||||
]
|
||||
}
|
@ -5,7 +5,7 @@ const config: CodegenConfig = {
|
||||
// this assumes that all your source files are in a top-level `src/` directory - you might need to adjust this to your file structure
|
||||
documents: ['src/**/*.{ts,tsx}'],
|
||||
generates: {
|
||||
'./graphql/__generated__/': {
|
||||
'./generated/graphql/': {
|
||||
preset: 'client',
|
||||
plugins: [],
|
||||
presetConfig: {
|
||||
|
@ -15,11 +15,9 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
|
||||
*/
|
||||
type Documents = {
|
||||
"\n query GetUserProjects {\n demo_users {\n id\n name\n projects {\n demo_projects_id {\n id\n name\n }\n }\n }\n }\n": typeof types.GetUserProjectsDocument,
|
||||
"\n query get {\n demo_projects {\n id\n }\n }": typeof types.GetDocument,
|
||||
};
|
||||
const documents: Documents = {
|
||||
"\n query GetUserProjects {\n demo_users {\n id\n name\n projects {\n demo_projects_id {\n id\n name\n }\n }\n }\n }\n": types.GetUserProjectsDocument,
|
||||
"\n query get {\n demo_projects {\n id\n }\n }": types.GetDocument,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -40,10 +38,6 @@ export function gql(source: string): unknown;
|
||||
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||
*/
|
||||
export function gql(source: "\n query GetUserProjects {\n demo_users {\n id\n name\n projects {\n demo_projects_id {\n id\n name\n }\n }\n }\n }\n"): (typeof documents)["\n query GetUserProjects {\n demo_users {\n id\n name\n projects {\n demo_projects_id {\n id\n name\n }\n }\n }\n }\n"];
|
||||
/**
|
||||
* The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
||||
*/
|
||||
export function gql(source: "\n query get {\n demo_projects {\n id\n }\n }"): (typeof documents)["\n query get {\n demo_projects {\n id\n }\n }"];
|
||||
|
||||
export function gql(source: string) {
|
||||
return (documents as any)[source] ?? {};
|
@ -3512,11 +3512,5 @@ export type GetUserProjectsQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
export type GetUserProjectsQuery = { __typename?: 'Query', demo_users: Array<{ __typename?: 'demo_users', id: string, name: string, projects?: Array<{ __typename?: 'demo_users_demo_projects', demo_projects_id?: { __typename?: 'demo_projects', id: string, name: string } | null } | null> | null }> };
|
||||
|
||||
export type GetQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type GetQuery = { __typename?: 'Query', demo_projects: Array<{ __typename?: 'demo_projects', id: string }> };
|
||||
|
||||
|
||||
export const GetUserProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetUserProjects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"demo_users"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"demo_projects_id"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode<GetUserProjectsQuery, GetUserProjectsQueryVariables>;
|
||||
export const GetDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"get"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"demo_projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode<GetQuery, GetQueryVariables>;
|
@ -1,4 +1,4 @@
|
||||
import type { GetUserProjectsQuery, GetUserProjectsQueryVariables } from "../graphql/__generated__/graphql"
|
||||
import type { GetUserProjectsQuery, GetUserProjectsQueryVariables } from "../generated/graphql/graphql"
|
||||
import { graphqlClient } from "./graphql-client"
|
||||
import { getUserProjectsGQL } from "./gql"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user