{"id":19643386,"url":"https://github.com/nodkz/webpack-plugin-graphql-schema-hot","last_synced_at":"2025-04-28T13:30:47.477Z","repository":{"id":66122120,"uuid":"80283685","full_name":"nodkz/webpack-plugin-graphql-schema-hot","owner":"nodkz","description":"🔥 Webpack plugin which tracks changes in your schema and generates its introspection in `json` and `txt` formats","archived":false,"fork":false,"pushed_at":"2018-05-28T17:21:02.000Z","size":34,"stargazers_count":67,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-21T22:46:45.877Z","etag":null,"topics":["graphql","hot-reload","introspection","schema","webpack","webpack-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/nodkz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2017-01-28T12:39:29.000Z","updated_at":"2025-02-28T22:53:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"0fda62ea-8f11-4e81-9b77-eef87c1c86b0","html_url":"https://github.com/nodkz/webpack-plugin-graphql-schema-hot","commit_stats":{"total_commits":20,"total_committers":2,"mean_commits":10.0,"dds":"0.15000000000000002","last_synced_commit":"a5795e23993675eff819836b88e0f3969224e913"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodkz%2Fwebpack-plugin-graphql-schema-hot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodkz%2Fwebpack-plugin-graphql-schema-hot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodkz%2Fwebpack-plugin-graphql-schema-hot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodkz%2Fwebpack-plugin-graphql-schema-hot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodkz","download_url":"https://codeload.github.com/nodkz/webpack-plugin-graphql-schema-hot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251319747,"owners_count":21570450,"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","hot-reload","introspection","schema","webpack","webpack-plugin"],"created_at":"2024-11-11T14:21:12.077Z","updated_at":"2025-04-28T13:30:47.456Z","avatar_url":"https://github.com/nodkz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webpack-plugin-graphql-schema-hot\n\n[![NPM version](https://img.shields.io/npm/v/webpack-plugin-graphql-schema-hot.svg)](https://www.npmjs.com/package/webpack-plugin-graphql-schema-hot)\n[![npm](https://img.shields.io/npm/dt/webpack-plugin-graphql-schema-hot.svg)](http://www.npmtrends.com/webpack-plugin-graphql-schema-hot)\n\nThis is Webpack plugin which tracks changes in your GraphQL Schema files and re/generates schema introspection in `json` and `txt` formats. Just provide absolute path to your schema js and paths for output files in plugin options. And for every webpack rebuild plugin will check if changed files somehow related to schema and if so, will emmit new json and txt files. After that this files may be provided to eslint, babel or any other tool. Links to recommended tools can be found below.\n\n\u003cimg width=\"777\" alt=\"screen shot 2017-01-30 14 52 29\" src=\"https://cloud.githubusercontent.com/assets/1946920/22417218/6799cf1c-e6fd-11e6-8f4d-d3394077315d.png\"\u003e\n\n## Install\n\n```\nyarn add webpack-plugin-graphql-schema-hot --dev\n```\nor\n```\nnpm install webpack-plugin-graphql-schema-hot --save-dev\n```\n\n## Usage with webpack.config.js\n\n```js\nimport path from 'path';\nimport WebpackPluginGraphqlSchemaHot from 'webpack-plugin-graphql-schema-hot';\n\nconst config = {\n  // ...\n  plugins: [\n    new WebpackPluginGraphqlSchemaHot({\n      schemaPath: path.resolve(__dirname, '../schema/index.js'),\n      output: {\n        json: path.resolve(__dirname, '../build/schema.graphql.json'),\n        txt: path.resolve(__dirname, '../build/schema.graphql.txt'),\n      },\n      // output: (schemaPath) =\u003e {\n      //   cp.execSync(\n      //     'npm run generate-schema',\n      //     { cwd: path.resolve(__dirname, '../'), stdio: [0, 1, 2] }\n      //   );\n      // },\n      runOnStart: true, // default: false\n      waitOnStart: 0, // default: 0, set 2000 if you use babel-plugin-transform-relay-hot\n      waitOnRebuild: 0, // default: 0, set 2000 if you use babel-plugin-transform-relay-hot\n      verbose: true, // default: false\n      hideErrors: false, // default: false\n      excludes: ['**/__generated__/**'], // default: null\n    }),\n  ]\n}\n```\n\n## Options\n\n- **`schemaPath`**\n  - **Required**\n  - Type: `String`\n  - **Absolute path** to your graphql schema js file. Only this file and its dependencies will trigger generation of new files.\n- **`output`**\n  - **Required**\n  - Type: `Function` or `Object`\n  - If `Object`:\n    - You should provide `json` and/or `txt` properties with the **absolute** file path.\n  - If `Function`:\n    - This function may be `async` (in this case function should return `Promise`)\n    - `(schemaPath) =\u003e { /* you generation code */ }`. Sometimes you may want to generate schema in some exotic way, eg. under another babel environment. Just provide your function, which will be called instead of internal.\n- **`runOnStart`**\n  - Type: `Boolean`\n  - Default: `false`\n  - Generate schema files on start, before Webpack starts to compile your files.\n- **`waitOnStart`**\n  - Type: `Integer`\n  - Default: `0`\n  - How many milliseconds wait after generating schema files on start, before Webpack proceed. If you use Relay, install [babel-plugin-transform-relay-hot](https://github.com/nodkz/babel-plugin-transform-relay-hot) and set `2000`, that allows to reload `relayBabelPlugin` with new schema before Webpack proceed.\n- **`waitOnRebuild`**\n  - Type: `Integer`\n  - Default: `0`\n  - How many milliseconds wait after generating schema files on rebuild, before Webpack proceed.\n- **`verbose`**\n  - Type: `Boolean`\n  - Default: `false`\n  - Show more details\n- **`hideErrors`**\n  - Type: `Boolean`\n  - Default: `false`\n  - Hide runtime plugin errors. If you provide wrong options to plugin, it will show startup errors even `hideErrors=true`.\n - **`excludes`**\n   - Type: `Array of globs`\n   - Default: `null`\n   - Do not track changes in files which globs match filename. You should provide glob for absolute path, eg. `**/temp/**`, just `temp` or `temp/` won't match all files inside the directory. \n\n## Recommended tools\n- [babel-plugin-transform-relay-hot](https://github.com/nodkz/babel-plugin-transform-relay-hot) 🔥 if you use `Relay`, this plugin wraps standard `babelRelayPlugin` and hot reload it if `schema.json` file was changed without restarting dev server.\n- [eslint-plugin-graphql](https://github.com/apollostack/eslint-plugin-graphql) 🔥 if you use `Atom` editor, this plugin may also track changes of `schema.json` file on fly.\n- [js-graphql-intellij-plugin](https://github.com/jimkyndemeyer/js-graphql-intellij-plugin) 🔥 if you use `WebStorm` or any other IntelliJ IDEA editor.\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodkz%2Fwebpack-plugin-graphql-schema-hot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodkz%2Fwebpack-plugin-graphql-schema-hot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodkz%2Fwebpack-plugin-graphql-schema-hot/lists"}