{"id":19700160,"url":"https://github.com/ilijanl/graphql-codegen-on-operations","last_synced_at":"2025-08-20T20:30:01.469Z","repository":{"id":184467351,"uuid":"656140292","full_name":"ilijaNL/graphql-codegen-on-operations","owner":"ilijaNL","description":"Generic graphql-codegen plugin to generate some code from operations/fragments","archived":false,"fork":false,"pushed_at":"2023-06-20T12:43:32.000Z","size":188,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T05:06:17.609Z","etag":null,"topics":["graphql","graphql-codegen","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilijaNL.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-20T10:30:56.000Z","updated_at":"2023-09-12T15:44:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"ed916933-d325-49f1-bc2d-6ef1f60a3d59","html_url":"https://github.com/ilijaNL/graphql-codegen-on-operations","commit_stats":null,"previous_names":["ilijanl/graphql-codegen-on-operations"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilijaNL%2Fgraphql-codegen-on-operations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilijaNL%2Fgraphql-codegen-on-operations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilijaNL%2Fgraphql-codegen-on-operations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilijaNL%2Fgraphql-codegen-on-operations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilijaNL","download_url":"https://codeload.github.com/ilijaNL/graphql-codegen-on-operations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251509557,"owners_count":21600662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-codegen","typescript"],"created_at":"2024-11-11T21:04:10.741Z","updated_at":"2025-04-29T13:31:37.164Z","avatar_url":"https://github.com/ilijaNL.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL codegen plugin to generate some code/configuration from operations/fragments\n\nA plugin for [https://the-guild.dev/graphql/codegen](graphql-codegen) to create a signature from your documents which can be validated on the server\n\n## Install\n\nInstall graphql-code-generator and this plugin\n\n    yarn add -D @graphql-codegen/cli @graphql-codegen/typescript @graphql-codegen/typescript-operations graphql-codegen-on-operations\n\n## Usage\n\nCreate codegen.ts\n\n```ts\nimport * as dotenv from 'dotenv'; // see https://github.com/motdotla/dotenv#how-do-i-use-dotenv-with-import\ndotenv.config();\nimport type { CodegenConfig } from '@graphql-codegen/cli';\nimport createSignFn from 'graphql-codegen-on-operations/lib/use/signing';\nimport createListFn from 'graphql-codegen-on-operations/lib/use/listing';\nimport { GenerateFn } from 'graphql-codegen-on-operations';\nimport { print } from 'graphql';\n\nconst customGen: GenerateFn = (_schema, { documents }) =\u003e {\n  return JSON.stringify(documents.map((d) =\u003e print(d.node)).join('\\n'), null, 2);\n};\n\nconst config: CodegenConfig = {\n  schema: 'http://localhost:3000/api/graphql',\n  documents: ['gql/**/*.graphql'],\n  generates: {\n    './__generated__/gql.ts': {\n      plugins: ['typescript', 'typescript-operations', 'typed-document-node'],\n    },\n    './__generated__/signed-operations.json': {\n      plugins: ['graphql-codegen-on-operations'],\n      config: {\n        gen: createSignFn({\n          // should be long and not exposed to public\n          secret: process.env.SIGNING_SECRET,\n        }),\n      },\n    },\n    './__generated__/list-operations.json': {\n      plugins: ['graphql-codegen-on-operations'],\n      config: {\n        gen: createListFn(),\n      },\n    },\n    './__generated__/custom.json': {\n      plugins: ['graphql-codegen-on-operations'],\n      config: {\n        gen: customGen,\n      },\n    },\n  },\n};\nexport default config;\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filijanl%2Fgraphql-codegen-on-operations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filijanl%2Fgraphql-codegen-on-operations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filijanl%2Fgraphql-codegen-on-operations/lists"}