{"id":20994065,"url":"https://github.com/amirrezadev1378/swr-codegen","last_synced_at":"2025-05-14T21:30:38.605Z","repository":{"id":198525697,"uuid":"691589852","full_name":"amirrezaDev1378/swr-codegen","owner":"amirrezaDev1378","description":"swr graphql codegen","archived":false,"fork":false,"pushed_at":"2024-09-26T14:53:31.000Z","size":274,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-01T17:52:18.808Z","etag":null,"topics":["codegen","codegenerator","graphql","swr","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amirrezaDev1378.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-09-14T13:39:07.000Z","updated_at":"2024-09-26T14:53:35.000Z","dependencies_parsed_at":"2023-12-05T12:31:00.637Z","dependency_job_id":"09998e98-4db6-4aff-9dcc-2103d6981854","html_url":"https://github.com/amirrezaDev1378/swr-codegen","commit_stats":null,"previous_names":["amirrezadev1378/swr-codegen"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirrezaDev1378%2Fswr-codegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirrezaDev1378%2Fswr-codegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirrezaDev1378%2Fswr-codegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amirrezaDev1378%2Fswr-codegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amirrezaDev1378","download_url":"https://codeload.github.com/amirrezaDev1378/swr-codegen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254230746,"owners_count":22036230,"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":["codegen","codegenerator","graphql","swr","typescript"],"created_at":"2024-11-19T07:16:46.186Z","updated_at":"2025-05-14T21:30:38.315Z","avatar_url":"https://github.com/amirrezaDev1378.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SWR GraphQl Code Generator\n\n### A powerful code generator that Generate SWR hooks from GraphQL queries \u0026 mutations A Powerfull Code Generator For SWR\n\n[![npm version](https://badge.fury.io/js/swr-codegen.svg)](https://badge.fury.io/js/swr-codegen)\n[![npm downloads](https://img.shields.io/npm/dm/swr-codegen.svg)](https://www.npmjs.com/package/swr-codegen)\n\n# Table Of Contents\n\n\u003c!-- TOC --\u003e\n\n- [How to Use](#how-to-use)\n\n\u003c!-- TOC --\u003e\n\n## How to Use\n\nInstalling The Package:\n\n⚠️ This package does not support global installation anymore,\n\nyou can install it in your project using:\n\n    npm i swr-codegen -d\n\nAdding config file inside your project:\n\n1. create a javascript file anywhere in your project e.g. `codegen-config.js`\n\n2. add your configs:\n\nyou can use the init command : `swr-codegen --init`\nto create a config file with default configs, or you can create a config file manually:\n\n```js\nconst fs = require(\"fs\");\n\nmodule.exports = {\n\tgqlGlob: \"./**/*.gql\",\n\ttargetPath: \"/generated/swr/\",\n\tschema: async () =\u003e {\n\t\treturn fs.readFileSync(\"graphql/schema.graphql\").toString();\n\t},\n};\n```\n\n3. (optional) Add a codegen command to your package.json:\n\n```json\n\n\"scripts\": {\n  ...\n  \"codegen\": \"swr-codegen --configPath=./codegen-config.js\"\n}\n\n```\n\nThat's it! run `npm run codegen` (or `swr-codegen configPath=./codegen-config.js`)\n\nHigh-Priority Tasks:\n\n- add a better error-handling system.\n\n- add an option to customize the EJS templates.\n\n- adding path normalizer\n\nRepository Owners:\n\n[Rasoul](https://github.com/rasoulm777) And [Amirreza](https://github.com/amirrezaDev1378)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirrezadev1378%2Fswr-codegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famirrezadev1378%2Fswr-codegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famirrezadev1378%2Fswr-codegen/lists"}