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

[ci] release 2023-04 #897

merged 1 commit into from
May 23, 2023

Conversation

shopify-github-actions-access[bot]
Copy link
Contributor

@shopify-github-actions-access shopify-github-actions-access bot commented May 17, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to 2023-04, this PR will be updated.

Releases

@shopify/[email protected]

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) by @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:

      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:

      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:

      -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:

      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:

    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) by @graygilmore

  • Update dev command to automatically injected environment variables from a linked Hydrogen storefront (#861) by @graygilmore

  • Adds the ability to specify an Environment's branch name to interact with Hydrogen storefront environment variables (#883) by @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) by @frehner

  • Updated dependencies [112ac42a, 2e1e4590]:

@shopify/[email protected]

Patch Changes

  • Add support for generated types from the new unstable codegen feature in the CLI. (#707) by @frandiox

  • Add a <Pagination__unstable> component and getPaginationVariables__unstable helper to make rendering large lists from the Storefront API easy. This is an initial unstable release and we expect to finalize the API by the 2023-07 release. See the <Pagination> component documentation. (#755) by @cartogram

  • Updated dependencies [2e1e4590]:

@shopify/[email protected]

Patch Changes

  • New package that provides GraphQL Codegen plugins and configuration to generate types automatically for Storefront queries in Hydrogen. (#707) by @frandiox

    While in alpha/beta, this package should not be used standalone without the Hydrogen CLI.

@shopify/[email protected]

Patch Changes

  • Fix issue where the <BuyNowButton/> would incorrectly redirect to checkout when React re-renders in certain situations. (#827) by @tiwac100

[email protected]

Patch Changes

@github-actions github-actions bot force-pushed the changeset-release/2023-04 branch 12 times, most recently from 125fe29 to be55e81 Compare May 19, 2023 21:05
@github-actions github-actions bot force-pushed the changeset-release/2023-04 branch from be55e81 to 76b4841 Compare May 23, 2023 15:30
@blittle blittle merged commit b132047 into 2023-04 May 23, 2023
@blittle blittle deleted the changeset-release/2023-04 branch May 23, 2023 15:37
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.

1 participant