Skip to content

[near-operation-file] Make near-operation-file-preset support typescript-operations v6#1385

Merged
eddeee888 merged 4 commits into
mainfrom
make-near-operation-file-preset-support-new-use-case
Mar 4, 2026
Merged

[near-operation-file] Make near-operation-file-preset support typescript-operations v6#1385
eddeee888 merged 4 commits into
mainfrom
make-near-operation-file-preset-support-new-use-case

Conversation

@eddeee888
Copy link
Copy Markdown
Collaborator

Description

typescript-operations v6 release has its own import option. This means when near-operation-file is used with it, the preset doesn't have to handle type imports i.e. it's only role is to create a near-operation-file next to the document.

Without this change, baseTypesPath forces an import statement, which makes it impossible to integrate with v6 release

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 4, 2026

🦋 Changeset detected

Latest commit: 7c37c92

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/near-operation-file-preset Major

Not sure what this means? Click here to learn what changesets are.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 4, 2026

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-codegen/near-operation-file-preset 5.0.0-alpha-20260304130322-7c37c926be2ca699398a65305e8fdb2d57e687a0 npm ↗︎ unpkg ↗︎

* generates: {
* 'path/to/file.ts': {
* preset: 'near-operation-file',
* plugins: ['typescript-operations'],
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to use typescript-operations in this example because baseTypesPath cannot be used with it.

Comment on lines +224 to +226
const importTypesNamespace =
options.presetConfig.importTypesNamespace ||
(options.presetConfig.baseTypesPath ? 'Types' : undefined); // When there is `baseTypesPath`, we assume there'd be a type import, so we default `importTypesNamespace` value to `Types` for convenience.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddeee888 eddeee888 merged commit 76d5e05 into main Mar 4, 2026
15 checks passed
@eddeee888 eddeee888 changed the title [near-operation-file] Make near operation file preset support typescript-operations v6 [near-operation-file] Make near-operation-file-preset support typescript-operations v6 Mar 4, 2026
Copy link
Copy Markdown

@benquarmby benquarmby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬

* ```
*/
baseTypesPath: string;
baseTypesPath?: string;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless this breaks compatibility with typescript-operations@5, this was not a breaking change.

Making a required input field optional makes the API more flexible and less likely to break. From what I can tell, relaxing this and adding forwards compatibility with typescript-operations@6 should have been a straight feature.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a very good point @benquarmby 🤔
Maybe this specific change should have been marked as a minor bump instead.

However, since we were also bumping the internally shared packages up a few major versions in the same release, the change would be included a major version release (but just not marked as "Breaking change")

Usually internal version bumps would be patches but they had breaking changes such as dropping support for Node 12, so it's safer in a major version.

@eddeee888 eddeee888 deleted the make-near-operation-file-preset-support-new-use-case branch March 12, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants