Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Codegen dependencies and make it stable #1108

Merged
merged 30 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
77e31d8
Update codegen dependencies
frandiox Jul 17, 2023
ae4987d
Revert "Maybe fix not found queries issue from monorepo"
frandiox Jul 17, 2023
4448a11
Make codegen flags stable
frandiox Jul 17, 2023
77fbc6e
Make codegen command stable
frandiox Jul 17, 2023
2f7d2b6
Workaround for latest codegen/cli bug
frandiox Jul 17, 2023
8d46b77
Update hydrogen-react types to latest codegen/cli
frandiox Jul 17, 2023
ecfb19b
Merge branch 'main' into fd-codegen-stable
frandiox Oct 16, 2023
1c87137
Fix removing unstable
frandiox Oct 16, 2023
f83b967
Update gql to latest versions
frandiox Oct 16, 2023
39cf82a
Update generated SFAPI types to new ts plugin version
frandiox Oct 17, 2023
53f56b3
Fix issue where gql documents were not found the first time the proje…
frandiox Oct 17, 2023
b10f3e5
Patch another gql package for a bug fix
frandiox Oct 17, 2023
7b203b6
Fix cjs build
frandiox Oct 17, 2023
60c9212
Fix usage of scalars
frandiox Oct 17, 2023
008643d
Fix codegen test
frandiox Oct 17, 2023
c0c49b6
Fix test by importing patch before code
frandiox Oct 17, 2023
03843dc
Ensure gql has the correct cwd in tests
frandiox Oct 17, 2023
82b4900
Simplify patching
frandiox Oct 17, 2023
27f2c54
Make patch synchronous to support CJS
frandiox Oct 17, 2023
4aed8c0
Use stable --codegen flag in templates
frandiox Oct 17, 2023
5e19740
Fix tests again
frandiox Oct 17, 2023
63ee9d5
Remove warning
frandiox Oct 17, 2023
0c55b29
Changesets
frandiox Oct 17, 2023
9c407ea
Cleanup
frandiox Oct 17, 2023
e03f492
Merge branch 'main' into fd-codegen-stable
frandiox Oct 18, 2023
7e5acd4
Cleanup
frandiox Oct 18, 2023
12f02bb
Update version change
frandiox Oct 18, 2023
5b3018d
Merge branch 'main' into fd-codegen-stable
frandiox Oct 26, 2023
af3b087
Fix type
frandiox Oct 26, 2023
2b31858
Changesets
frandiox Oct 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fuzzy-singers-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/hydrogen-codegen': patch
---

Remove warning when this package is used without `@shopify/hydrogen`.
5 changes: 5 additions & 0 deletions .changeset/orange-socks-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': minor
---

The Codegen feature is now considered stable and related dependencies have been updated. Use `--codegen` flag instead of `--codegen-unstable` to generate code from your GraphQL queries.
25 changes: 25 additions & 0 deletions .changeset/pink-bottles-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
'@shopify/hydrogen-codegen': minor
---

Removed the `patchGqlPluck` named export from the main entrypoint.

Added `@shopify/hydrogen-codegen/patch` entrypoint that automatically patches the necessary files. This is applied automatically by Hydrogen CLI.
If you're using the `graphql-codegen` CLI directly, you can either run it as a Node loader with `node -r @shopify/hydrogen-codegen/patch node_modules/.bin/graphql-codegen` or import it in your `codegen.ts` file before anything else:

```js
import '@shopify/hydrogen-codegen/patch';
import {preset, schema, pluckConfig} from '@shopify/hydrogen-codegen';

export default {
overwrite: true,
pluckConfig,
generates: {
'storefrontapi.generated.d.ts': {
preset,
schema,
documents: ['...'],
},
},
};
```
26 changes: 26 additions & 0 deletions .changeset/tender-teachers-allow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
'@shopify/hydrogen-react': patch
'@shopify/hydrogen': patch
---

The Storefront API types included are now generated using `@graphql-codegen/typescript@4` ([changelog](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/plugins/typescript/typescript/CHANGELOG.md#400)). This results in a breaking change if you were importing `Scalars` directly from `@shopify/hydrogen-react` or `@shopify/hydrogen`.

Before:

```tsx
import type {Scalars} from '@shopify/hydrogen/storefront-api-types';

type Props = {
id: Scalars['ID']; // This was a string
};
```

After:

```tsx
import type {Scalars} from '@shopify/hydrogen/storefront-api-types';

type Props = {
id: Scalars['ID']['input']; // Need to access 'input' or 'output' to get the string
};
```
Loading
Loading