Skip to content

Commit

Permalink
[ci] release v1.x-2022-07 (rc1)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Mar 15, 2022
1 parent 587aa3e commit 7fd1f24
Show file tree
Hide file tree
Showing 8 changed files with 344 additions and 6 deletions.
13 changes: 12 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,16 @@
"hydrogen-playground": "0.11.0",
"test-server-components": "0.11.0"
},
"changesets": []
"changesets": [
"calm-brooms-attack",
"empty-kings-give",
"fast-eggs-hang",
"quiet-rings-sin",
"stale-experts-leave",
"tasty-houses-retire",
"ten-timers-bathe",
"tough-rabbits-end",
"tricky-kangaroos-carry",
"witty-games-clap"
]
}
2 changes: 1 addition & 1 deletion examples/template-hydrogen-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"dependencies": {
"@headlessui/react": "^1.5.0",
"@shopify/hydrogen": "^0.12.0",
"@shopify/hydrogen": "^1.0.0-rc1.0",
"body-parser": "^1.19.1",
"compression": "^1.7.4",
"graphql-tag": "^2.12.4",
Expand Down
156 changes: 156 additions & 0 deletions packages/create-hydrogen-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,161 @@
# Changelog

## 1.0.0-rc1.0

### Major Changes

- [`a10e1665`](https://github.com/Shopify/hydrogen/commit/a10e1665a95d27525f0b07df187b1346a62850cb) Thanks [@jplhomer](https://github.com/jplhomer)! - Hydrogen v1.0 is now available as a release candidate.

Install it using the `rc1` tag for new apps:

```bash
npx create-hydrogen-app@rc1
```

Or update existing apps:

```bash
yarn add @shopify/hydrogen@rc1
```

### Minor Changes

- [#698](https://github.com/Shopify/hydrogen/pull/698) [`6f30b9a1`](https://github.com/Shopify/hydrogen/commit/6f30b9a1327f06d648a01dd94d539c7dcb3061e0) Thanks [@jplhomer](https://github.com/jplhomer)! - Basic end-to-end tests have been added to the default Hydrogen template. You can run tests in development:

```bash
yarn test
```

Or in continuous-integration (CI) environments:

```bash
yarn test:ci
```

* [#846](https://github.com/Shopify/hydrogen/pull/846) [`58c823b5`](https://github.com/Shopify/hydrogen/commit/58c823b5eb5c5c33caa25cae629409ce651b3991) Thanks [@blittle](https://github.com/blittle)! - ## New `<Route>` Component

The `<Route>` component is available for routes not defined by the file system. The `<Route>` component must be used within the `<Router>` component.

```jsx
// app.server.jsx

function App({routes, ...serverProps}) {
return (
<Suspense fallback={<LoadingFallback />}>
<ShopifyProvider shopifyConfig={shopifyConfig}>
<CartProvider>
<DefaultSeo />
<Router serverProps={serverProps}>
<Route path="/custom" page={<CustomRoute />} />
</Router>
</CartProvider>
</ShopifyProvider>
</Suspense>
);
}

function CustomRoute() {
return <h1>Custom route</h1>;
}
```

`<Route>` accepts two props:

| Property | Type | Required | Description |
| -------- | --------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `path` | `string` | Yes | The URL path where the route exists. The path can contain variables. For example, `/products/:handle`. |
| `page` | `A rendered Server Component reference` | Yes | A reference to a React Server Component that's rendered when the route is active. |

## Changes to `<Router>`

You can have multiple `<Route>` and `<FileRoutes>` components in your app. Hydrogen will only render one route for each request — whichever it finds first. This means the `<Router>` component no longer takes `fallback` as a prop. It also doesn't need `serverProps`. Instead, to render a 404 "Not Found" page, add `<Route path="*" page={<NotFound />} />` to your app. Make sure it's the last `<Route>` defined inside your app:

```diff
function App({routes, ...serverProps}) {
return (
<ShopifyProvider shopifyConfig={shopifyConfig}>
<CartProvider>
<DefaultSeo />
- <Router
- fallback={<NotFound response={serverProps.response} />}
- serverProps={serverProps}
- >
+ <Router>
<FileRoutes routes={routes} />
+ <Route path="*" page={<NotFound />} />
</Router>
</CartProvider>
</ShopifyProvider>
);
}
```

## Changes to `<FileRoutes>`

The `<FileRoutes>` component now accepts two additional optional props:

| Property | Type | Required | Default Value | Description |
| ----------- | -------- | -------- | ------------- | ----------------------------------------------------------------------- |
| `basePath` | `string` | No | `"/"` | A path that's prepended to all file routes. |
| `dirPrefix` | `string` | No | `"./routes"` | The portion of the file route path that shouldn't be a part of the URL. |

You need to modify `dirPrefix` if you want to import routes from a location other than `src/routes`.

You can modify `basePath` if you want to prefix all file routes. For example, you can prefix all file routes with a locale:

```jsx
<Router>
<FileRoutes basePath={`/${locale}`} routes={routes} />
<Route path="*" page={<NotFound />} />
</Router>
```

## New `useRouteParams()` hook

You can use the `useRouteParams()` hook to retrieve the parameters of an active route. The hook is available in both server and client components:

```jsx
// products/[handle].server.jsx

import {useRouteParams} from '@shopify/hydrogen';

export default function Product() {
const {handle} = useRouteParams();
// ...
}
```

```jsx
// ProductDetails.client.jsx
import {useRouteParams} from '@shopify/hydrogen/client';

export default function ProductDetails() {
const {handle} = useRouteParams();
// ...
}
```

- [#842](https://github.com/Shopify/hydrogen/pull/842) [`626e58ee`](https://github.com/Shopify/hydrogen/commit/626e58eebe3cf994423895bbdf7754c009d701fe) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Removed the `Rawhtml` component.

Upgrade your project by replacing references to the `RawHtml` component to follow
[React's `dangerouslySetInnerHTML`](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml):

Change all `RawHtml` component

```jsx
<RawHtml string="<p>Hello world</p>" />
```

to jsx equivalent

```jsx
<div dangerouslySetInnerHTML={{__html: '<p>Hello world</p>'}} />
```

### Patch Changes

- [#872](https://github.com/Shopify/hydrogen/pull/872) [`d90bb3be`](https://github.com/Shopify/hydrogen/commit/d90bb3bedcba47e6eee3498145def4ec1644b19c) Thanks [@jplhomer](https://github.com/jplhomer)! - Fix usage of NotFound when it is not possible to modify the `response` object

## 0.12.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/create-hydrogen-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"access": "public",
"@shopify:registry": "https://registry.npmjs.org"
},
"version": "0.12.0",
"version": "1.0.0-rc1.0",
"main": "index.js",
"license": "MIT",
"bin": {
Expand Down
171 changes: 171 additions & 0 deletions packages/hydrogen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,176 @@
# Changelog

## 1.0.0-rc1.0

### Major Changes

- [`a10e1665`](https://github.com/Shopify/hydrogen/commit/a10e1665a95d27525f0b07df187b1346a62850cb) Thanks [@jplhomer](https://github.com/jplhomer)! - Hydrogen v1.0 is now available as a release candidate.

Install it using the `rc1` tag for new apps:

```bash
npx create-hydrogen-app@rc1
```

Or update existing apps:

```bash
yarn add @shopify/hydrogen@rc1
```

### Minor Changes

- [#698](https://github.com/Shopify/hydrogen/pull/698) [`6f30b9a1`](https://github.com/Shopify/hydrogen/commit/6f30b9a1327f06d648a01dd94d539c7dcb3061e0) Thanks [@jplhomer](https://github.com/jplhomer)! - Basic end-to-end tests have been added to the default Hydrogen template. You can run tests in development:

```bash
yarn test
```

Or in continuous-integration (CI) environments:

```bash
yarn test:ci
```

* [#846](https://github.com/Shopify/hydrogen/pull/846) [`58c823b5`](https://github.com/Shopify/hydrogen/commit/58c823b5eb5c5c33caa25cae629409ce651b3991) Thanks [@blittle](https://github.com/blittle)! - ## New `<Route>` Component

The `<Route>` component is available for routes not defined by the file system. The `<Route>` component must be used within the `<Router>` component.

```jsx
// app.server.jsx

function App({routes, ...serverProps}) {
return (
<Suspense fallback={<LoadingFallback />}>
<ShopifyProvider shopifyConfig={shopifyConfig}>
<CartProvider>
<DefaultSeo />
<Router serverProps={serverProps}>
<Route path="/custom" page={<CustomRoute />} />
</Router>
</CartProvider>
</ShopifyProvider>
</Suspense>
);
}

function CustomRoute() {
return <h1>Custom route</h1>;
}
```

`<Route>` accepts two props:

| Property | Type | Required | Description |
| -------- | --------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `path` | `string` | Yes | The URL path where the route exists. The path can contain variables. For example, `/products/:handle`. |
| `page` | `A rendered Server Component reference` | Yes | A reference to a React Server Component that's rendered when the route is active. |

## Changes to `<Router>`

You can have multiple `<Route>` and `<FileRoutes>` components in your app. Hydrogen will only render one route for each request — whichever it finds first. This means the `<Router>` component no longer takes `fallback` as a prop. It also doesn't need `serverProps`. Instead, to render a 404 "Not Found" page, add `<Route path="*" page={<NotFound />} />` to your app. Make sure it's the last `<Route>` defined inside your app:

```diff
function App({routes, ...serverProps}) {
return (
<ShopifyProvider shopifyConfig={shopifyConfig}>
<CartProvider>
<DefaultSeo />
- <Router
- fallback={<NotFound response={serverProps.response} />}
- serverProps={serverProps}
- >
+ <Router>
<FileRoutes routes={routes} />
+ <Route path="*" page={<NotFound />} />
</Router>
</CartProvider>
</ShopifyProvider>
);
}
```

## Changes to `<FileRoutes>`

The `<FileRoutes>` component now accepts two additional optional props:

| Property | Type | Required | Default Value | Description |
| ----------- | -------- | -------- | ------------- | ----------------------------------------------------------------------- |
| `basePath` | `string` | No | `"/"` | A path that's prepended to all file routes. |
| `dirPrefix` | `string` | No | `"./routes"` | The portion of the file route path that shouldn't be a part of the URL. |

You need to modify `dirPrefix` if you want to import routes from a location other than `src/routes`.

You can modify `basePath` if you want to prefix all file routes. For example, you can prefix all file routes with a locale:

```jsx
<Router>
<FileRoutes basePath={`/${locale}`} routes={routes} />
<Route path="*" page={<NotFound />} />
</Router>
```

## New `useRouteParams()` hook

You can use the `useRouteParams()` hook to retrieve the parameters of an active route. The hook is available in both server and client components:

```jsx
// products/[handle].server.jsx

import {useRouteParams} from '@shopify/hydrogen';

export default function Product() {
const {handle} = useRouteParams();
// ...
}
```

```jsx
// ProductDetails.client.jsx
import {useRouteParams} from '@shopify/hydrogen/client';

export default function ProductDetails() {
const {handle} = useRouteParams();
// ...
}
```

- [#842](https://github.com/Shopify/hydrogen/pull/842) [`626e58ee`](https://github.com/Shopify/hydrogen/commit/626e58eebe3cf994423895bbdf7754c009d701fe) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Removed the `Rawhtml` component.

Upgrade your project by replacing references to the `RawHtml` component to follow
[React's `dangerouslySetInnerHTML`](https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml):

Change all `RawHtml` component

```jsx
<RawHtml string="<p>Hello world</p>" />
```

to jsx equivalent

```jsx
<div dangerouslySetInnerHTML={{__html: '<p>Hello world</p>'}} />
```

### Patch Changes

- [#870](https://github.com/Shopify/hydrogen/pull/870) [`4c0fcd8f`](https://github.com/Shopify/hydrogen/commit/4c0fcd8f55a7956ab4641f12a5d9ebcb2587264c) Thanks [@frandiox](https://github.com/frandiox)! - Remove useQuery hook from client exports to avoid leaking server logic to the browser.

* [#904](https://github.com/Shopify/hydrogen/pull/904) [`1b46f8d0`](https://github.com/Shopify/hydrogen/commit/1b46f8d00ed5db9abaf0868574e252fa319a8ca9) Thanks [@wizardlyhel](https://github.com/wizardlyhel)! - Log query key when provided in string

- [#895](https://github.com/Shopify/hydrogen/pull/895) [`1017b541`](https://github.com/Shopify/hydrogen/commit/1017b541c275c030f97ee6dee1e310df1fe89fb5) Thanks [@frandiox](https://github.com/frandiox)! - Improve error thrown in development when entry point fails on load.

* [#871](https://github.com/Shopify/hydrogen/pull/871) [`4cb07c73`](https://github.com/Shopify/hydrogen/commit/4cb07c7357cf05cc63f9d3c2834ac3c43e8859b5) Thanks [@scottdixon](https://github.com/scottdixon)! - Hydrogen docs: Update ProductProvider example query

- [#878](https://github.com/Shopify/hydrogen/pull/878) [`587aa3e6`](https://github.com/Shopify/hydrogen/commit/587aa3e6b7bee39f8f8a88685ef95ec9bb7c057b) Thanks [@frandiox](https://github.com/frandiox)! - Fix preloading queries in workers to prevent waterfall requests.

**Breaking change**: `fetchBuilder` no longer accepts a `Request` argument. Instead, it now accepts a `url: string` and `options: FetchInit`:

```diff
-fetchBuilder(new Request('https://my.endpoint.com', {headers: {foo: 'bar'}}));
+fetchBuilder('https://my.endpoint.com', {headers: {foo: 'bar}});
```

## 0.12.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"engines": {
"node": ">=14"
},
"version": "0.12.0",
"version": "1.0.0-rc1.0",
"description": "Modern custom Shopify storefronts",
"license": "MIT",
"main": "dist/esnext/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydrogen/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const LIB_VERSION = '0.12.0';
export const LIB_VERSION = '1.0.0-rc1.0';
2 changes: 1 addition & 1 deletion packages/playground/server-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@cloudflare/kv-asset-handler": "*",
"@shopify/hydrogen": "^0.12.0",
"@shopify/hydrogen": "^1.0.0-rc1.0",
"miniflare": "^1.3.3",
"react": "0.0.0-experimental-529dc3ce8-20220124",
"react-dom": "0.0.0-experimental-529dc3ce8-20220124"
Expand Down

0 comments on commit 7fd1f24

Please sign in to comment.