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

[ci] release 2023-04 #897

Merged
merged 1 commit into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 0 additions & 5 deletions .changeset/eight-doors-complain.md

This file was deleted.

70 changes: 0 additions & 70 deletions .changeset/friendly-clouds-collect.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/giant-tigers-sit.md

This file was deleted.

7 changes: 0 additions & 7 deletions .changeset/hot-cats-dream.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/hungry-spiders-impress.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/itchy-dryers-repeat.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/neat-jokes-bathe.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/pink-gorillas-train.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/plenty-mice-smoke.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/selfish-zebras-change.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/shy-books-walk.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/tricky-rocks-perform.md

This file was deleted.

85 changes: 85 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,90 @@
# @shopify/cli-hydrogen

## 4.2.0

### Minor Changes

- Add **UNSTABLE** support for GraphQL Codegen to automatically generate types for every Storefront API query in the project via `@shopify/hydrogen-codegen`. ([#707](https://github.com/Shopify/hydrogen/pull/707)) by [@frandiox](https://github.com/frandiox)

> Note: This feature is unstable and subject to change in patch releases.

How to use it while unstable:

1. Write your queries/mutations in `.ts` or `.tsx` files and use the `#graphql` comment inside the strings. It's important that every query/mutation/fragment in your project has a **unique name**:

```ts
const UNIQUE_NAME_SHOP_QUERY = `#graphql
query unique_name_shop { shop { id } }
`;
```

If you use string interpolation in your query variables (e.g. for reusing fragments) you will need to specify `as const` after each interpolated template literal. This helps TypeScript infer the types properly instead of getting a generic `string` type:

```ts
const UNIQUE_NAME_SHOP_FRAGMENT = `#graphql
fragment unique_name_shop_fields on Shop { id name }
`;

const UNIQUE_NAME_SHOP_QUERY = `#graphql
query unique_name_shop { shop { ...unique_name_shop_fields } }
${UNIQUE_NAME_SHOP_FRAGMENT}
` as const;
```

2. Pass the queries to the Storefront client and do not specify a generic type value:

```diff
-import type {Shop} from '@shopify/hydrogen/storefront-api-types';
// ...
-const result = await storefront.query<{shop: Shop}>(UNIQUE_NAME_SHOP_QUERY);
+const result = await storefront.query(UNIQUE_NAME_SHOP_QUERY);
```

3. Pass the flag `--codegen-unstable` when running the development server, or use the new `codegen-unstable` command to run it standalone without a dev-server:

```bash
npx shopify hydrogen dev --codegen-unstable # Dev server + codegen watcher
npx shopify hydrogen codegen-unstable # One-off codegen
npx shopify hydrogen codegen-unstable --watch # Standalone codegen watcher
```

As a result, a new `storefrontapi.generated.d.ts` file should be generated at your project root. You don't need to reference this file from anywhere for it to work, but you should commit it every time the types change.

**Optional**: you can tune the codegen configuration by providing a `<root>/codegen.ts` file (or specify a different path with the `--codegen-config-path` flag) with the following content:

```ts
import type {CodegenConfig} from '@graphql-codegen/cli';
import {preset, pluckConfig, schema} from '@shopify/hydrogen-codegen';

export default <CodegenConfig>{
overwrite: true,
pluckConfig,
generates: {
['storefrontapi.generated.d.ts']: {
preset,
schema,
documents: ['*.{ts,tsx}', 'app/**/*.{ts,tsx}'],
},
},
};
```

Feel free to add your custom schemas and generation config here or read from different document files. Please, report any issue you find in our repository.

### Patch Changes

- Add command to list environments from a linked Hydrogen storefront. ([#889](https://github.com/Shopify/hydrogen/pull/889)) by [@graygilmore](https://github.com/graygilmore)

- Update dev command to automatically injected environment variables from a linked Hydrogen storefront ([#861](https://github.com/Shopify/hydrogen/pull/861)) by [@graygilmore](https://github.com/graygilmore)

- Adds the ability to specify an Environment's branch name to interact with Hydrogen storefront environment variables ([#883](https://github.com/Shopify/hydrogen/pull/883)) by [@graygilmore](https://github.com/graygilmore)

- Fixes issue where routes that begin with the url `/events` could not be created because an internal handler had claimed those routes already. The internal handler now listens at `/__minioxygen_events` so hopefully that doesn't conflict with anyone now. :) ([#915](https://github.com/Shopify/hydrogen/pull/915)) by [@frehner](https://github.com/frehner)

- Updated dependencies [[`112ac42a`](https://github.com/Shopify/hydrogen/commit/112ac42a095afc5269ae75ff15828f27b90c9687), [`2e1e4590`](https://github.com/Shopify/hydrogen/commit/2e1e45905444ab04fe1fe308ecd2bd00a0e8fce1)]:
- @shopify/[email protected]
- @shopify/[email protected]

## 4.1.2

### Patch Changes
Expand Down
Loading