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

templates(netlify): improve DX for Netlify serverless template #3754

Merged
merged 10 commits into from
Jul 16, 2022
Merged

templates(netlify): improve DX for Netlify serverless template #3754

merged 10 commits into from
Jul 16, 2022

Conversation

nickytonline
Copy link
Contributor

@nickytonline nickytonline commented Jul 15, 2022

This PR improves the DX when using the Netlify template to build out your Remix application. cc: @ascorbic. I've based this PR off of main because I believe @mcansh mentioned that if it's just template changes, there's no need to branch off of the dev branch.

Closes: #3753

  • Docs
  • Tests

Testing Strategy:

  1. Create a new Remix application and select Netlify for the deployment target.
  2. You can install whatever you'd like in the Remix CLI steps. It also doesn't matter if you select TypeScript or JavaScript
  3. Once your application has been created, from a shell, change to the root directory of your new application.
  4. Run npm run dev
  5. The Remix dev server starts and renders the main page when navigating to http://localhost:3000
  6. Stop the Remix dev server.
  7. Run netlify dev. The server running on Netlify functions locally starts and renders the main page when navigating to http://localhost:3000.
  8. Run netlify deploy --build. If you're application isn't configured to deploy yet, ensure you've followed the steps in the README first to get your app configured to deploy to Netlify.
  9. The application builds and deploys. Navigate to the deploy preview. The site loads.

@changeset-bot
Copy link

changeset-bot bot commented Jul 15, 2022

⚠️ No Changeset found

Latest commit: 8138f2b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jul 15, 2022

Hi @nickytonline,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run.

Thanks!

- The Remix team

templates/netlify/remix.config.js Outdated Show resolved Hide resolved
templates/netlify/package.json Show resolved Hide resolved
@nickytonline nickytonline marked this pull request as ready for review July 15, 2022 15:40
@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented Jul 15, 2022

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

@nickytonline
Copy link
Contributor Author

nickytonline commented Jul 15, 2022

Before this gets merged, I'd like to have at least one of my team members approve it, so for the moment, I will put it back in draft.

@nickytonline nickytonline marked this pull request as draft July 15, 2022 15:43
Copy link
Contributor

@KyleBlankRollins KyleBlankRollins left a comment

Choose a reason for hiding this comment

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

Thanks for tagging me, @nickytonline! Although I personally find "serverless server" hilarious, I'm not sure we want to use it in the docs.

Let me know if you have questions!

templates/netlify/README.md Outdated Show resolved Hide resolved
templates/netlify/README.md Outdated Show resolved Hide resolved
templates/netlify/README.md Outdated Show resolved Hide resolved
templates/netlify/README.md Outdated Show resolved Hide resolved
templates/netlify/README.md Outdated Show resolved Hide resolved
nickytonline and others added 5 commits July 15, 2022 16:17
Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>
Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>
Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>
@nickytonline nickytonline marked this pull request as ready for review July 15, 2022 21:12
@@ -1,7 +1,10 @@
/** @type {import('@remix-run/dev').AppConfig} */
module.exports = {
serverBuildTarget: "netlify",
server: "./server.js",
server:
Copy link
Contributor Author

@nickytonline nickytonline Jul 15, 2022

Choose a reason for hiding this comment

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

This check is to ensure we do not start the Netlify function to run the Remix app server when running npm run dev, i.e. remix dev as you can't run a custom server via remix dev. Without this check, if you run remix dev it will error out with the following message:

Error: remix dev is not supported for custom servers.
    at Object.dev (/Users/some_user/dev/issues/remix-tailwind/node_modules/@remix-run/dev/cli/commands.js:260:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.run (/Users/some_user/dev/issues/remix-tailwind/node_modules/@remix-run/dev/cli/run.js:499:7)
ERROR: "dev:remix" exited with 1.

@MichaelDeBoey MichaelDeBoey changed the title chore: improve DX for Netlify serverless template templates(netlify): improve DX for Netlify serverless template Jul 16, 2022
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

Thank you!

@kentcdodds kentcdodds merged commit 99d98bd into remix-run:main Jul 16, 2022
@nickytonline nickytonline deleted the update-netlify-functions-template branch July 16, 2022 16:20
dvargas92495 pushed a commit to dvargas92495/remix that referenced this pull request Jul 22, 2022
…-run#3754)

* chore: improve DX for Netlify serverless template

* added myself as a contributor to Remix

* chore: updated some documentation

* changed conditional check for generating Remix config

* Update templates/netlify/README.md

Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>

* Update templates/netlify/README.md

Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>

* Update templates/netlify/README.md

Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>

* chore: added a link to Netlify Functions in the Netlify README

* updated deployment commands

Co-authored-by: Kyle Rollins <kyleblankrollins@gmail.com>
juliuxu added a commit to capraconsulting/nettsiden that referenced this pull request Sep 9, 2022
juliuxu added a commit to capraconsulting/nettsiden that referenced this pull request Oct 6, 2022
@devraj
Copy link

devraj commented Apr 29, 2023

@nickytonline I was wondering if this was released? I still see something similar in 1.15 and the app ends up with hydration exceptions. The original issue is now locked hence posting here

Screenshot 2023-04-29 at 3 48 15 pm

@nickytonline
Copy link
Contributor Author

@devraj, the home for the Netlify templates can now be found in this Remix stack, https://github.com/netlify/remix-template. The CLI still points to the one that only supports the Netlify Functions template.

Kent or others, I know long term, folks are encouraged to build their templates outside of the repo, but given that Netlify is still an option in the CLI like Vercel, Deno etc., could we point to the https://github.com/netlify/remix-template Stack instead when someone selects Netlify?

Happy to create a PR for this.

@machour
Copy link
Collaborator

machour commented Apr 30, 2023

@nickytonline Your best course of action here is to create a new proposal in the discussions tab 🙏🏼

@devraj
Copy link

devraj commented Apr 30, 2023

@devraj, the home for the Netlify templates can now be found in this Remix stack, https://github.com/netlify/remix-template. The CLI still points to the one that only supports the Netlify Functions template.

Kent or others, I know long term, folks are encouraged to build their templates outside of the repo, but given that Netlify is still an option in the CLI like Vercel, Deno etc., could we point to the https://github.com/netlify/remix-template Stack instead when someone selects Netlify?

Happy to create a PR for this.

I agree. If that repo is what is kept up to date, then it would save everyone deploying to Netlify a lot of time. Appreciate you taking the time to post a response..

@nickytonline
Copy link
Contributor Author

@devraj, just FYI, the CLI is getting updated with the official template. See #6281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants