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

[examples] Upgrade Remix to v2 #39229

Merged
merged 7 commits into from
Oct 30, 2023
Merged

[examples] Upgrade Remix to v2 #39229

merged 7 commits into from
Oct 30, 2023

Conversation

Nkzn
Copy link
Contributor

@Nkzn Nkzn commented Sep 30, 2023

🚀 Overview

I've updated the Remix framework version to v2 in the Remix sample of MUI's examples.

🌱 Background and Purpose

Remix officially released its v2 version on September 14th. In line with this, the environment setup tool, create-remix, now creates projects based on the v2 template. This necessitated updating the MUI Remix sample to be compatible with v2. Additionally, this sample has @remix-run/react set to latest, which resulted in it being non-functional. This is another reason prompting the update.

🛠 Key Changes

  1. I updated the configuration files based on the current v2 template of Remix.
    • tsconfig.json has many diffs, but the one that really changed is ES2019 => ES2022, the others just changed the order
    • npm scripts postinstall is no longer necessary as of v2 (I also commented inline)
  2. Updated the outdated official documentation URLs referenced in the code to the current ones.
  3. Based on the Remix upgrade guide, I made the following adjustments:
    • Updated the data structure of the meta function to match the latest version.
    • Conformed file naming in the routes/ directory to v2 conventions.
    • Merged the older CatchBoundary component into the new ErrorBoundary component.
  4. While Remix v2 primarily operates in ESM mode, since MUI doesn't support ESM, I explicitly set it to CJS mode in remix.config.js.

📷 Captures

Main Page
ScreenShot 2023-09-30 21 20 42

About Page
ScreenShot 2023-09-30 21 20 48

Movie

2023-09-30.21.27.56.mov

@mui-bot
Copy link

mui-bot commented Sep 30, 2023

Netlify deploy preview

https://deploy-preview-39229--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 111db4e

@@ -4,16 +4,17 @@
"private": true,
"scripts": {
"build": "remix build",
"dev": "remix dev",
"postinstall": "remix setup node",
Copy link
Contributor Author

@Nkzn Nkzn Oct 1, 2023

Choose a reason for hiding this comment

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

this line should be removed on v2.

$ npx remix setup node
WARNING: The setup command is no longer necessary as of v2. This is a no-op. Please remove this from your dev and CI scripts, as it will be removed in v3.

@zannager zannager added the examples Relating to /examples label Oct 2, 2023
@zannager zannager requested a review from mnajdova October 2, 2023 16:24
/**
* @type {import('@remix-run/dev/config').AppConfig}
*/
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
appDirectory: 'app',
browserBuildDirectory: 'public/build',
Copy link

Choose a reason for hiding this comment

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

'browserBuildDirectory' to 'assetsBuildDirectory'
https://remix.run/docs/en/main/start/v2#browserbuilddirectory

/**
* @type {import('@remix-run/dev/config').AppConfig}
*/
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
appDirectory: 'app',
browserBuildDirectory: 'public/build',
publicPath: '/build/',
serverBuildDirectory: 'build',
Copy link

Choose a reason for hiding this comment

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

'serverBuildDirectory' to 'serverBuildPath'
https://remix.run/docs/en/main/start/v2#serverbuilddirectory

/**
* @type {import('@remix-run/dev/config').AppConfig}
*/
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
appDirectory: 'app',
browserBuildDirectory: 'public/build',
publicPath: '/build/',
serverBuildDirectory: 'build',
devServerPort: 8002,
Copy link

Choose a reason for hiding this comment

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

'devServerPort: 8002,' to

future: {
    dev: {
      port: 8002,
    },
  },

https://remix.run/docs/en/main/start/v2#devserverport

@@ -1,20 +1,22 @@
{
Copy link

Choose a reason for hiding this comment

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

add "module": "CommonJS",

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

I can't find anything missing. This is one of the best community contributions I've seen recently, offering a great PR description and well documentation of each change. Very well done, especially considering it is a first contribution to the project! I hope to see many more in the future 👌

@mnajdova mnajdova merged commit 8df1870 into mui:master Oct 30, 2023
20 checks passed
@Nkzn Nkzn deleted the remix-v2 branch October 30, 2023 11:50
@samuelsycamore samuelsycamore mentioned this pull request Nov 6, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Relating to /examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants