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

Remix v2 #1289

Merged
merged 49 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
68704d2
Update Remix versions to 2.0.0-pre.3
frandiox Aug 31, 2023
c782798
Fix types in Hydrogen
frandiox Aug 31, 2023
43807e1
Fix type exports in Oxygen adapter
frandiox Aug 31, 2023
cfce813
Mock v2 flags in CLI
frandiox Aug 31, 2023
152c188
Rename V2_MetaFunction type in skeleton
frandiox Aug 31, 2023
58d6cbb
Remove CSS nesting to avoid ESBuild warnings
frandiox Aug 31, 2023
c18b194
Remove old error and catch boundaries
frandiox Aug 31, 2023
72ea274
Add small wrapper for root data to fix type unknown
frandiox Aug 31, 2023
c3ee877
ts-ignore jsonify errors
frandiox Aug 31, 2023
10ee142
Remove vs flags from template
frandiox Aug 31, 2023
676106e
Update to Remix 2.0.0
frandiox Sep 21, 2023
751ec88
Update skeleton types to v2
frandiox Sep 21, 2023
1f3e663
Update hello-world types to v2
frandiox Sep 21, 2023
628b155
Update demo-store types to v2
frandiox Sep 21, 2023
86e13b1
Update examples types to v2
frandiox Sep 21, 2023
64ddaf9
Remove future v2 flags
frandiox Sep 21, 2023
8764330
Minor type update
frandiox Sep 21, 2023
8fb86a6
Merge branch 'main' into fd-remix-2
frandiox Sep 21, 2023
c6760a7
Remove v2 flags from CLI
frandiox Sep 21, 2023
4281f30
Remix deprecated tsconfig in config
frandiox Sep 21, 2023
b581650
Fix typecheck
frandiox Sep 21, 2023
50ea564
Stop injecting booleans in remix config. Fix tests
frandiox Sep 21, 2023
aeda704
Package lock
frandiox Sep 21, 2023
12a88cc
Fix types
frandiox Sep 21, 2023
049e8aa
Remove unused tests
frandiox Sep 21, 2023
7452f71
Cleanup
frandiox Sep 21, 2023
32d9177
Merge branch 'main' into fd-remix-2
frandiox Oct 12, 2023
562ccbf
Update package-lock
frandiox Oct 12, 2023
7aae225
Update Remix versions to latest nightly
frandiox Oct 12, 2023
90a61ef
Fix optimistic-ui for Remix v2
frandiox Oct 12, 2023
17587a0
Update package-lock
frandiox Oct 12, 2023
66d963b
Remove ts-ignore comments related to JsonifyObject error
frandiox Oct 12, 2023
182256e
Add missing reference to eslint package in skeleton
frandiox Oct 12, 2023
55fe601
Update to Remix 2.1.0
frandiox Oct 18, 2023
a9cac55
Merge branch 'main' into fd-remix-2
frandiox Oct 18, 2023
0909500
Fix SerializeFrom in JSDoc
frandiox Oct 18, 2023
119e5b1
Fix typedefs in JSDoc
frandiox Oct 18, 2023
83334e5
Use SerializeFrom in demo-store
frandiox Oct 18, 2023
26e3343
Changesets
frandiox Oct 18, 2023
af30e5e
Support generics in JSDoc
frandiox Oct 18, 2023
d72bb64
Set Remix as a non-pinned peer dependency
frandiox Oct 18, 2023
cb0d4b9
Changesets
frandiox Oct 18, 2023
b33e7af
Update .changeset/smart-ways-destroy.md
frandiox Oct 19, 2023
edd1bbf
Merge branch 'main' into fd-remix-2
frandiox Oct 19, 2023
7764b0a
Merge branch 'main' into fd-remix-2
frandiox Oct 26, 2023
182f435
Remove react dep again
frandiox Oct 26, 2023
7d5a636
Remove template guidelines for Remix v1
frandiox Oct 26, 2023
ac7216e
Minor fix
frandiox Oct 26, 2023
7218f23
Update changeset
frandiox Oct 26, 2023
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
6 changes: 6 additions & 0 deletions .changeset/early-taxis-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'demo-store': major
---

