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

feat!: update to Remix 2 #128

Merged
merged 22 commits into from
Nov 2, 2023
Merged

feat!: update to Remix 2 #128

merged 22 commits into from
Nov 2, 2023

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Oct 16, 2023

Description

Updates the templates for Remix 2. This includes:

  • converting the site to ESM
  • upgrading Remix
  • switching the adapters to the new versions
  • new server.ts files and config files, including converting to Functions v2
  • replace entry.server.ts with a re-export from the adapters
  • many changes to the init script, including fixing a bug that prevented git from being initted and another that prevented new dependencies from being installed

@netlify
Copy link

netlify bot commented Oct 16, 2023

Deploy Preview for remix-edge-on ready!

Name Link
🔨 Latest commit 2e4e990
🔍 Latest deploy log https://app.netlify.com/sites/remix-edge-on/deploys/65437c20898698000893d4c1
😎 Deploy Preview https://deploy-preview-128--remix-edge-on.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Oct 16, 2023
remix.init/entry.server.tsx Outdated Show resolved Hide resolved
@@ -2,6 +2,11 @@
command = "npm run build"
publish = "public"

[dev]
command = "npm run dev"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We no longer run a dev command - ntl is spawned by remix

remix.init/remix.config.js Outdated Show resolved Hide resolved
remix.init/root.tsx Outdated Show resolved Hide resolved
@netlify
Copy link

netlify bot commented Oct 26, 2023

Deploy Preview for remix-on ready!

Name Link
🔨 Latest commit 2e4e990
🔍 Latest deploy log https://app.netlify.com/sites/remix-on/deploys/65437c20d0d84a0008eff018
😎 Deploy Preview https://deploy-preview-128--remix-on.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ascorbic ascorbic marked this pull request as ready for review October 26, 2023 18:22
@ascorbic ascorbic requested a review from a team as a code owner October 26, 2023 18:22
remix.init/netlify-toml Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the new default in Remix

status: responseStatusCode,
});
}
export { handleRequest as default } from "@netlify/remix-adapter";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We now define the handler in the adapter, so this is all that's needed!

netlify dev
npm run dev
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use the new v2 dev mode, which allows remiox dev to run a custom server, which in our case is ntl dev. For that reason we dont want them running it themselves

const foldersToExclude = [".github", ".git"];
const foldersToExclude = [".github"];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The .git dir is created by Remix, and is this site's initial commit

@@ -116,6 +125,7 @@ async function main({ rootDirectory }) {
rootDirectory,
});
await updatePackageJsonForFunctions(rootDirectory);
await installAdditionalDependencies({ rootDirectory, packageManager });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both runtimes need an extra install step

Comment on lines +4 to +9
const handler = createRequestHandler({
build,
mode: process.env.NODE_ENV,
});

export default handler;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't recognise it as a v2 function if we export it directly, so we assign to a var and export that

Copy link

@orinokai orinokai left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢

@ascorbic ascorbic merged commit 8b381c3 into main Nov 2, 2023
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants