From 4866ca1f45a049347f9c1762dd92a8ccda1ef253 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 16:55:15 -0400 Subject: [PATCH 01/14] Remove default status --- netlify.toml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/netlify.toml b/netlify.toml index 9fdeaa0ff..4dd002b3f 100644 --- a/netlify.toml +++ b/netlify.toml @@ -17,131 +17,112 @@ [[redirects]] from = "https://testing-library.com/discord" to = "https://discord.gg/c6JN9fM" - status = 301 force = true # React root to React landing page [[redirects]] from = "https://react-testing-library.com/" to = "https://testing-library.com/react/" - status = 301 force = true # React to main domain [[redirects]] from = "https://react-testing-library.com/*" to = "https://testing-library.com/:splat" - status = 301 force = true # Netlify subdomain to main domain [[redirects]] from = "https://testing-library.netlify.com/*" to = "https://testing-library.com/:splat" - status = 301 force = true # Redirects due to reorganization [[redirects]] from = "/docs/*" to = "/docs/dom-testing-library/:splat" - status = 301 force = false # do not redirect if route is not 404 # Support page to help page [[redirects]] from = "/support" to = "/help" - status = 301 force = true # DOM landing page to home page [[redirects]] from = "https://testing-library.com/dom/" to = "https://testing-library.com/docs/dom-testing-library/intro" - status = 301 force = true # React landing page to home page [[redirects]] from = "https://testing-library.com/react/" to = "https://testing-library.com/docs/react-testing-library/intro" - status = 301 force = true # React Native landing page to home page [[redirects]] from = "https://testing-library.com/react-native/" to = "https://testing-library.com/docs/react-native-testing-library/intro" - status = 301 force = true # Cypress landing page to home page [[redirects]] from = "https://testing-library.com/cypress/" to = "https://testing-library.com/docs/cypress-testing-library/intro" - status = 301 force = true # Vue landing page to home page [[redirects]] from = "https://testing-library.com/vue/" to = "https://testing-library.com/docs/vue-testing-library/intro" - status = 301 force = true # Angular landing page to home page [[redirects]] from = "https://testing-library.com/angular/" to = "https://testing-library.com/docs/angular-testing-library/intro" - status = 301 force = true # Puppeteer landing page to home page [[redirects]] from = "https://testing-library.com/pptr/" to = "https://testing-library.com/docs/pptr-testing-library/intro" - status = 301 force = true # Svelte landing page to home page [[redirects]] from = "https://testing-library.com/svelte/" to = "https://testing-library.com/docs/svelte-testing-library/intro" - status = 301 force = true # Preact landing page to home page [[redirects]] from = "https://testing-library.com/preact/" to = "https://testing-library.com/docs/preact-testing-library/intro" - status = 301 force = true # jest-dom landing page to home page [[redirects]] from = "https://testing-library.com/jest-dom/" to = "https://testing-library.com/docs/ecosystem-jest-dom" - status = 301 force = true # Testcafe landing page to home page [[redirects]] from = "https://testing-library.com/testcafe/" to = "https://testing-library.com/docs/testcafe-testing-library/intro" - status = 301 force = true # Nightwatch landing page to home page [[redirects]] from = "https://testing-library.com/nightwatch/" to = "https://testing-library.com/docs/nightwatch-testing-library/intro" - status = 301 force = true # React Redux recipe to Redux's recipe [[redirects]] from = "https://testing-library.com/docs/example-react-redux" to = "https://redux.js.org/recipes/writing-tests#connected-components" - status = 301 force = true From 363b612f38fd30adf431624a97ad6cfaa0e04bcc Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 16:56:26 -0400 Subject: [PATCH 02/14] Remove default force --- netlify.toml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/netlify.toml b/netlify.toml index 4dd002b3f..7b3b736b6 100644 --- a/netlify.toml +++ b/netlify.toml @@ -37,11 +37,10 @@ to = "https://testing-library.com/:splat" force = true -# Redirects due to reorganization +# Redirects due to reorganization (do not redirect if route is not 404) [[redirects]] from = "/docs/*" to = "/docs/dom-testing-library/:splat" - force = false # do not redirect if route is not 404 # Support page to help page [[redirects]] From 24f713f43f85ff0a56e2be95f044dd7508bed631 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 17:08:37 -0400 Subject: [PATCH 03/14] Remove default base --- netlify.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/netlify.toml b/netlify.toml index 7b3b736b6..7f948b3a2 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,10 +1,6 @@ # Settings in the [build] context are global and are applied to all contexts # unless otherwise overridden by more specific contexts. [build] - # Directory to change to before starting a build. - # This is where we will look for package.json/.nvmrc/etc. - base = "" - # Directory (relative to root of your repo) that contains the deploy-ready # HTML files and assets generated by the build. If a base directory has # been specified, include it in the publish directory path. From c5335b244cbd31749b69667a7e4d1fab69939bcb Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 17:20:40 -0400 Subject: [PATCH 04/14] Remove irrelevant comments --- netlify.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/netlify.toml b/netlify.toml index 7f948b3a2..dd65945b1 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,9 +1,6 @@ -# Settings in the [build] context are global and are applied to all contexts -# unless otherwise overridden by more specific contexts. [build] # Directory (relative to root of your repo) that contains the deploy-ready - # HTML files and assets generated by the build. If a base directory has - # been specified, include it in the publish directory path. + # HTML files and assets generated by the build. publish = "website/build/testing-library-docs" # Default build command. From 6b863c7e9fd44172fd3151d5c39910af285b9cc8 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 17:28:02 -0400 Subject: [PATCH 05/14] Use Yarn to make prod builds consistent with dev --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index dd65945b1..9c114d128 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,7 +4,7 @@ publish = "website/build/testing-library-docs" # Default build command. - command = "cd website; npm install; npm run format-docs; npm run build" + command = "cd website; yarn; yarn format-docs; yarn build" # Shortcut to discord server invite [[redirects]] From 9aae986ce4ae0b2e8b3796e5a41943b9a6b49d2f Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 18:15:25 -0400 Subject: [PATCH 06/14] Launch Netlify Dev by default (like Docusaurus) --- netlify.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netlify.toml b/netlify.toml index 9c114d128..5b15ed7e8 100644 --- a/netlify.toml +++ b/netlify.toml @@ -6,6 +6,9 @@ # Default build command. command = "cd website; yarn; yarn format-docs; yarn build" +[dev] + autoLaunch = true # a Boolean value that determines if Netlify Dev launches the local server address in your browser + # Shortcut to discord server invite [[redirects]] from = "https://testing-library.com/discord" From 5f64fcf682f044d463bea17eedec5f0653ef09ee Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 19:24:04 -0400 Subject: [PATCH 07/14] Support redirects in development and previews --- netlify.toml | 58 ++++++++++++++++++++++++++-------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/netlify.toml b/netlify.toml index 5b15ed7e8..dfae7d0e8 100644 --- a/netlify.toml +++ b/netlify.toml @@ -11,26 +11,26 @@ # Shortcut to discord server invite [[redirects]] - from = "https://testing-library.com/discord" + from = "/discord" to = "https://discord.gg/c6JN9fM" force = true # React root to React landing page [[redirects]] from = "https://react-testing-library.com/" - to = "https://testing-library.com/react/" + to = "/react/" force = true # React to main domain [[redirects]] from = "https://react-testing-library.com/*" - to = "https://testing-library.com/:splat" + to = "/:splat" force = true # Netlify subdomain to main domain [[redirects]] from = "https://testing-library.netlify.com/*" - to = "https://testing-library.com/:splat" + to = "/:splat" force = true # Redirects due to reorganization (do not redirect if route is not 404) @@ -46,78 +46,78 @@ # DOM landing page to home page [[redirects]] - from = "https://testing-library.com/dom/" - to = "https://testing-library.com/docs/dom-testing-library/intro" + from = "/dom/" + to = "/docs/dom-testing-library/intro" force = true # React landing page to home page [[redirects]] - from = "https://testing-library.com/react/" - to = "https://testing-library.com/docs/react-testing-library/intro" + from = "/react/" + to = "/docs/react-testing-library/intro" force = true # React Native landing page to home page [[redirects]] - from = "https://testing-library.com/react-native/" - to = "https://testing-library.com/docs/react-native-testing-library/intro" + from = "/react-native/" + to = "/docs/react-native-testing-library/intro" force = true # Cypress landing page to home page [[redirects]] - from = "https://testing-library.com/cypress/" - to = "https://testing-library.com/docs/cypress-testing-library/intro" + from = "/cypress/" + to = "/docs/cypress-testing-library/intro" force = true # Vue landing page to home page [[redirects]] - from = "https://testing-library.com/vue/" - to = "https://testing-library.com/docs/vue-testing-library/intro" + from = "/vue/" + to = "/docs/vue-testing-library/intro" force = true # Angular landing page to home page [[redirects]] - from = "https://testing-library.com/angular/" - to = "https://testing-library.com/docs/angular-testing-library/intro" + from = "/angular/" + to = "/docs/angular-testing-library/intro" force = true # Puppeteer landing page to home page [[redirects]] - from = "https://testing-library.com/pptr/" - to = "https://testing-library.com/docs/pptr-testing-library/intro" + from = "/pptr/" + to = "/docs/pptr-testing-library/intro" force = true # Svelte landing page to home page [[redirects]] - from = "https://testing-library.com/svelte/" - to = "https://testing-library.com/docs/svelte-testing-library/intro" + from = "/svelte/" + to = "/docs/svelte-testing-library/intro" force = true # Preact landing page to home page [[redirects]] - from = "https://testing-library.com/preact/" - to = "https://testing-library.com/docs/preact-testing-library/intro" + from = "/preact/" + to = "/docs/preact-testing-library/intro" force = true # jest-dom landing page to home page [[redirects]] - from = "https://testing-library.com/jest-dom/" - to = "https://testing-library.com/docs/ecosystem-jest-dom" + from = "/jest-dom/" + to = "/docs/ecosystem-jest-dom" force = true # Testcafe landing page to home page [[redirects]] - from = "https://testing-library.com/testcafe/" - to = "https://testing-library.com/docs/testcafe-testing-library/intro" + from = "/testcafe/" + to = "/docs/testcafe-testing-library/intro" force = true # Nightwatch landing page to home page [[redirects]] - from = "https://testing-library.com/nightwatch/" - to = "https://testing-library.com/docs/nightwatch-testing-library/intro" + from = "/nightwatch/" + to = "/docs/nightwatch-testing-library/intro" force = true # React Redux recipe to Redux's recipe [[redirects]] - from = "https://testing-library.com/docs/example-react-redux" + from = "/docs/example-react-redux" to = "https://redux.js.org/recipes/writing-tests#connected-components" force = true From dd7f1ba142386ead934264695eb03831cbb2d657 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 19:31:43 -0400 Subject: [PATCH 08/14] Explicitly install Yarn for Netlify --- website/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/package.json b/website/package.json index 54724868d..678c17232 100644 --- a/website/package.json +++ b/website/package.json @@ -16,7 +16,8 @@ "docusaurus": "^1.7.2", "husky": "^1.3.1", "lint-staged": "^8.1.0", - "prettier": "^1.15.3" + "prettier": "^1.15.3", + "yarn": "^1.22.5" }, "lint-staged": { "linters": { From 4201eec490ea64c5e913db40426b5060892f3dff Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 19:34:36 -0400 Subject: [PATCH 09/14] Install Yarn via netlify.toml (not package.json) --- netlify.toml | 2 +- website/package.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index dfae7d0e8..3b4b69114 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,7 +4,7 @@ publish = "website/build/testing-library-docs" # Default build command. - command = "cd website; yarn; yarn format-docs; yarn build" + command = "npm i -g yarn; cd website; yarn; yarn format-docs; yarn build" [dev] autoLaunch = true # a Boolean value that determines if Netlify Dev launches the local server address in your browser diff --git a/website/package.json b/website/package.json index 678c17232..54724868d 100644 --- a/website/package.json +++ b/website/package.json @@ -16,8 +16,7 @@ "docusaurus": "^1.7.2", "husky": "^1.3.1", "lint-staged": "^8.1.0", - "prettier": "^1.15.3", - "yarn": "^1.22.5" + "prettier": "^1.15.3" }, "lint-staged": { "linters": { From 4285ee2da9fb32a285854cf98a414f427b4f0f0a Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Sun, 6 Sep 2020 22:43:09 -0400 Subject: [PATCH 10/14] Fix React Redux redirect --- netlify.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/netlify.toml b/netlify.toml index 3b4b69114..920f1a473 100644 --- a/netlify.toml +++ b/netlify.toml @@ -33,6 +33,12 @@ to = "/:splat" force = true +# React Redux recipe to Redux's recipe +[[redirects]] + from = "/docs/example-react-redux" + to = "https://redux.js.org/recipes/writing-tests#connected-components" + force = true + # Redirects due to reorganization (do not redirect if route is not 404) [[redirects]] from = "/docs/*" @@ -115,9 +121,3 @@ from = "/nightwatch/" to = "/docs/nightwatch-testing-library/intro" force = true - -# React Redux recipe to Redux's recipe -[[redirects]] - from = "/docs/example-react-redux" - to = "https://redux.js.org/recipes/writing-tests#connected-components" - force = true From 4d86bebdaea9df41121b561583293617166c7502 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Mon, 7 Sep 2020 18:30:26 -0400 Subject: [PATCH 11/14] Only force domain-level redirects --- netlify.toml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/netlify.toml b/netlify.toml index 920f1a473..09bec74fa 100644 --- a/netlify.toml +++ b/netlify.toml @@ -13,7 +13,6 @@ [[redirects]] from = "/discord" to = "https://discord.gg/c6JN9fM" - force = true # React root to React landing page [[redirects]] @@ -37,7 +36,6 @@ [[redirects]] from = "/docs/example-react-redux" to = "https://redux.js.org/recipes/writing-tests#connected-components" - force = true # Redirects due to reorganization (do not redirect if route is not 404) [[redirects]] @@ -48,76 +46,63 @@ [[redirects]] from = "/support" to = "/help" - force = true # DOM landing page to home page [[redirects]] from = "/dom/" to = "/docs/dom-testing-library/intro" - force = true # React landing page to home page [[redirects]] from = "/react/" to = "/docs/react-testing-library/intro" - force = true # React Native landing page to home page [[redirects]] from = "/react-native/" to = "/docs/react-native-testing-library/intro" - force = true # Cypress landing page to home page [[redirects]] from = "/cypress/" to = "/docs/cypress-testing-library/intro" - force = true # Vue landing page to home page [[redirects]] from = "/vue/" to = "/docs/vue-testing-library/intro" - force = true # Angular landing page to home page [[redirects]] from = "/angular/" to = "/docs/angular-testing-library/intro" - force = true # Puppeteer landing page to home page [[redirects]] from = "/pptr/" to = "/docs/pptr-testing-library/intro" - force = true # Svelte landing page to home page [[redirects]] from = "/svelte/" to = "/docs/svelte-testing-library/intro" - force = true # Preact landing page to home page [[redirects]] from = "/preact/" to = "/docs/preact-testing-library/intro" - force = true # jest-dom landing page to home page [[redirects]] from = "/jest-dom/" to = "/docs/ecosystem-jest-dom" - force = true # Testcafe landing page to home page [[redirects]] from = "/testcafe/" to = "/docs/testcafe-testing-library/intro" - force = true # Nightwatch landing page to home page [[redirects]] from = "/nightwatch/" to = "/docs/nightwatch-testing-library/intro" - force = true From 98205951494e8bc9b1d4f3d3f95ca605dae33bfc Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 9 Sep 2020 15:25:30 -0400 Subject: [PATCH 12/14] Consistent comment formatting --- netlify.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/netlify.toml b/netlify.toml index 09bec74fa..a646b1d6a 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,13 +1,14 @@ [build] # Directory (relative to root of your repo) that contains the deploy-ready - # HTML files and assets generated by the build. + # HTML files and assets generated by the build publish = "website/build/testing-library-docs" - # Default build command. + # Default build command command = "npm i -g yarn; cd website; yarn; yarn format-docs; yarn build" [dev] - autoLaunch = true # a Boolean value that determines if Netlify Dev launches the local server address in your browser + # A Boolean value that determines if Netlify Dev launches the local server address in your browser + autoLaunch = true # Shortcut to discord server invite [[redirects]] From b833e628af1445a9dede07e02f1a4cb836b09fe4 Mon Sep 17 00:00:00 2001 From: Nick McCurdy Date: Wed, 9 Sep 2020 16:02:31 -0400 Subject: [PATCH 13/14] Reorganize redirects for safety and readability --- netlify.toml | 52 ++++++++++++++-------------------------------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/netlify.toml b/netlify.toml index a646b1d6a..289e32074 100644 --- a/netlify.toml +++ b/netlify.toml @@ -10,100 +10,76 @@ # A Boolean value that determines if Netlify Dev launches the local server address in your browser autoLaunch = true -# Shortcut to discord server invite -[[redirects]] - from = "/discord" - to = "https://discord.gg/c6JN9fM" +# Redirects -# React root to React landing page +# Domains [[redirects]] from = "https://react-testing-library.com/" to = "/react/" force = true - -# React to main domain [[redirects]] from = "https://react-testing-library.com/*" to = "/:splat" force = true - -# Netlify subdomain to main domain [[redirects]] from = "https://testing-library.netlify.com/*" to = "/:splat" force = true +# Shortcut to Discord server invite +[[redirects]] + from = "/discord" + to = "https://discord.gg/c6JN9fM" + +# Support page to help page +[[redirects]] + from = "/support" + to = "/help" + # React Redux recipe to Redux's recipe [[redirects]] from = "/docs/example-react-redux" to = "https://redux.js.org/recipes/writing-tests#connected-components" -# Redirects due to reorganization (do not redirect if route is not 404) +# Reorganization (do not redirect if route is not 404) [[redirects]] from = "/docs/*" to = "/docs/dom-testing-library/:splat" -# Support page to help page -[[redirects]] - from = "/support" - to = "/help" - -# DOM landing page to home page +# Landing pages [[redirects]] from = "/dom/" to = "/docs/dom-testing-library/intro" - -# React landing page to home page [[redirects]] from = "/react/" to = "/docs/react-testing-library/intro" - -# React Native landing page to home page [[redirects]] from = "/react-native/" to = "/docs/react-native-testing-library/intro" - -# Cypress landing page to home page [[redirects]] from = "/cypress/" to = "/docs/cypress-testing-library/intro" - -# Vue landing page to home page [[redirects]] from = "/vue/" to = "/docs/vue-testing-library/intro" - -# Angular landing page to home page [[redirects]] from = "/angular/" to = "/docs/angular-testing-library/intro" - -# Puppeteer landing page to home page [[redirects]] from = "/pptr/" to = "/docs/pptr-testing-library/intro" - -# Svelte landing page to home page [[redirects]] from = "/svelte/" to = "/docs/svelte-testing-library/intro" - -# Preact landing page to home page [[redirects]] from = "/preact/" to = "/docs/preact-testing-library/intro" - -# jest-dom landing page to home page [[redirects]] from = "/jest-dom/" to = "/docs/ecosystem-jest-dom" - -# Testcafe landing page to home page [[redirects]] from = "/testcafe/" to = "/docs/testcafe-testing-library/intro" - -# Nightwatch landing page to home page [[redirects]] from = "/nightwatch/" to = "/docs/nightwatch-testing-library/intro" From ce4ccb293bd8bbd332979146625cc6185ef7a0ca Mon Sep 17 00:00:00 2001 From: Alex Krolick Date: Thu, 1 Oct 2020 11:40:44 -0700 Subject: [PATCH 14/14] fix(docs): revert yarn back to npm --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 289e32074..645a4bedb 100644 --- a/netlify.toml +++ b/netlify.toml @@ -4,7 +4,7 @@ publish = "website/build/testing-library-docs" # Default build command - command = "npm i -g yarn; cd website; yarn; yarn format-docs; yarn build" + command = "cd website; npm install; npm run format-docs; npm run build" [dev] # A Boolean value that determines if Netlify Dev launches the local server address in your browser