eddeee888 / graphql-code-generator-plugins

List of GraphQL Code Generator plugins that complements the official plugins.
MIT License
50 stars 12 forks source link

Update dependency @graphql-codegen/plugin-helpers to v4.2.0 - autoclosed #116

Closed renovate[bot] closed 1 year ago

renovate[bot] commented 1 year ago

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@graphql-codegen/plugin-helpers 4.0.0 -> 4.2.0 age adoption passing confidence

Release Notes

dotansimha/graphql-code-generator ### [`v4.2.0`](https://togithub.com/dotansimha/graphql-code-generator/blob/HEAD/packages/utils/plugins-helpers/CHANGELOG.md#​420) [Compare Source](https://togithub.com/dotansimha/graphql-code-generator/compare/8af0f220506b077f3cdde9a11bdd489ec1e5bdb5...@graphql-codegen/plugin-helpers@4.2.0) ##### Minor Changes - [#​9151](https://togithub.com/dotansimha/graphql-code-generator/pull/9151) [`b7dacb21f`](https://togithub.com/dotansimha/graphql-code-generator/commit/b7dacb21fb0ed1173d1e45120dc072e29231ed29) Thanks [@​'./user/schema.mappers#UserMapper',](https://togithub.com/'./user/schema.mappers#UserMapper',)! - Add `watchPattern` config option for `generates` sections. By default, `watch` mode automatically watches all GraphQL schema and document files. This means when a change is detected, Codegen CLI is run. A user may want to run Codegen CLI when non-schema and non-document files are changed. Each `generates` section now has a `watchPattern` option to allow more file patterns to be added to the list of patterns to watch. In the example below, mappers are exported from `schema.mappers.ts` files. We want to re-run Codegen if the content of `*.mappers.ts` files change because they change the generated types file. To solve this, we can add mapper file patterns to watch using the glob pattern used for schema and document files. ```ts // codegen.ts const config: CodegenConfig = { schema: 'src/schema/**/*.graphql', generates: { 'src/schema/types.ts': { plugins: ['typescript', 'typescript-resolvers'], config: { mappers: { Book: './book/schema.mappers#BookMapper', }, } watchPattern: 'src/schema/**/*.mappers.ts', // Watches mapper files in `watch` mode. Use an array for multiple patterns e.g. `['src/*.pattern1.ts','src/*.pattern2.ts']` }, }, }; ``` Then, run Codegen CLI in `watch` mode: ```shell yarn graphql-codegen --watch ``` Now, updating `*.mappers.ts` files re-runs Codegen! πŸŽ‰ Note: `watchPattern` is only used in `watch` mode i.e. running CLI with `--watch` flag. ##### Patch Changes - [`f104619ac`](https://togithub.com/dotansimha/graphql-code-generator/commit/f104619acd27c9d62a06bc577737500880731087) Thanks [@​saihaj](https://togithub.com/saihaj)! - Resolve issue with nesting fields in `@provides` directive being prevented ### [`v4.1.0`](https://togithub.com/dotansimha/graphql-code-generator/blob/HEAD/packages/utils/plugins-helpers/CHANGELOG.md#​410) [Compare Source](https://togithub.com/dotansimha/graphql-code-generator/compare/@graphql-codegen/plugin-helpers@4.0.0...8af0f220506b077f3cdde9a11bdd489ec1e5bdb5) ##### Minor Changes - [#​8893](https://togithub.com/dotansimha/graphql-code-generator/pull/8893) [`a118c307a`](https://togithub.com/dotansimha/graphql-code-generator/commit/a118c307a35bbb97b7cbca0f178a88276032a26c) Thanks [@​n1ru4l](https://togithub.com/n1ru4l)! - mark `plugins` in config optional - [#​8723](https://togithub.com/dotansimha/graphql-code-generator/pull/8723) [`a3309e63e`](https://togithub.com/dotansimha/graphql-code-generator/commit/a3309e63efed880e6f74ce6fcbf82dd3d7857a15) Thanks [@​kazekyo](https://togithub.com/kazekyo)! - Introduce a new feature called DocumentTransform. DocumentTransform is a functionality that allows you to modify `documents` before they are processed by plugins. You can use functions passed to the `documentTransforms` option to make changes to GraphQL documents. To use this feature, you can write `documentTransforms` as follows: ```ts import type { CodegenConfig } from '@​graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }, ], }, }, }; export default config; ``` For instance, to remove a `@localOnlyDirective` directive from `documents`, you can write the following code: ```js import type { CodegenConfig } from '@​graphql-codegen/cli'; import { visit } from 'graphql'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: [ { transform: ({ documents }) => { return documents.map(documentFile => { documentFile.document = visit(documentFile.document, { Directive: { leave(node) { if (node.name.value === 'localOnlyDirective') return null; }, }, }); return documentFile; }); }, }, ], }, }, }; export default config; ``` DocumentTransform can also be specified by file name. You can create a custom file for a specific transformation and pass it to `documentTransforms`. Let's create the document transform as a file: ```js module.exports = { transform: ({ documents }) => { // Make some changes to the documents return documents; }, }; ``` Then, you can specify the file name as follows: ```ts import type { CodegenConfig } from '@​graphql-codegen/cli'; const config: CodegenConfig = { schema: 'https://localhost:4000/graphql', documents: ['src/**/*.tsx'], generates: { './src/gql/': { preset: 'client', documentTransforms: ['./my-document-transform.js'], }, }, }; export default config; ``` ##### Patch Changes - [#​8879](https://togithub.com/dotansimha/graphql-code-generator/pull/8879) [`8206b268d`](https://togithub.com/dotansimha/graphql-code-generator/commit/8206b268dfb485a748fd7783a163cb0ee9931491) Thanks [@​renovate](https://togithub.com/apps/renovate)! - dependencies updates: - Updated dependency [`tslib@~2.5.0` β†—οΈŽ](https://www.npmjs.com/package/tslib/v/2.5.0) (from `~2.4.0`, in `dependencies`)

Configuration

πŸ“… Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

β™» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

πŸ”• Ignore: Close this PR and you won't be reminded about this update again.



This PR has been generated by Mend Renovate. View repository job log here.

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 2b1f677cfbb3397432c5350adc55166dc59a243b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR