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:
import type { CodegenConfig } from '@graphql-codegen/cli';
Dependabot commands
You can trigger Dependabot actions by commenting on this MR
$dependabot rebase will rebase this MR
$dependabot recreate will recreate this MR rewriting all the manual changes and resolving conflicts
Bumps [@graphql-codegen/cli](https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli) from 3.0.0 to 3.1.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/dotansimha/graphql-code-generator/blob/master/packages/graphql-codegen-cli/CHANGELOG.md"><code>@graphql-codegen/cli</code>'s changelog</a>.</em></p>
<blockquote>
<h2>3.1.0</h2>
<h3>Minor Changes</h3>
<ul>
<li>
<p><a href="https://github.com/dotansimha/graphql-code-generator/pull/8893">#8893</a> <a href="https://github.com/dotansimha/graphql-code-generator/commit/a118c307a35bbb97b7cbca0f178a88276032a26c"><code>a118c307a</code></a> Thanks <a href="https://github.com/n1ru4l"><code>@n1ru4l</code></a>! - It is no longer mandatory to declare an empty plugins array when using a preset</p>
</li>
<li>
<p><a href="https://github.com/dotansimha/graphql-code-generator/pull/8723">#8723</a> <a href="https://github.com/dotansimha/graphql-code-generator/commit/a3309e63efed880e6f74ce6fcbf82dd3d7857a15"><code>a3309e63e</code></a> Thanks <a href="https://github.com/kazekyo"><code>@kazekyo</code></a>! - Introduce a new feature called DocumentTransform.</p>
<p>DocumentTransform is a functionality that allows you to modify <code>documents</code> before they are processed by plugins. You can use functions passed to the <code>documentTransforms</code> option to make changes to GraphQL documents.</p>
<p>To use this feature, you can write <code>documentTransforms</code> as follows:</p>
<pre lang="ts"><code>import type { CodegenConfig } from '@graphql-codegen/cli';
<p>const config: CodegenConfig = {
schema: '<a href="https://localhost:4000/graphql">https://localhost:4000/graphql</a>',
documents: ['src/**/*.tsx'],
generates: {
'./src/gql/': {
preset: 'client',
documentTransforms: [
{
transform: ({ documents }) => {
// Make some changes to the documents
return documents;
},
},
],
},
},
};
export default config;
</code></pre></p>
<p>For instance, to remove a <code>@localOnlyDirective</code> directive from <code>documents</code>, you can write the following code:</p>
<pre lang="js"><code>import type { CodegenConfig } from '@graphql-codegen/cli';
import { visit } from 'graphql';
<p>const config: CodegenConfig = {
schema: '<a href="https://localhost:4000/graphql">https://localhost:4000/graphql</a>',
documents: ['src/**/*.tsx'],
generates: {
'./src/gql/': {
preset: 'client',
documentTransforms: [
{
transform: ({ documents }) => {
</code></pre></p>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/f68909b79a738528503d85d852ffd4eeb6764df9"><code>f68909b</code></a> chore(release): update monorepo packages versions (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6441">#6441</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/24185985a38a8847f5904a55fa69546c25144e1a"><code>2418598</code></a> fix: bump graphql-tools versions (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6511">#6511</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/72044c1bd9d159d51ab282db36ff194fcbcb1a6b"><code>72044c1</code></a> fix: do not alter the indentation of documents loaded via graphql-config (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6494">#6494</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/39773f59b07f07d23d99caee2b15a8921aace464"><code>39773f5</code></a> enhance(plugins): use getDocumentNodeFromSchema and other utilities from <a href="https://github.com/gra"><code>@gra</code></a>...</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/440172cfe7a5df79c491f14442ab8fa47714b5da"><code>440172c</code></a> ESM support (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6102">#6102</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/5bf1e535a6574de5a800023dd3ea4462fae9e801"><code>5bf1e53</code></a> chore(release): update monorepo packages versions (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6404">#6404</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/edd029e8709aff6020a8a26730e6a6a7d506f7dc"><code>edd029e</code></a> fix(graphql-modules-preset): do not parse SDL and use extendedSources… (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6403">#6403</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/d4e0cf0b873a80f748a5f15e2e6a1dc1a746b7c3"><code>d4e0cf0</code></a> Upcoming Release Changes (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6398">#6398</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/e8bc671a0f4145e9a24436c86ab0d24f94e91725"><code>e8bc671</code></a> Fixes relative custom imports & empty plugins (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6231">#6231</a>)</li>
<li><a href="https://github.com/dotansimha/graphql-code-generator/commit/b0cb13df418632b2b82c24129770f2b2a281e849"><code>b0cb13d</code></a> graphql-tools-update | gql-tag preset/plugin | drop node 10 support (<a href="https://github.com/dotansimha/graphql-code-generator/tree/HEAD/packages/graphql-codegen-cli/issues/6267">#6267</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/dotansimha/graphql-code-generator/commits/@graphql-codegen/add@3.1.0/packages/graphql-codegen-cli">compare view</a></li>
</ul>
</details>
<br />
---
<details>
<summary>Dependabot commands</summary>
<br />
You can trigger Dependabot actions by commenting on this MR
- `$dependabot rebase` will rebase this MR
- `$dependabot recreate` will recreate this MR rewriting all the manual changes and resolving conflicts
</details>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Bumps @graphql-codegen/cli from 3.0.0 to 3.1.0.
Changelog
Sourced from
@graphql-codegen/cli's changelog.... (truncated)
Commits
f68909bchore(release): update monorepo packages versions (#6441)2418598fix: bump graphql-tools versions (#6511)72044c1fix: do not alter the indentation of documents loaded via graphql-config (#6494)39773f5enhance(plugins): use getDocumentNodeFromSchema and other utilities from@gra...440172cESM support (#6102)5bf1e53chore(release): update monorepo packages versions (#6404)edd029efix(graphql-modules-preset): do not parse SDL and use extendedSources… (#6403)d4e0cf0Upcoming Release Changes (#6398)e8bc671Fixes relative custom imports & empty plugins (#6231)b0cb13dgraphql-tools-update | gql-tag preset/plugin | drop node 10 support (#6267)Dependabot commands
You can trigger Dependabot actions by commenting on this MR
$dependabot rebasewill rebase this MR$dependabot recreatewill recreate this MR rewriting all the manual changes and resolving conflictsadded 3 commits
mastere4c6d4da- Build(deps-dev): bump @graphql-codegen/cli from 3.0.0 to 3.1.0Compare with previous version