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

Commit 8461ee3

Browse files
committed
resolve some tests
1 parent a692cce commit 8461ee3

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

lib/pages/getStaticProps/pages.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ const pages = [];
66
// Get pages using getStaticProps
77
const { routes } = getPrerenderManifest();
88

9-
// Parse pages
9+
// Parse static pages
1010
Object.entries(routes).forEach(
11-
([route, { dataRoute, initialRevalidateSeconds }]) => {
11+
([route, { dataRoute, initialRevalidateSeconds, srcRoute }]) => {
1212
// Ignore pages with revalidate, these will need to be SSRed
1313
if (initialRevalidateSeconds) return;
1414

1515
pages.push({
1616
route,
1717
dataRoute,
18+
srcRoute
1819
});
1920
}
2021
);

lib/pages/getStaticProps/redirects.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ const pages = require("./pages");
1111

1212
const redirects = [];
1313

14-
pages.forEach(({ route, dataRoute }) => {
15-
const relativePath = getFilePathForRoute(route, "js");
14+
pages.forEach(({ route, dataRoute, srcRoute }) => {
15+
const relativePath = getFilePathForRoute(srcRoute || route, "js");
1616
const filePath = join("pages", relativePath);
1717
const functionName = getNetlifyFunctionName(filePath);
1818

lib/pages/getStaticProps/setup.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const setup = () => {
1313
NETLIFY_PUBLISH_PATH
1414
);
1515

16-
pages.forEach(({ route, dataRoute }) => {
16+
pages.forEach(({ route, dataRoute, srcRoute }) => {
1717
logItem(route);
1818

1919
// Copy pre-rendered HTML page
@@ -25,10 +25,14 @@ const setup = () => {
2525
setupStaticFileForPage(jsonPath, dataRoute);
2626

2727
// Set up the Netlify function (this is ONLY for preview mode)
28-
const relativePath = getFilePathForRoute(route, "js");
29-
const filePath = join("pages", relativePath);
30-
logItem(filePath);
31-
setupNetlifyFunctionForPage(filePath);
28+
if (srcRoute) {
29+
// is this taken care of in the other getStaticProps steps? unclear
30+
} else if (!srcRoute) {
31+
const relativePath = getFilePathForRoute(route, "js");
32+
const filePath = join("pages", relativePath);
33+
logItem(filePath);
34+
setupNetlifyFunctionForPage(filePath);
35+
}
3236
});
3337
};
3438

0 commit comments

Comments
 (0)