Skip to content

Commit

Permalink
Merge remote-tracking branch 'main' into update-oxygen-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
aswamy committed Apr 9, 2024
2 parents 6f81191 + 04c0ae6 commit d1a1c1f
Show file tree
Hide file tree
Showing 187 changed files with 33,482 additions and 25,186 deletions.
20 changes: 20 additions & 0 deletions .changeset/little-paws-fry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
'skeleton': patch
---

In Vite projects, the way that plugins are imported and the options passed to Remix have changed:

```diff
-import {hydrogen, oxygen} from '@shopify/cli-hydrogen/experimental-vite';
+import {hydrogen} from '@shopify/hydrogen/vite';
+import {oxygen} from '@shopify/mini-oxygen/vite';
import {vitePlugin as remix} from '@remix-run/dev';

export default defineConfig({
hydrogen(),
oxygen(),
remix({
- buildDirectory: 'dist',
+ presets: [hydrogen.preset()],
future: {
```
5 changes: 5 additions & 0 deletions .changeset/polite-seahorses-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/hydrogen': patch
---

A new Vite plugin is exported from `@shopify/hydrogen/vite`. It provides DX improvements for Vite users, such as adding `/subrequest-profiler` and `/graphiql`.
2 changes: 0 additions & 2 deletions .changeset/red-turkeys-sing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@
---

