[near-operation-file] Make near-operation-file-preset support typescript-operations v6#1385
Conversation
🦋 Changeset detectedLatest commit: 7c37c92 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
| * generates: { | ||
| * 'path/to/file.ts': { | ||
| * preset: 'near-operation-file', | ||
| * plugins: ['typescript-operations'], |
There was a problem hiding this comment.
I don't want to use typescript-operations in this example because baseTypesPath cannot be used with it.
| 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. |
There was a problem hiding this comment.
This implementation is similar to typescript-operations: https://github.com/dotansimha/graphql-code-generator/pull/10496/changes#diff-e4c7787437f1045671014bf574b66e2e8640de965d17fe8b0062e112947ffafdR283
| * ``` | ||
| */ | ||
| baseTypesPath: string; | ||
| baseTypesPath?: string; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Description
typescript-operationsv6 release has its own import option. This means whennear-operation-fileis 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,
baseTypesPathforces an import statement, which makes it impossible to integrate with v6 releaseType of change
expected)