Update next i18next (#472)

This commit is contained in:
Luke Vella 2023-02-02 09:26:04 +00:00 committed by GitHub
parent 4edaa3a700
commit 6ac64bbc42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 38 deletions

View file

@ -5,11 +5,17 @@ import common from "~/public/locales/en/common.json";
import errors from "~/public/locales/en/errors.json";
import homepage from "~/public/locales/en/homepage.json";
declare module "next-i18next" {
interface Resources {
homepage: typeof homepage;
app: typeof app;
common: typeof common;
errors: typeof errors;
interface I18nNamespaces {
homepage: typeof homepage;
app: typeof app;
common: typeof common;
errors: typeof errors;
}
declare module "i18next" {
interface CustomTypeOptions {
defaultNS: "common";
resources: I18nNamespaces;
returnNull: false;
}
}

View file

@ -28,4 +28,5 @@ module.exports = {
},
reloadOnPrerender: process.env.NODE_ENV === "development",
localePath: path.resolve("./public/locales"),
returnNull: false,
};

View file

@ -48,7 +48,7 @@
"lodash": "^4.17.21",
"nanoid": "^4.0.0",
"next": "13.0.6",
"next-i18next": "^12.1.0",
"next-i18next": "^13.0.3",
"next-seo": "^5.15.0",
"nodemailer": "^6.7.2",
"postcss": "^8.4.21",

View file

@ -65,6 +65,7 @@ const VerifyCode: React.VoidFunctionComponent<{
b: <strong className="whitespace-nowrap" />,
a: (
<a
className="text-link"
href="#"
onClick={(e) => {
e.preventDefault();

View file

@ -124,6 +124,7 @@ export function withSessionSsr(
const res = await composedHandler(ctx);
if ("props" in res) {
return {
...res,
props: {
...res.props,
trpcState: ssg.dehydrate(),

View file

@ -1,4 +1,4 @@
import { expect, test } from "@playwright/test";
import { expect, Page, test } from "@playwright/test";
import { load } from "cheerio";
import smtpTester from "smtp-tester";
@ -92,7 +92,7 @@ test.describe.serial(() => {
).toBeVisible();
});
test("user login", async ({ page }) => {
const login = async (page: Page) => {
await page.goto("/login");
await page.getByPlaceholder("jessie.smith@email.com").type(testUserEmail);
@ -104,7 +104,15 @@ test.describe.serial(() => {
await page.getByPlaceholder("Enter your 6-digit code").type(code);
await page.getByText("Continue").click();
};
test("user login", async ({ page }) => {
await login(page);
await expect(page.getByText("Your details")).toBeVisible();
});
test("logged in user can't access login page", async ({ page }) => {
await login(page);
await expect(page).toHaveURL("/profile");
});
});

View file

@ -997,7 +997,7 @@
dependencies:
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.10.2", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.2":
"@babel/runtime@^7.10.2", "@babel/runtime@^7.16.3":
version "7.17.8"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.8.tgz#3e56e4aff81befa55ac3ac6a0967349fd1c5bca2"
integrity sha512-dQpEpK0O9o6lj6oPu0gRDbbnk+4LeHlNcBpspf6Olzt3GIX4P1lWF1gS+pHLDFlaJvbR6q7jCfQ08zA4QJBnmA==
@ -1011,7 +1011,7 @@
dependencies:
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.13.8", "@babel/runtime@^7.18.6", "@babel/runtime@^7.18.9":
"@babel/runtime@^7.13.8", "@babel/runtime@^7.18.6":
version "7.20.1"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.1.tgz#1148bb33ab252b165a06698fde7576092a78b4a9"
integrity sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==
@ -3963,17 +3963,10 @@ i18n-unused@^0.12.0:
esm "^3.2.25"
ts-import "^2.0.39"
i18next-fs-backend@^1.1.5:
version "1.2.0"
resolved "https://registry.yarnpkg.com/i18next-fs-backend/-/i18next-fs-backend-1.2.0.tgz#c498c68c8e6a8ae5ed59bea5e5392a11991de696"
integrity sha512-pUx3AcgXCbur0jpFA7U67Z2RJflAcIi698Y8VL+phdOqUchahxriV3Cs+M6UkPNQSS/zPEzWLfdJ8EgjB7HVxg==
i18next@^21.9.1:
version "21.10.0"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.10.0.tgz#85429af55fdca4858345d0e16b584ec29520197d"
integrity sha512-YeuIBmFsGjUfO3qBmMOc0rQaun4mIpGKET5WDwvu8lU7gvwpcariZLNtL0Fzj+zazcHUrlXHiptcFhBMFaxzfg==
dependencies:
"@babel/runtime" "^7.17.2"
i18next-fs-backend@^2.1.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/i18next-fs-backend/-/i18next-fs-backend-2.1.1.tgz#07c6393be856c5a398e3dfc1257bf8439841cd89"
integrity sha512-FTnj+UmNgT3YRml5ruRv0jMZDG7odOL/OP5PF5mOqvXud2vHrPOOs68Zdk6iqzL47cnnM0ZVkK2BAvpFeDJToA==
i18next@^22.4.9:
version "22.4.9"
@ -4691,18 +4684,16 @@ natural-compare@^1.4.0:
resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz"
integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=
next-i18next@^12.1.0:
version "12.1.0"
resolved "https://registry.yarnpkg.com/next-i18next/-/next-i18next-12.1.0.tgz#70926fbe966bc4750d2f68573307bfe36eadba46"
integrity sha512-rhos/PVULmZPdC0jpec2MDBQMXdGZ3+Mbh/tZfrDtjgnVN3ucdq7k8BlwsJNww6FnqC8AC31n6dSYuqVzYsGsw==
next-i18next@^13.0.3:
version "13.0.3"
resolved "https://registry.yarnpkg.com/next-i18next/-/next-i18next-13.0.3.tgz#f0d5194c9ec3657d114c0c491ba7fbb031788fe1"
integrity sha512-7AA8J6WbkxRBtSf1+97LSAE7btxWZHsBIJEJ3FuTSBgYtpRiO5NGjcb8XbNAlz6yGU0TtS+yZE+/Wu83KhIT1Q==
dependencies:
"@babel/runtime" "^7.18.9"
"@babel/runtime" "^7.20.6"
"@types/hoist-non-react-statics" "^3.3.1"
core-js "^3"
hoist-non-react-statics "^3.3.2"
i18next "^21.9.1"
i18next-fs-backend "^1.1.5"
react-i18next "^11.18.4"
i18next-fs-backend "^2.1.0"
next-seo@^5.15.0:
version "5.15.0"
@ -5278,14 +5269,6 @@ react-hot-toast@^2.4.0:
dependencies:
goober "^2.1.10"
react-i18next@^11.18.4:
version "11.18.6"
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-11.18.6.tgz#e159c2960c718c1314f1e8fcaa282d1c8b167887"
integrity sha512-yHb2F9BiT0lqoQDt8loZ5gWP331GwctHz9tYQ8A2EIEUu+CcEdjBLQWli1USG3RdWQt3W+jqQLg/d4rrQR96LA==
dependencies:
"@babel/runtime" "^7.14.5"
html-parse-stringify "^3.0.1"
react-i18next@^12.0.0:
version "12.0.0"
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-12.0.0.tgz#634015a2c035779c5736ae4c2e5c34c1659753b1"