Skip to content

chore: warn for incorrect _redirects file #1078

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

Merged
merged 3 commits into from
Jan 24, 2022
Merged

chore: warn for incorrect _redirects file #1078

merged 3 commits into from
Jan 24, 2022

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Dec 23, 2021

Summary

Adds a warning for _redirects files in the site root. We used to silently add these to the user's redirects, but we now follow the documented behaviour, which is that the files should go in the publish dir not site root. #1130 adds this to the docs, and the CLI warns about it too, but this adds Next.js-specific logs, with instructions on where it needs to go.

Test plan

  1. Add a _redirects file to the root of a demo site
  2. Run a build

Relevant links (GitHub issues, Notion docs, etc.) or a picture of cute animal

Issue that shows the problem: #1008
capybara

Standard checks:

  • Check the Deploy Preview's Demo site for your PR's functionality
  • Add docs when necessary

🧪 Once merged, make sure to update the version if needed and that it was published correctly.

@netlify
Copy link

netlify bot commented Dec 23, 2021

✔️ Deploy Preview for netlify-plugin-nextjs-nx-monorepo-demo ready!

🔨 Explore the source changes: e23850a

🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-nx-monorepo-demo/deploys/61eeb827fca6e6000781bb1f

😎 Browse the preview: https://deploy-preview-1078--netlify-plugin-nextjs-nx-monorepo-demo.netlify.app/

@netlify
Copy link

netlify bot commented Dec 23, 2021

✔️ Deploy Preview for netlify-plugin-nextjs-static-root-demo ready!

🔨 Explore the source changes: e23850a

🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-static-root-demo/deploys/61eeb827db0f0b00070a413a

😎 Browse the preview: https://deploy-preview-1078--netlify-plugin-nextjs-static-root-demo.netlify.app

@netlify
Copy link

netlify bot commented Dec 23, 2021

✔️ Deploy Preview for netlify-plugin-nextjs-demo ready!

🔨 Explore the source changes: e23850a

🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-demo/deploys/61eeb8271c36a80007274538

😎 Browse the preview: https://deploy-preview-1078--netlify-plugin-nextjs-demo.netlify.app

@github-actions github-actions bot added the type: chore work needed to keep the product and development running smoothly label Dec 23, 2021
@netlify
Copy link

netlify bot commented Dec 23, 2021

✔️ Deploy Preview for netlify-plugin-nextjs-export-demo ready!

🔨 Explore the source changes: e23850a

🔍 Inspect the deploy log: https://app.netlify.com/sites/netlify-plugin-nextjs-export-demo/deploys/61eeb827bf30bf00085b5b41

😎 Browse the preview: https://deploy-preview-1078--netlify-plugin-nextjs-export-demo.netlify.app

@cypress
Copy link

cypress bot commented Dec 23, 2021



Test summary

2 0 0 0


Run details

Project netlify-plugin-nextjs-nx-monorepo-demo
Status Passed
Commit 3d43d3d
Started Dec 23, 2021 4:02 PM
Ended Dec 23, 2021 4:03 PM
Duration 01:09 💡
OS Linux Ubuntu - 20.04
Browser Custom chromium 90

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Dec 23, 2021



Test summary

7 0 0 0


Run details

Project netlify-plugin-nextjs-static-demo
Status Passed
Commit 3d43d3d
Started Dec 23, 2021 4:02 PM
Ended Dec 23, 2021 4:03 PM
Duration 01:19 💡
OS Linux Ubuntu - 20.04
Browser Custom chromium 90

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Dec 23, 2021



Test summary

17 0 0 0


Run details

Project netlify-plugin-nextjs-default-demo
Status Passed
Commit 3d43d3d
Started Dec 23, 2021 4:02 PM
Ended Dec 23, 2021 4:05 PM
Duration 02:15 💡
OS Linux Ubuntu - 20.04
Browser Custom chromium 90

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

naelkhann
naelkhann previously approved these changes Jan 4, 2022
Copy link

@naelkhann naelkhann left a comment

Choose a reason for hiding this comment

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

👍 definitely a small helpful change to the docs

if (existsSync(join(appDir, '_redirects'))) {
console.log(
yellowBright(
`You have a "_redirects" file in your root directory, which is not deployed and will be ignored. If you want it to be used, please move it into "public".`,

Choose a reason for hiding this comment

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

🙌

@ascorbic ascorbic requested a review from tiffafoo January 17, 2022 10:46
@ascorbic ascorbic marked this pull request as ready for review January 17, 2022 10:47
@ascorbic ascorbic self-assigned this Jan 17, 2022
@ascorbic ascorbic changed the title chore: warn for incorrect _redirects file, and update docs chore: warn for incorrect _redirects file Jan 17, 2022
@cypress
Copy link

cypress bot commented Jan 24, 2022



Test summary

7 0 0 0


Run details

Project netlify-plugin-nextjs-static-demo
Status Passed
Commit 29776c6 ℹ️
Started Jan 24, 2022 2:15 PM
Ended Jan 24, 2022 2:16 PM
Duration 01:11 💡
OS Linux Ubuntu - 20.04
Browser Chrome 97

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Jan 24, 2022



Test summary

2 0 0 0


Run details

Project netlify-plugin-nextjs-nx-monorepo-demo
Status Passed
Commit 29776c6 ℹ️
Started Jan 24, 2022 2:15 PM
Ended Jan 24, 2022 2:16 PM
Duration 01:11 💡
OS Linux Ubuntu - 20.04
Browser Chrome 97

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@cypress
Copy link

cypress bot commented Jan 24, 2022



Test summary

17 0 0 0


Run details

Project netlify-plugin-nextjs-default-demo
Status Passed
Commit 29776c6 ℹ️
Started Jan 24, 2022 2:15 PM
Ended Jan 24, 2022 2:16 PM
Duration 01:38 💡
OS Linux Ubuntu - 20.04
Browser Chrome 97

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@@ -187,4 +187,14 @@ export const warnForProblematicUserRewrites = ({
`),
)
}

export const warnForRootRedirects = ({ appDir }: { appDir: string }) => {

Choose a reason for hiding this comment

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

Suggested change
export const warnForRootRedirects = ({ appDir }: { appDir: string }) => {
export const warnForRootRedirects = ({ appDir }: { appDir: string }): void => {

@kodiakhq kodiakhq bot merged commit ab68895 into main Jan 24, 2022
@kodiakhq kodiakhq bot deleted the mk/warn-redirects branch January 24, 2022 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge type: chore work needed to keep the product and development running smoothly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants