From 614990aa84a928606450176dc618cfd2f0e41abd Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 13:24:48 -0500 Subject: [PATCH 1/8] remove root redirect --- nuxt.config.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/nuxt.config.js b/nuxt.config.js index aa0ad33084..48feb14cd1 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -100,9 +100,6 @@ export default { lazy: true, langDir: "locales", defaultLocale: "en", - rootRedirect: { - path: "death-of-a-loved-one", - }, }, // Axios module configuration: https://go.nuxtjs.dev/config-axios From c9bc98892667f978076682c8acb766de2707076b Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 13:25:09 -0500 Subject: [PATCH 2/8] include middleware for lifeEvent views --- pages/_lifeEvent.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pages/_lifeEvent.vue b/pages/_lifeEvent.vue index e235417987..e1fd9429cc 100644 --- a/pages/_lifeEvent.vue +++ b/pages/_lifeEvent.vue @@ -8,11 +8,11 @@ class="font-heading-lg tablet:font-heading-xl tablet:margin-top-4 text-secondary print:text-black"> {{ lifeEvent.secondaryHeadline }} - +

{{$t("beta.subheader")}}

- +

@@ -215,6 +215,7 @@ import { tObj, tCsv } from "~/services/translation" export default { name: "LifeEvent", layout: "default", + middleware: ['middleware'], async asyncData({ $content }) { const landingPage = await $content("landing-page").fetch() return { landingPage } From 0750ac1b41e917cb673b60b473fb04a1409e1b79 Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 13:25:23 -0500 Subject: [PATCH 3/8] handle conditional routing --- middleware/middleware.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/middleware/middleware.js b/middleware/middleware.js index 817e1278e4..ca9eac82ee 100644 --- a/middleware/middleware.js +++ b/middleware/middleware.js @@ -1,4 +1,28 @@ +/* eslint-disable sonarjs/cognitive-complexity */ // nuxt i18n is not handling our rootRedirect with a prefix - so we force a redirect here export default function (ctx) { - if (ctx.route.fullPath === "/es" || ctx.route.fullPath === "/es/") ctx.redirect(301, "/es/death-of-a-loved-one") + // https://benefits-tool.usa.gov https://usa.gov/benefit-finder + if (ctx.route.fullPath === "/" || ctx.route.fullPath === "") ctx.redirect(301, "https://www.usa.gov/benefit-finder") + + // https://benefits-tool.usa.gov/es https://usa.gov/es/buscador-beneficios + if (ctx.route.fullPath === "/es" || ctx.route.fullPath === "/es/") ctx.redirect(301, "https://www.usa.gov/es/buscador-beneficios") + + // https://benefits-tool.usa.gov/death-of-a-loved-one https://usa.gov/benefit-finder/death + if (ctx.route.fullPath === "/death-of-a-loved-one" || ctx.route.fullPath === "/death-of-a-loved-one/") ctx.redirect(301, "https://www.usa.gov/benefit-finder/death") + + // https://benefits-tool.usa.gov/es/death-of-a-loved-one https://usa.gov/es/buscador-beneficios/muerte + if (ctx.route.fullPath === "/es/death-of-a-loved-one" || ctx.route.fullPath === "/es/death-of-a-loved-one/") ctx.redirect(301, "https://www.usa.gov/es/buscador-beneficios/muerte") + + // https://benefits-tool.usa.gov/disability https://usa.gov/benefit-finder/disability + if (ctx.route.fullPath === "/disability" || ctx.route.fullPath === "/disability/") ctx.redirect(301, "https://usa.gov/benefit-finder/disability") + + // https://benefits-tool.usa.gov/es/disability https://usa.gov/es/buscador-beneficios/discapacidad + if (ctx.route.fullPath === "/es/disability" || ctx.route.fullPath === "/es/disability/") ctx.redirect(301, "https://usa.gov/es/buscador-beneficios/discapacidad") + + // https://benefits-tool.usa.gov/retirement https://usa.gov/benefit-finder/retirement + if (ctx.route.fullPath === "/retirement" || ctx.route.fullPath === "/retirement/") ctx.redirect(301, "https://usa.gov/benefit-finder/retirement") + + // https://benefits-tool.usa.gov/es/retirement https://usa.gov/es/buscador-beneficios/jubilacion + if (ctx.route.fullPath === "/es/retirement" || ctx.route.fullPath === "/es/retirement/") ctx.redirect(301, "https://usa.gov/es/buscador-beneficios/jubilacion") + } From d65cc7019f8fbd2f56176fa572559339dae3f6cc Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 18:27:28 +0000 Subject: [PATCH 4/8] [MegaLinter] Apply linters fixes --- middleware/middleware.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/middleware/middleware.js b/middleware/middleware.js index ca9eac82ee..f00ea57678 100644 --- a/middleware/middleware.js +++ b/middleware/middleware.js @@ -5,24 +5,30 @@ export default function (ctx) { if (ctx.route.fullPath === "/" || ctx.route.fullPath === "") ctx.redirect(301, "https://www.usa.gov/benefit-finder") // https://benefits-tool.usa.gov/es https://usa.gov/es/buscador-beneficios - if (ctx.route.fullPath === "/es" || ctx.route.fullPath === "/es/") ctx.redirect(301, "https://www.usa.gov/es/buscador-beneficios") + if (ctx.route.fullPath === "/es" || ctx.route.fullPath === "/es/") + ctx.redirect(301, "https://www.usa.gov/es/buscador-beneficios") // https://benefits-tool.usa.gov/death-of-a-loved-one https://usa.gov/benefit-finder/death - if (ctx.route.fullPath === "/death-of-a-loved-one" || ctx.route.fullPath === "/death-of-a-loved-one/") ctx.redirect(301, "https://www.usa.gov/benefit-finder/death") + if (ctx.route.fullPath === "/death-of-a-loved-one" || ctx.route.fullPath === "/death-of-a-loved-one/") + ctx.redirect(301, "https://www.usa.gov/benefit-finder/death") // https://benefits-tool.usa.gov/es/death-of-a-loved-one https://usa.gov/es/buscador-beneficios/muerte - if (ctx.route.fullPath === "/es/death-of-a-loved-one" || ctx.route.fullPath === "/es/death-of-a-loved-one/") ctx.redirect(301, "https://www.usa.gov/es/buscador-beneficios/muerte") + if (ctx.route.fullPath === "/es/death-of-a-loved-one" || ctx.route.fullPath === "/es/death-of-a-loved-one/") + ctx.redirect(301, "https://www.usa.gov/es/buscador-beneficios/muerte") // https://benefits-tool.usa.gov/disability https://usa.gov/benefit-finder/disability - if (ctx.route.fullPath === "/disability" || ctx.route.fullPath === "/disability/") ctx.redirect(301, "https://usa.gov/benefit-finder/disability") + if (ctx.route.fullPath === "/disability" || ctx.route.fullPath === "/disability/") + ctx.redirect(301, "https://usa.gov/benefit-finder/disability") // https://benefits-tool.usa.gov/es/disability https://usa.gov/es/buscador-beneficios/discapacidad - if (ctx.route.fullPath === "/es/disability" || ctx.route.fullPath === "/es/disability/") ctx.redirect(301, "https://usa.gov/es/buscador-beneficios/discapacidad") + if (ctx.route.fullPath === "/es/disability" || ctx.route.fullPath === "/es/disability/") + ctx.redirect(301, "https://usa.gov/es/buscador-beneficios/discapacidad") // https://benefits-tool.usa.gov/retirement https://usa.gov/benefit-finder/retirement - if (ctx.route.fullPath === "/retirement" || ctx.route.fullPath === "/retirement/") ctx.redirect(301, "https://usa.gov/benefit-finder/retirement") + if (ctx.route.fullPath === "/retirement" || ctx.route.fullPath === "/retirement/") + ctx.redirect(301, "https://usa.gov/benefit-finder/retirement") // https://benefits-tool.usa.gov/es/retirement https://usa.gov/es/buscador-beneficios/jubilacion - if (ctx.route.fullPath === "/es/retirement" || ctx.route.fullPath === "/es/retirement/") ctx.redirect(301, "https://usa.gov/es/buscador-beneficios/jubilacion") - + if (ctx.route.fullPath === "/es/retirement" || ctx.route.fullPath === "/es/retirement/") + ctx.redirect(301, "https://usa.gov/es/buscador-beneficios/jubilacion") } From f2c8574850b3e1a777b98e689b0b5e46567e5f8b Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 13:28:58 -0500 Subject: [PATCH 5/8] update node version --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index b6a7d89c68..209e3ef4b6 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16 +20 From badfe6d5068fe71605ddd908578992541644d983 Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 13:53:19 -0500 Subject: [PATCH 6/8] downgrade node to 18 --- .nvmrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nvmrc b/.nvmrc index 209e3ef4b6..3c032078a4 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20 +18 From a5ad36f3539bd81e9a1340add25bbcf1767186df Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 13:56:36 -0500 Subject: [PATCH 7/8] try passing legacy provider to node options --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index cf27aeb70f..8e19953105 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ "license": "See license in CONTRIBUTING.md", "repository": "https://github.com/GSA/usagov-benefits-eligibility", "scripts": { - "dev": "gulp && nuxt", - "build": "gulp && nuxt build", - "start": "gulp && nuxt start", + "dev": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt", + "build": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt build", + "start": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt start", "generate": "gulp && nuxt generate", "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .", "sonarqube": "npm test && ./sonar_scanner_cli.bash", From 89bca8d3b406ab924a9c17202ad154b8a06e5a98 Mon Sep 17 00:00:00 2001 From: scottqueen-bixal Date: Wed, 17 Jan 2024 14:06:14 -0500 Subject: [PATCH 8/8] include with generate --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8e19953105..12f02bfc02 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dev": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt", "build": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt build", "start": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt start", - "generate": "gulp && nuxt generate", + "generate": "export NODE_OPTIONS=--openssl-legacy-provider gulp && nuxt generate", "lint:js": "eslint --ext \".js,.vue\" --ignore-path .gitignore .", "sonarqube": "npm test && ./sonar_scanner_cli.bash", "lint": "npm run lint:js",