Skip to content

Latest commit

 

History

History
972 lines (587 loc) · 54.2 KB

CHANGELOG.md

File metadata and controls

972 lines (587 loc) · 54.2 KB

@shopify/cli-hydrogen

8.0.4

Patch Changes

8.0.3

Patch Changes

  • Update internal @shopify/cli-kit dependency to fix React version mismatches. (#2059) by @frandiox

8.0.2

Patch Changes

  • Pin React dependency to 18.2.0 to avoid mismatches. (#2051) by @frandiox

8.0.1

Patch Changes

  • Clean up messaging around unlinked storefronts when running CLI commands (#1937) by @aswamy

    • When you run env list, env pull, or deploy against a storefront that isn't linked, it will show a warning message instead of an error message.
    • If you don't have a storefront to link to on Admin, we will just ask you to create a storefront instead of displaying an option list of size 1.
    • If you deleted a storefront on Admin, we will try to relink your storefront when running env list, env pull, or deploy.
  • Add @return JSDoc tag to functions in JavaScript projects. (#2014) by @frandiox

  • Fix --quickstart flag to support overwritting it with other flags. Example: h2 init --quickstart --no-install-deps. (#2023) by @frandiox

    Show error in h2 debug cpu command for Vite projects until we support it.

    Remove deprecated --styling flag from the h2 init command.

  • Fix a warning when combining mock.shop and customer-account-push (#1992) by @frandiox

  • Updated dependencies [7e8cf055, a335afc1]:

    • @shopify/mini-oxygen@3.0.1

8.0.0

Major Changes

  • Hydrogen CLI now requires @shopify/mini-oxygen to be installed separately as a dev dependency. It is still used automatically under the hood so there is no need to change your application code aside from installing the dependency. (#1891) by @frandiox

    Also, if a port provided via --port or --inspector-port flags is already in use, the CLI will now exit with an error message instead of finding a new open port. When the flags are not provided, the CLI will still find an open port.

Minor Changes

  • Move the Hydrogen CLI's env push command to stable. (#1946) by @aswamy

  • Deprecate the --env-branch flag, in favor of --env. (#1841) by @aswamy

    • --env accepts the environment's handle, instead of the environment's associated branch name
      • Run env list to display all environments and their handles
    • Any CLI commands that accepted the --env-branch flag now accept the --env flag.
  • Support scaffolding projects from external repositories using the --template flag. (#1867) by @frandiox

    The following examples are equivalent:

    npm create @shopify/hydrogen -- --template shopify/hydrogen-demo-store
    npm create @shopify/hydrogen -- --template github.com/shopify/hydrogen-demo-store
    npm create @shopify/hydrogen -- --template https://github.com/shopify/hydrogen-demo-store
  • Add the customer-account push command to the Hydrogen CLI. This allows you to push the current --dev-origin URL to the Shopify admin to enable secure connection to the Customer Account API for local development. (#1804) by @michenly

  • Remove the @shopify/cli-hydrogen/experimental-vite import path in favor of @shopify/hydrogen/vite and @shopify/mini-oxygen/vite. (#1935) by @frandiox

Patch Changes

  • Avoid throwing error in h2 dev --codegen when the Customer Account schema is not found. (#1962) by @frandiox

  • Bump internal workerd dependency to fix a bug when running on Node 21. (#1866) by @frandiox

  • Support Node's NODE_TLS_REJECT_UNAUTHORIZED and NODE_EXTRA_CA_CERTS environment variables in the worker environment. (#1882) by @frandiox

    Use this at your own risk to disable certificate validation or provide additional CA certificates when making HTTPS requests from the worker:

    # Disable certificate validation
    NODE_TLS_REJECT_UNAUTHORIZED=0 npm run dev
    
    # Provide additional CA certificates
    NODE_EXTRA_CA_CERTS=/usr/.../ca-certificates/my-file.crt npm run dev
  • Add --quickstart flag option to init/create command. (#1822) by @gfscott

  • Add a newline after the h2 alias created in ZSH/Bash profiles. (#1950) by @madmath

  • Fix the --markets flag when using npm create @shopify/hydrogen. (#1916) by @frandiox

  • Handle duplicate storefront names when running link command. (#1860) by @gfscott

  • List uncommitted files in the deploy command's "uncommitted changes" error message. (#1944) by @graygilmore

  • Improve h2 setup vite command to cover more migration steps (e.g. vanilla-extract, css-modules, etc.) and keep Remix future flags. (#1915) by @frandiox

  • Add --verbose flag to h2 dev and h2 preview commands to enable verbose logging. (#1928) by @frandiox

    Only CLI logs become verbose by default. If you also want to see verbose logs from Vite as well, use DEBUG=* h2 dev instead.

  • Updated dependencies [646b78d4, 140e4768, ebaf5529]:

    • @shopify/hydrogen-codegen@0.3.0
    • @shopify/mini-oxygen@3.0.0

7.1.2

Patch Changes

  • Change the required Vite version to ~5.1.0 instead of ^5.1.0 to avoid breaking changes in experimental APIs that will be introduced in Vite 5.2.0. (#1830) by @frandiox

7.1.1

Patch Changes

  • Update @shopify/cli-kit dependency to 3.56.3 and improve some help messaging. (#1786) by @frandiox

  • Hide a non-actionable warning about a deprecated Node.js module punycode. (#1801) by @frandiox

  • Add experimental support for Vite projects. (#1728) by @frandiox

    To test this unstable feature, make sure you're running the latest version of the Hydrogen CLI, then run npx shopify hydrogen setup vite in your Hydrogen project. This command edits existing files and creates some new ones required to run Vite.

    Please report any issues you run into, and let us know if you have any feedback or suggestions.

  • Fix an issue that could cause the local worker runtime to freeze. (#1819) by @frandiox

  • Updated dependencies [4e3d5b00]:

    • @shopify/hydrogen-codegen@0.2.2

7.1.0

Minor Changes

  • Adds new command line flag options for the deploy command: (#1736) by @vincentezw

    • build-command: Allows users to specify which command is used to build the project (instead of the default build function). This provides more flexibility for projects that have custom build processes.
    • no-lockfile-check: Allows users to skip the lockfile check during the build process. This can be useful in scenarios where you want to bypass the lockfile check for certain reasons, such as in monorepos, where the lockfile resides in the root folder.
  • Adding skip-verification flag to hydrogen deploy command (#1770) by @lynchv

Patch Changes

  • Add --env-file flag to the deploy command (#1743) by @aswamy

    Optionally provide the path to a local .env file to override the environment variables set on Admin.

  • This is an important fix to a bug with 404 routes and path-based i18n projects where some unknown routes would not properly render a 404. This fixes all new projects, but to fix existing projects, add a ($locale).tsx route with the following contents: (#1732) by @blittle

    import {type LoaderFunctionArgs} from '@remix-run/server-runtime';
    
    export async function loader({params, context}: LoaderFunctionArgs) {
      const {language, country} = context.storefront.i18n;
    
      if (
        params.locale &&
        params.locale.toLowerCase() !== `${language}-${country}`.toLowerCase()
      ) {
        // If the locale URL param is defined, yet we still are still at the default locale
        // then the the locale param must be invalid, send to the 404 page
        throw new Response(null, {status: 404});
      }
    
      return null;
    }
  • Non-zero exit codes are now honored (#1766) by @graygilmore

7.0.1

Patch Changes

  • Add support for multiple schemas in GraphiQL. Fix links in Subrequest Profiler. (#1693) by @frandiox

  • ♻️ CustomerClient type is deprecated and replaced by CustomerAccount (#1692) by @michenly

  • Skip prompt about creating h2 shortcut during init flow if it has been already added to the environment. (#1718) by @gfscott

  • Bump Codegen dependencies to fix known bugs and remove patches. (#1705) by @frandiox

  • Fix local asset path to Oxygen to return valid preflight headers (#1709) by @wizardlyhel

  • Updated dependencies [c7b2017f]:

    • @shopify/hydrogen-codegen@0.2.1

7.0.0

Major Changes

  • Make the worker runtime the default for the local development server when running dev and preview. To access the legacy Node.js runtime, pass the --legacy-runtime flag. The legacy runtime will be deprecated and removed in a future release. (#1625) by @frandiox

  • Remove deprecated build command flags --base, --entry, --target. Additionally, --codegen-unstable is now --codegen. (#1640) by @frandiox

Minor Changes

  • Check for local project GraphQL config files (example: .graphqlrc.yml) when running in Codegen mode (#1577) by @frandiox

  • Add deploy command to Hydrogen CLI (#1628) by @graygilmore

    You can now deploy your Hydrogen app without connecting to GitHub. Run the deploy command from your local terminal or configure your own CI/CD workflows from any platform.

    Run npx shopify hydrogen deploy --help for more details.

  • Add --diff flag to dev and build commands, used for building Hydrogen app examples. (#1549) by @frandiox

  • Add --template flag to enable scaffolding projects based on examples from the Hydrogen repo. (#1608) by @frandiox

    Example: npm create @shopify/hydrogen@latest -- --template multipass.

Patch Changes

6.1.0

Minor Changes

  • Add the upgrade command to make it easier to upgrade from older versions of Hydrogen. Features: (#1458) by @juanpprieto

    • Automatically updates dependencies in your package.json file.
    • Generates a customized instruction file in the /.shopify directory, outlining any code changes required to complete the upgrade.
    • Adds a warning when running the dev command with an outdated version.
    • Defaults to the latest version. Pass a --version flag and a version number to select a specific one.

    To get started, run npx shopify hydrogen upgrade in your Hydrogen project.

  • The worker runtime for development is now stable. This makes your development environment closer to parity with Oxygen’s production runtime. Pass the --worker flag with the dev or preview commands to enable it. This runtime will be enabled by default in the next major release. (#1525) by @frandiox

  • Add the --debug flag to the dev command to enable step debugging in browser dev tools. (#1480) by @frandiox

    To enable debugger connections for the Hydrogen app worker file, run npx shopify hydrogen dev --debug --worker, then open localhost:9229 in your browser.

Patch Changes

  • Sync up environment variable names across all example & type files. (#1542) by @michenly

  • Serve assets from a separate domain when running the dev server, to better simulate cross-domain behaviors. This makes it more realistic to work with CORS requests, content security policies, and CDN paths in development. (#1503) by @frandiox

  • Update all Node.js dependencies to version 18. (Not a breaking change, since Node.js 18 is already required by Remix v2.) (#1543) by @michenly

  • 🐛 fix undefined menu error (#1533) by @michenly

  • Fix how peer dependencies are resolved. (#1489) by @frandiox

  • Update Shopify CLI versions. (#1504) by @vincentezw

  • Updated dependencies [848c6260, 8fce70de]:

    • @shopify/mini-oxygen@2.2.4

6.0.2

Patch Changes

  • Updated dependencies [69624b32]:
    • @shopify/hydrogen@2023.10.2

6.0.1

Patch Changes

  • Fix Shopify login during the init flow where the process would just exit when awaiting for a keypress. (#1481) by @frandiox

  • Updated dependencies [074ef6e8]:

    • @shopify/hydrogen@2023.10.1

6.0.0

Minor Changes

  • 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. (#1108) by @frandiox

Patch Changes

  • Updated internal dependencies to improve terminal output. (#1456) by @vincentezw

    Please update the @shopify/cli dependency in your app to avoid duplicated subdependencies:

      "dependencies": {
    -   "@shopify/cli": "3.49.2",
    +   "@shopify/cli": "3.50.0",
      }
  • Updated dependencies [a6f397b6, ad45656c, ad45656c, 58dc68de, 0ae7cbe2, ad45656c]:

    • @shopify/remix-oxygen@2.0.0
    • @shopify/hydrogen-codegen@0.1.0
    • @shopify/hydrogen-react@2023.10.0

5.5.1

Patch Changes

  • Fix template dist package due to CI error (#1451) by @wizardlyhel

  • Updated dependencies [3eb376fe]:

    • @shopify/hydrogen-react@2023.7.6

5.5.0

Minor Changes

  • Generated JavaScript projects now use Codegen and JSDoc to enhance editor autocompletion. (#1334) by @frandiox

  • We've added an experimental tool for profiling the CPU at startup. This is useful for debugging slow startup times when Oxygen deployments fail with related errors. (#1352) by @frandiox

    Run the new h2 debug cpu command to build + watch your app and generate a startup.cpuprofile file that you can open in DevTools or VSCode to see a flamegraph of CPU usage.

Patch Changes

  • Integrate the debug-network tooling with the new --worker-unstable runtime CLI flag. (#1387) by @frandiox

  • Updated dependencies [d30e2651, b81b452d, 1b45311d, 2627faa7]:

    • @shopify/hydrogen-react@2023.7.5
    • @shopify/remix-oxygen@1.1.8

5.4.3

Patch Changes

  • Fix subrequest performance in development. (#1411) by @frandiox

  • Increase the request body size limit to 100mb when running locally. (#1421) by @frandiox

  • Updated dependencies [29414664, 832a0eaf]:

    • @shopify/remix-oxygen@1.1.7
    • @shopify/mini-oxygen@2.2.3

5.4.2

Patch Changes

  • Fix product search results header style (#1405) by @tatsuya

  • Updated dependencies [4f735fd7]:

    • @shopify/remix-oxygen@1.1.6

5.4.1

Patch Changes

  • Add token flag, environmentTag flag, environment selection screen, rename health check to deployment verification (#1381) by @vincentezw

  • Updated dependencies [eb9451ed]:

    • @shopify/remix-oxygen@1.1.5

5.4.0

Minor Changes

  • The build command now throws errors on CI when it can't find a valid lockfile. This should prevent unforseen issues related to dependency versioning in production. (#1370) by @frandiox

    This behavior can be disabled with the flag --no-lockfile-check, which might be useful in monorepos or other setups where the lockfile is not available in the project directory.

Patch Changes

  • Add check to render collection images when available (#1373) by @juanpprieto

  • Remove sourcemap annotations from client bundles. This prevents errors showing up in the devtools when the sourcemaps fail to load. (#1364) by @blittle

5.3.1

Patch Changes

  • Make the CLI bundle analysis compatible with older Remix versions that don't output a metafile (#1357) by @blittle

5.3.0

Minor Changes

  • Add --worker-unstable flag to h2 dev and h2 preview commands. This flag enables the use of the new experimental worker runtime for local development, which is closer to Oxygen production than the current Node.js sandbox. Please report any issues you encounter with this flag. (#1184) by @frandiox

  • Add deploy command (disabled by default) (#1019) by @vincentezw

Patch Changes

  • Add magic cart and discount routes to skeleton template (#1309) by @juanpprieto

  • Updates placeholder page to suggest the h2 setup command, instead of h2 generate route home (#1347) by @benjaminsehl

  • Adjust behavior of h2 preview command around environment variables to be more consistent with h2 dev command. (#1184) by @frandiox

  • We've added a tool for analyzing bundle sizes. You should try to keep your worker bundle small. The larger it gets effects the cold startup time of your app. We now include client-bundle-analyzer.html and worker-bundle-analyzer.html files in the build output. Open these in your browser to view an interactive analysis of your bundles. The CLI output also includes links to each file. Hydrogen also fails to build if your bundle size is over 10 MB. This is because Oxygen only supports worker bundles less than 10 MB. (#1306) by @blittle

  • Raise the subrequest limit to 100 for development. (#1348) by @frandiox

  • Fix --routes and --markets flag when creating new projects. (#1342) by @frandiox

  • Make sourcemaps to default be turned on. They were off to prevent sourcemaps leaking server code to the client. Oxygen now makes sure to not serve the sourcemaps, so it's okay to generate them. Also, when sourcemaps are present, we hope to enable sourcemapped stack traces in error logs on Oxygen. (#1339) by @blittle

5.2.3

Patch Changes

  • Delay installing certain dependencies to speed up project initialization time. (#1272) by @frandiox

  • (Unstable) server-side network request debug virtual route (#1284) by @wizardlyhel

    1. Update your server.ts so that it also passes in the waitUntil and env.

        const handleRequest = createRequestHandler({
          build: remixBuild,
          mode: process.env.NODE_ENV,
      +    getLoadContext: () => ({session, storefront, env, waitUntil}),
        });

      If you are using typescript, make sure to update remix.env.d.ts

        declare module '@shopify/remix-oxygen' {
          export interface AppLoadContext {
      +     env: Env;
            cart: HydrogenCart;
            storefront: Storefront;
            session: HydrogenSession;
      +      waitUntil: ExecutionContext['waitUntil'];
          }
        }
    2. Run npm run dev and you should see terminal log information about a new virtual route that you can view server-side network requests at http://localhost:3000/debug-network

    3. Open http://localhost:3000/debug-network in a tab and your app another tab. When you navigate around your app, you should see server network requests being logged in the debug-network tab

  • Updated dependencies [71a07374]:

    • @shopify/remix-oxygen@1.1.4

5.2.2

Patch Changes

  • Fix error stack traces in development mode. (#1297) by @frandiox

  • Updated dependencies [345f06a2]:

    • @shopify/hydrogen-react@2023.7.4

5.2.1

Patch Changes

  • Fix the default page shown when the project has no routes. (#1266) by @frandiox

  • Hydrogen is now compatible with TypeScript v5. (#1240) by @frandiox

    If you have typescript as a dev dependency in your app, it is recommended to change its version as follows:

      "devDependencies": {
        ...
    -   "typescript": "^4.9.5",
    +   "typescript": "^5.2.2",
      },

    After installing the new version of TypeScript, you may need to update the version used in your IDE. For example, in VSCode, you can do this by clicking on the { } icon in the bottom-right toolbar next to the language mode (generally, { } TypeScript JSX when editing a .tsx file).

  • Fix development server port in some situations where it was set to a random number instead of the default 3000 or the --port flag value. (#1267) by @frandiox

  • Fix transpiling TS to JS when scaffolding routes. (#1273) by @frandiox

  • Catch more errors during init while connecting to Shopify (#1281) by @graygilmore

  • Add functionality for creating a Content Security Policy. See the guide on Content Security Policies for more details. (#1235) by @blittle

  • Updated dependencies [06516ee9, 423acee2]:

    • @shopify/hydrogen-react@2023.7.3

5.2.0

Minor Changes

  • Support Remix Hot Module Replacement (HMR) and Hot Data Revalidation (HDR). (#1187) by @frandiox

    Start using it with the following changes to your project:

    1. Upgrade to the latest Hydrogen version and Remix 1.19.1.

    2. Enable the v2 dev server in remix.config.js:

    // ...
    future: {
    + v2_dev: true,
      v2_meta: true,
      v2_headers: true,
      // ...
    }
    1. Add Remix' <LiveReload /> component if you don't have it to your root.jsx or root.tsx file:
    import {
      Outlet,
      Scripts,
    + LiveReload,
      ScrollRestoration,
    } from '@remix-run/react';
    
    // ...
    
    export default function App() {
      // ...
    
      return (
        <html>
          <head>
           {/* ...  */}
          </head>
          <body>
            <Outlet />
            <ScrollRestoration />
            <Scripts />
    +       <LiveReload />
          </body>
        </html>
      );
    }
    
    export function ErrorBoundary() {
      // ...
    
      return (
        <html>
          <head>
            {/* ... */}
          </head>
          <body>
            Error!
            <Scripts />
    +       <LiveReload />
          </body>
        </html>
      );
    }

Patch Changes

  • Avoid development server crash on unhandled promise rejection. (#1244) by @frandiox

  • Fix build command when public directory is missing. (#1224) by @frandiox

  • Use nonce from CSP header in MiniOxygen's auto-reload script. (#1251) by @frandiox

  • Add default exported route to enable the error to be caught in the root.tsx ErrorBoundary (#1215) by @josh-sanger

  • Improve error handling when failing to get remote environment variables. (#1225) by @frandiox

  • Fix GraphQL Codegen throwing error related to Git on Windows. (#1253) by @frandiox

  • Add shouldRevalidate export to limit root loaders revalidation on mutations only (#1237) by @juanpprieto

  • Removed quantityAvailable field from skeleton PDP graphql query so that it works with default Storefront API permissions. (#1236) by @abecciu

  • Updated dependencies [e9e1736a, 1a0e858d]:

    • @shopify/hydrogen-react@2023.7.2

5.1.2

Patch Changes

  • Update @shopify/oxygen-workers-types dependencies (#1208) by @juanpprieto

  • Updated dependencies [21eb9dac, d80c4ada]:

    • @shopify/remix-oxygen@1.1.3
    • @shopify/hydrogen-react@2023.7.1

5.1.1

Patch Changes

  • Update to Remix v1.19.1. (#1172) by @frandiox

    See changes for 1.18 and 1.19.

  • Fix the starter template cart aside to cover everything on larger pages (#1163) by @QuentinGibson

  • Skip Oxygen requirement checks of remix.config.js when @shopify/remix-oxygen is not installed. (#1137) by @frandiox

  • Warn in development when Remix packages are out of sync. (#1173) by @frandiox

  • Updated dependencies [b7a8ecf6]:

    • @shopify/remix-oxygen@1.1.2

5.1.0

What’s new

⭐️ Check out our blog post with all the latest updates on Hydrogen, and what’s coming on the roadmap.

Shopify CLI now gives you more options when creating a new Hydrogen app on the command line:

  • Create a new Shopify storefront and connect it to the local project, or use Mock.shop.
  • Pick your styling method: Tailwind, CSS Modules, Vanilla Extract, PostCSS.
  • URL strategies to support language and currency options with Shopify Markets.
  • Automatically scaffold standard Shopify routes.

Minor Changes

  • The onboarding process when creating new Hydrogen apps has been reworked. (#913) by @frandiox

  • Add login and logout commands. Rework how other commands interact with auth. (#1022) by @frandiox

  • Reload environment variables in the development server when .env file is updated. Show injected variables when project is not linked to any storefront. (#997) by @frandiox

  • Support creating new storefronts from the link command. (#1022) by @frandiox

Patch Changes

5.0.2

Patch Changes

  • Add more context on MiniOxygen local dev server startup (#1005) by @gfscott

  • Fix --sourcemap flag for build command. (#1032) by @frandiox

  • Fix dev --codegen-unstable flag, which was removed by mistake in the previous release. (#1018) by @frandiox

  • Updated dependencies [b8f41ad7]:

    • @shopify/hydrogen-react@2023.4.5

5.0.1

Patch Changes

  • Update Remix to the latest version (1.17.1). (#852) by @frandiox

    When updating your app, remember to also update your Remix dependencies to 1.17.1 in your package.json file:

    -"@remix-run/react": "1.15.0",
    +"@remix-run/react": "1.17.1",
    
    -"@remix-run/dev": "1.15.0",
    -"@remix-run/eslint-config": "1.15.0",
    +"@remix-run/dev": "1.17.1",
    +"@remix-run/eslint-config": "1.17.1",
  • Updated dependencies [f29e178a]:

    • @shopify/remix-oxygen@1.1.1

5.0.0

Patch Changes

  • Remove --codegen-unstable flag from scripts when transpiling projects from TypeScript to JavaScript. (#937) by @frandiox

  • Allow disabling sourcemaps with shopify hydrogen build --no-sourcemap (#975) by @blittle

  • Allow the CLI route generate to work in non-oxygen deploys (#976) by @blittle

  • Hidden flag removed from new CLI commands (#995) by @graygilmore

    You can now link your local Hydrogen storefront to a storefront you have created in the Shopify admin. This allows you to pull your environment variables into your local environment or have them be automatically injected into your runtime when you run dev.

  • Updated dependencies [7b4afea2, 32515232, 7d6a1a7c, 442f602a, be912b2f, b9ab8eb7, d3817b9c, 93a7c3c6, 6b8537ba]:

    • @shopify/hydrogen-react@2023.4.4
    • @shopify/remix-oxygen@1.1.0
    • @shopify/hydrogen-codegen@0.0.2

4.2.1

Patch Changes

  • Fix release (#926) by @blittle

  • Updated dependencies [7aaa4e86]:

    • @shopify/hydrogen-codegen@0.0.1
    • @shopify/hydrogen-react@2023.4.3
    • @shopify/remix-oxygen@1.0.7

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) 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/hydrogen-codegen@0.0.0
    • @shopify/hydrogen-react@2023.4.2

4.1.2

Patch Changes

  • Add command to pull environment variables from a Hydrogen storefront defined in the Shopify Admin (#809) by @graygilmore

  • Update docs links on successful project creation (#810) by @gfscott

  • New --debug flag for the dev command that attaches a Node inspector to the development server. (#869) by @frandiox

  • Ensure request logs are shown in MiniOxygen during development. (#836) by @frandiox

    Provide custom Oxygen headers in local MiniOxygen.

  • Add new commands for merchants to be able to list and link Hydrogen storefronts on Shopify (#784) by @graygilmore

  • Updated dependencies [025385b6, 0a009a3b]:

    • @shopify/remix-oxygen@1.0.6
    • @shopify/hydrogen-react@2023.4.1

4.1.1

Patch Changes

  • Fix the check routes command to match optional segments. (#774) by @frandiox

  • Updated dependencies [82b6af7, 361879e]:

    • @shopify/hydrogen-react@2023.4.0

4.1.0

Minor Changes

  • Updated CLI prompts. It's recommended to update your version of @shopify/cli to 3.45.0 when updating @shopify/cli-hydrogen. (#733) by @frandiox

    "dependencies": {
    -  "@shopify/cli": "3.x.x",
    +  "@shopify/cli": "3.45.0",
    }
  • Added a new shortcut command that creates a global h2 alias for the Hydrogen CLI: (#679) by @frandiox

    $> npx shopify hydrogen shortcut

    After that, you can run commands using the new alias:

    $> h2 generate route home
    $> h2 g r home # Same as the above
    $> h2 check routes

Patch Changes

  • Add support for the Remix future flags v2_meta, v2_errorBoundary and v2_routeConvention to the generate command. If these flags are enabled in your project, the new generated files will follow the v2 conventions. (#756) by @frandiox

  • Update virtual route to use Remix V2 route name conventions (#792) by @DavidWittness

  • Bump internal Remix dependencies to 1.15.0. (#728) by @wizardlyhel

    Recommendations to follow:

    • Upgrade all the Remix packages in your app to 1.15.0.
    • Enable Remix v2 future flags at your earliest convenience following the official guide.
  • Improve type safety in SEO data generators. (#763) by @davidhousedev

  • Updated dependencies [85ae63a, 5e26503, 1f8526c]:

    • @shopify/hydrogen-react@2023.1.8
    • @shopify/remix-oxygen@1.0.5

4.0.9

Patch Changes

    1. Update Remix to 1.14.0 (#599) by @blittle

    2. Add Cache-Control defaults to all the demo store routes

  • Fixed a typo in the install deps flag. The flag is now SHOPIFY_HYDROGEN_FLAG_INSTALL_DEPS. (#672) by @cartogram

  • Display warning for deprecated flags. (#609) by @cartogram

  • Fix bug in CLI not recognising the --install-deps flag when creating projects (#644) by @cartogram

  • Fix check routes command to correctly check the standard route /discount/<code> instead of /discounts/<code>. (#601) by @frandiox

  • Stop hydrating with requestIdleCallback (#667) by @juanpprieto

  • Updated dependencies [c78f441, 7fca5d5]:

    • @shopify/hydrogen-react@2023.1.7
    • @shopify/remix-oxygen@1.0.4

4.0.8

Patch Changes

  • Improve rate limit error messages when creating new projects. (#553) by @frandiox

  • Show better errors when initial build fails, and recover when fixing it. (#514) by @frandiox

4.0.7

Patch Changes

  • Use woff2 format instead of ttf in onboarding routes to reduce download size of font files. (#538) by @lordofthecactus

  • Show available upgrades for CLI when creating new projects. (#518) by @frandiox

4.0.6

Patch Changes

  • Fix CLI flags for init command, and add --install-deps. (#516) by @frandiox

  • Fix template download on Windows during project creation. (#528) by @tchalabi

  • Fix template imports to only reference @shopify/hydrogen, not @shopify/hydrogen-react (#523) by @blittle

  • Fix pathnames on Windows when running the development server. (#520) by @frandiox

  • Onboarding fonts and styles (#533) by @lordofthecactus

  • Corrects links referred to in Onboarding Route. (#509) by @benjaminsehl

  • Improve onboarding style and links (#525) by @lordofthecactus

  • Updated dependencies [ff9d729]:

    • @shopify/remix-oxygen@1.0.3

4.0.5

Patch Changes

4.0.4

Patch Changes

  • Fix pathnames in Windows when creating projects and generating routes. (#495) by @frandiox

4.0.3

Patch Changes

  • Fix initialization a new Hydrogen project on Windows (#478) by @pepicrft

4.0.2

Patch Changes

  • Add license files and readmes for all packages (#463) by @blittle

  • Updated dependencies [517f0f7]:

    • @shopify/remix-oxygen@1.0.2

4.0.1

Patch Changes

  • Initial release