Update to Remix v2. Please check the [Remix v2 release notes](https://github.com/remix-run/remix/releases/tag/remix%402.0.0) to see what needs to be changed in your app code.
If you were not already using v2 flags, follow the official [Remix migration guide](https://remix.run/docs/en/main/start/v2) before upgrading to v2.
17 changes: 17 additions & 0 deletions .changeset/smart-ways-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@shopify/hydrogen': patch
'@shopify/cli-hydrogen': major
'@shopify/create-hydrogen': major
'@shopify/remix-oxygen': major
---

Update to Remix v2. Remix is now a peer dependency and its version is no longer pinned. This means that you can upgrade to newer Remix 2.x versions without upgrading Hydrogen.

### Breaking changes

Please check the [Remix v2 release notes](https://github.com/remix-run/remix/releases/tag/remix%402.0.0) to see what needs to be changed in your app code. Common changes include:

- Renaming types prefixed with `V2_`. For example, `V2_MetaFunction` is now `MetaFunction`.
- Renaming other types like `LoaderArgs` and `ActionArgs`, which are now `LoaderFunctionArgs` and `ActionFunctionArgs` respectively.

If you were not already using v2 flags, follow the official [Remix migration guide](https://remix.run/docs/en/main/start/v2) before upgrading to v2.
23 changes: 23 additions & 0 deletions .changeset/unlucky-stingrays-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
'demo-store': patch
---

If you are calling `useMatches()` in different places of your app to access the data returned by the root loader, you may want to update it to the following pattern to enhance types:

```ts
// root.tsx

import {useMatches} from '@remix-run/react';
import {type SerializeFrom} from '@shopify/remix-oxygen';

export const useRootLoaderData = () => {
const [root] = useMatches();
return root?.data as SerializeFrom<typeof loader>;
};

export function loader(context) {
// ...
}
```

This way, you can import `useRootLoaderData()` anywhere in your app and get the correct type for the data returned by the root loader.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is cool, I didn't know about it.

7 changes: 5 additions & 2 deletions examples/customer-api/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {type LinksFunction, type LoaderArgs} from '@shopify/remix-oxygen';
import {
type LinksFunction,
type LoaderFunctionArgs,
} from '@shopify/remix-oxygen';
import {
Links,
Meta,
Expand Down Expand Up @@ -28,7 +31,7 @@ export const links: LinksFunction = () => {
];
};

export async function loader({context}: LoaderArgs) {
export async function loader({context}: LoaderFunctionArgs) {
const layout = await context.storefront.query<{shop: Shop}>(LAYOUT_QUERY);
return {layout};
}
Expand Down
6 changes: 3 additions & 3 deletions examples/customer-api/app/routes/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Form, useLoaderData, useRouteError} from '@remix-run/react';
import {type LoaderArgs, json} from '@shopify/remix-oxygen';
import {type LoaderFunctionArgs, json} from '@shopify/remix-oxygen';

export async function loader({context}: LoaderArgs) {
export async function loader({context}: LoaderFunctionArgs) {
if (await context.customer.isLoggedIn()) {
const user = await context.customer.query(`
{
Expand Down Expand Up @@ -36,7 +36,7 @@ export function ErrorBoundary() {
}

export default function () {
const {user} = useLoaderData();
const {user} = useLoaderData() as any;

return (
<div style={{marginTop: 24}}>
Expand Down
6 changes: 3 additions & 3 deletions examples/customer-api/app/routes/authorize.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {ActionArgs, LoaderArgs} from '@shopify/remix-oxygen';
import {ActionFunctionArgs, LoaderFunctionArgs} from '@shopify/remix-oxygen';

export async function action({context}: ActionArgs) {
export async function action({context}: ActionFunctionArgs) {
return context.customer.login();
}

export async function loader({context}: LoaderArgs) {
export async function loader({context}: LoaderFunctionArgs) {
return context.customer.authorize('/');
}
4 changes: 2 additions & 2 deletions examples/customer-api/app/routes/logout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ActionArgs} from '@shopify/remix-oxygen';
import {ActionFunctionArgs} from '@shopify/remix-oxygen';

export async function action({context}: ActionArgs) {
export async function action({context}: ActionFunctionArgs) {
return context.customer.logout();
}
4 changes: 2 additions & 2 deletions examples/customer-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"prettier": "@shopify/prettier-config",
"dependencies": {
"@remix-run/react": "1.19.1",
"@remix-run/react": "2.1.0",
"@shopify/cli": "3.49.2",
"@shopify/cli-hydrogen": "^5.4.3",
"@shopify/hydrogen": "^2023.7.11",
Expand All @@ -25,7 +25,7 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "1.19.1",
"@remix-run/dev": "2.1.0",
"@shopify/oxygen-workers-types": "^3.17.2",
"@shopify/prettier-config": "^1.1.2",
"@types/eslint": "^8.4.10",
Expand Down
8 changes: 0 additions & 8 deletions examples/customer-api/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,4 @@ module.exports = {
serverModuleFormat: 'esm',
serverPlatform: 'neutral',
serverMinify: process.env.NODE_ENV === 'production',
future: {
v2_dev: true,
v2_meta: true,
v2_headers: true,
v2_errorBoundary: true,
v2_routeConvention: true,
v2_normalizeFormMethod: true,
},
};
2 changes: 1 addition & 1 deletion examples/express/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import {PassThrough} from 'node:stream';

import type {AppLoadContext, EntryContext} from '@remix-run/node';
import {Response} from '@remix-run/node';
import {Response} from '@remix-run/web-fetch';
import {RemixServer} from '@remix-run/react';
import isbot from 'isbot';
import {renderToPipeableStream} from 'react-dom/server';
Expand Down
8 changes: 6 additions & 2 deletions examples/express/app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import {defer, type LinksFunction, type LoaderArgs} from '@remix-run/node';
import {
defer,
type LinksFunction,
type LoaderFunctionArgs,
} from '@remix-run/node';
import {
Links,
Meta,
Expand Down Expand Up @@ -29,7 +33,7 @@ export const links: LinksFunction = () => {
];
};

export async function loader({context}: LoaderArgs) {
export async function loader({context}: LoaderFunctionArgs) {
const [customerAccessToken, cartId] = await Promise.all([
context.session.get('customerAccessToken'),
context.session.get('cartId'),
Expand Down
4 changes: 2 additions & 2 deletions examples/express/app/routes/products.$handle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {json, type LoaderArgs} from '@shopify/remix-oxygen';
import {json, type LoaderFunctionArgs} from '@shopify/remix-oxygen';
import {useLoaderData} from '@remix-run/react';

export async function loader({params, context}: LoaderArgs) {
export async function loader({params, context}: LoaderFunctionArgs) {
const {handle} = params;
const {storefront} = context;

Expand Down
12 changes: 6 additions & 6 deletions examples/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"typecheck": "tsc"
},
"dependencies": {
"@remix-run/css-bundle": "1.19.1",
"@remix-run/express": "1.19.1",
"@remix-run/node": "1.19.1",
"@remix-run/react": "1.19.1",
"@remix-run/css-bundle": "2.1.0",
"@remix-run/express": "2.1.0",
"@remix-run/node": "2.1.0",
"@remix-run/react": "2.1.0",
"@shopify/hydrogen": "^2023.7.11",
"compression": "^1.7.4",
"cross-env": "^7.0.3",
Expand All @@ -25,8 +25,8 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@remix-run/dev": "1.19.1",
"@remix-run/eslint-config": "1.19.1",
"@remix-run/dev": "2.1.0",
"@remix-run/eslint-config": "2.1.0",
"@shopify/cli": "3.49.2",
"@shopify/cli-hydrogen": "^5.4.3",
"@types/compression": "^1.7.2",
Expand Down
8 changes: 0 additions & 8 deletions examples/express/remix.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,4 @@ module.exports = {
// serverBuildPath: "build/index.js",
// publicPath: "/build/",
serverModuleFormat: 'cjs',
future: {
v2_dev: true,
v2_meta: true,
v2_headers: true,
v2_errorBoundary: true,
v2_routeConvention: true,
v2_normalizeFormMethod: true,
},
};
Loading
Loading