✨ Added `npx shopify hydrogen customer-account push` command to CLI that takes the url in `--dev-origin` and push the config to Shopify Admin
✨ Added `--customer-account-push` flag to the dev CLI command. This flag is meant be use for storefront that uses [Customer Account API](https://shopify.dev/docs/api/customer). It create a tunnel, and push the tunnel url to Shopify Admin.
✨ skeleton template now use `dev --customer-account-push` to start dev server
5 changes: 5 additions & 0 deletions .changeset/short-flowers-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': patch
---

Add a newline after the `h2` alias created ZSH/Bash profiles.
5 changes: 5 additions & 0 deletions .changeset/shy-bulldogs-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/remix-oxygen': patch
---

Fix compatibility of `/subrequest-profiler` with Vite.
5 changes: 5 additions & 0 deletions .changeset/shy-seas-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': minor
---

The `@shopify/cli-hydrogen/experimental-vite` import path has been removed. Instead, use `@shopify/hydrogen/vite` and `@shopify/mini-oxygen/vite` to import the Vite plugins.
5 changes: 5 additions & 0 deletions .changeset/strong-beds-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/mini-oxygen': minor
---

A new Vite plugin is exported from `@shopify/mini-oxygen/vite`. It integrates Vite with MiniOxygen by running the application code within a worker.
106 changes: 106 additions & 0 deletions .changeset/tiny-sheep-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
---
'@shopify/hydrogen': patch
---

Deprecate the `<Seo />` component in favor of directly using Remix meta route exports. Add the `getSeoMeta` to make migration easier:

Migration steps:

**1. Remove the `<Seo />` component from `root.jsx`:**

```diff
export default function App() {
const nonce = useNonce();
const data = useLoaderData<typeof loader>();

return (
<html lang="en">
<head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
- <Seo />
<Meta />
<Links />
</head>
<body>
<Layout {...data}>
<Outlet />
</Layout>
<ScrollRestoration nonce={nonce} />
<Scripts nonce={nonce} />
<LiveReload nonce={nonce} />
</body>
</html>
);
}

```

**2. Add a Remix meta export to each route that returns an `seo` property from a `loader` or `handle`:**

```diff
+import {getSeoMeta} from '@shopify/hydrogen';

export async function loader({context}) {
const {shop} = await context.storefront.query(`
query layout {
shop {
name
description
}
}
`);

return {
seo: {
title: shop.title,
description: shop.description,
},
};
}

+export const meta = ({data}) => {
+ return getSeoMeta(data.seo);
+};
```

**3. Merge root route meta data**

If your root route loader also returns an `seo` property, make sure to merge that data:

```ts
export const meta = ({data, matches}) => {
return getSeoMeta(
matches[0].data.seo,
// the current route seo data overrides the root route data
data.seo,
);
};
```

Or more simply:

```ts
export const meta = ({data, matches}) => {
return getSeoMeta(...matches.map((match) => match.data.seo));
};
```

**4. Override meta**

Sometimes `getSeoMeta` might produce a property in a way you'd like to change. Map over the resulting array to change it. For example, Hydrogen removes query parameters from canonical URLs, add them back:

```ts
export const meta = ({data, location}) => {
return getSeoMeta(data.seo).map((meta) => {
if (meta.rel === 'canonical') {
return {
...meta,
href: meta.href + location.search,
};
}

return meta;
});
};
```
5 changes: 5 additions & 0 deletions .changeset/twelve-paws-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/cli-hydrogen': patch
---

List the uncommitted files that the deploy command errors on
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
.vscode
.turbo
.cache
.shopify
/test-results/
/playwright-report/
/playwright/.cache/
Expand Down
2 changes: 1 addition & 1 deletion examples/classic-remix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"prettier": "@shopify/prettier-config",
"scripts": {
"build": "shopify hydrogen build --diff",
"dev": "shopify hydrogen dev --codegen --customer-account-push --diff",
"dev": "shopify hydrogen dev --codegen --diff",
"preview": "npm run build && shopify hydrogen preview",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-cart-method/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier": "@shopify/prettier-config",
"scripts": {
"build": "shopify hydrogen build --diff",
"dev": "shopify hydrogen dev --codegen --customer-account-push --diff",
"dev": "shopify hydrogen dev --codegen --diff",
"preview": "npm run build && shopify hydrogen preview",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@remix-run/server-runtime": "^2.8.0",
"@shopify/cli": "3.58.0",
"@shopify/cli-hydrogen": "^7.1.2",
"@shopify/hydrogen": "2024.1.4",
"@shopify/hydrogen": "2024.4.0",
"compression": "^1.7.4",
"cross-env": "^7.0.3",
"express": "^4.19.2",
Expand Down
2 changes: 1 addition & 1 deletion examples/infinite-scroll/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Hydrogen example: infinite scroll collection page

This folder contains an example implementation of [infinite scroll](https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#automatically-load-pages-on-scroll) within a product collection page using the [Pagination component](https://shopify.dev/docs/api/hydrogen/2024-01/components/pagination).
This folder contains an example implementation of [infinite scroll](https://shopify.dev/docs/custom-storefronts/hydrogen/data-fetching/pagination#automatically-load-pages-on-scroll) within a product collection page using the [Pagination component](https://shopify.dev/docs/api/hydrogen/2024-04/components/pagination).

The example uses [`react-intersection-observer`](https://www.npmjs.com/package/react-intersection-observer) to detect when the `Load more` button is in view. A `useEffect` then triggers a navigation to the next page url, which seamlessly loads more products as the user scrolls.

Expand Down
2 changes: 1 addition & 1 deletion examples/infinite-scroll/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier": "@shopify/prettier-config",
"scripts": {
"build": "shopify hydrogen build --diff",
"dev": "shopify hydrogen dev --codegen --customer-account-push --diff",
"dev": "shopify hydrogen dev --codegen --diff",
"preview": "npm run build && shopify hydrogen preview",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion examples/metaobjects/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier": "@shopify/prettier-config",
"scripts": {
"build": "shopify hydrogen build --diff",
"dev": "shopify hydrogen dev --codegen --customer-account-push --diff",
"dev": "shopify hydrogen dev --codegen --diff",
"preview": "npm run build && shopify hydrogen preview",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion examples/multipass/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@remix-run/react": "^2.8.0",
"@shopify/cli": "3.58.0",
"@shopify/cli-hydrogen": "^7.1.2",
"@shopify/hydrogen": "~2024.1.4",
"@shopify/hydrogen": "2024.4.0",
"@shopify/remix-oxygen": "^2.0.3",
"crypto-js": "^4.2.0",
"graphql": "^16.6.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/optimistic-cart-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier": "@shopify/prettier-config",
"scripts": {
"build": "shopify hydrogen build --diff",
"dev": "shopify hydrogen dev --codegen --customer-account-push --diff",
"dev": "shopify hydrogen dev --codegen --diff",
"preview": "npm run build && shopify hydrogen preview",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
"typecheck": "tsc --noEmit",
Expand Down
2 changes: 1 addition & 1 deletion examples/partytown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@remix-run/react": "^2.8.0",
"@shopify/cli": "3.58.0",
"@shopify/cli-hydrogen": "^7.1.2",
"@shopify/hydrogen": "~2024.1.4",
"@shopify/hydrogen": "2024.4.0",
"@shopify/remix-oxygen": "^2.0.3",
"graphql": "^16.6.0",
"graphql-tag": "^2.12.6",
Expand Down
2 changes: 1 addition & 1 deletion examples/subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@remix-run/react": "^2.8.0",
"@shopify/cli": "3.58.0",
"@shopify/cli-hydrogen": "^7.1.2",
"@shopify/hydrogen": "~2024.1.4",
"@shopify/hydrogen": "2024.4.0",
"@shopify/remix-oxygen": "^2.0.3",
"graphql": "^16.6.0",
"graphql-tag": "^2.12.6",
Expand Down
2 changes: 1 addition & 1 deletion examples/third-party-queries-caching/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"prettier": "@shopify/prettier-config",
"scripts": {
"build": "shopify hydrogen build --codegen --diff",
"dev": "shopify hydrogen dev --codegen --customer-account-push --diff",
"dev": "shopify hydrogen dev --codegen --diff",
"preview": "npm run build && shopify hydrogen preview",
"lint": "eslint --no-error-on-unmatched-pattern --ext .js,.ts,.jsx,.tsx .",
"typecheck": "tsc --noEmit",
Expand Down
Loading

0 comments on commit d1a1c1f

Please sign in to comment.