Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.

Commit fb11d14

Browse files
committed
remove superfluous getFilePathForRouteWithI18n helper
1 parent 9609739 commit fb11d14

File tree

4 files changed

+4
-13
lines changed

4 files changed

+4
-13
lines changed

lib/helpers/getFilePathForRoute.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
// Return the file for the given route
2-
const getFilePathForRoute = (route, extension) => {
2+
const getFilePathForRoute = (route, extension, locale) => {
33
// Replace / with /index
44
const path = route.replace(/^\/$/, "/index");
55

6+
if (locale) return `${locale}${path}.${extension}`;
67
return `${path}.${extension}`;
78
};
89

lib/helpers/getFilePathForRouteWithI18n.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/pages/getStaticProps/redirects.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { join } = require("path");
22
const getFilePathForRoute = require("../../helpers/getFilePathForRoute");
3-
const getFilePathForRouteWithI18n = require("../../helpers/getFilePathForRouteWithI18n");
43
const getDataRouteForRoute = require("../../helpers/getDataRouteForRoute");
54
const getNetlifyFunctionName = require("../../helpers/getNetlifyFunctionName");
65
const nextConfig = require("../../helpers/getNextConfig")();

lib/pages/getStaticProps/setup.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { join } = require("path");
22
const { logTitle, logItem } = require("../../helpers/logger");
33
const getFilePathForRoute = require("../../helpers/getFilePathForRoute");
4-
const getFilePathForRouteWithI18n = require("../../helpers/getFilePathForRouteWithI18n");
54
const getDataRouteForRoute = require("../../helpers/getDataRouteForRoute");
65
const nextConfig = require("../../helpers/getNextConfig")();
76
const isRouteWithFallback = require("../../helpers/isRouteWithFallback");
@@ -40,10 +39,10 @@ const setup = ({ functionsPath, publishPath }) => {
4039
// This path will go from / -> /en or /some/path -> /en/some/path
4140
const route_ = route === "/" ? "" : route;
4241

43-
const htmlPath = getFilePathForRouteWithI18n(route_, "html", locale);
42+
const htmlPath = getFilePathForRoute(route_, "html", locale);
4443
setupStaticFileForPage({ inputPath: htmlPath, publishPath });
4544

46-
const jsonPath = getFilePathForRouteWithI18n(route_, "json", locale);
45+
const jsonPath = getFilePathForRoute(route_, "json", locale);
4746
// The provided dataRoutes (from prerender-manifest) for these page types
4847
// actually don't include the locale (unclear why Vercel did this)
4948
// BUT the actual path to the .json files DO include the locale

0 commit comments

Comments
 (0)