Skip to content

Commit 0714652

Browse files
authored
Merge pull request aws-amplify#5999 from aws-amplify/new-ssg
Reenable ssg builds
2 parents 8058e56 + 34ab237 commit 0714652

File tree

747 files changed

+11874
-1323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

747 files changed

+11874
-1323
lines changed

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,7 @@
15231523
"userids",
15241524
"xmark",
15251525
"refreshable",
1526+
"querytransfers",
15261527
"generatemodelsforlazyloadandcustomselectionset"
15271528
],
15281529
"flagWords": ["hte", "full-stack", "Full-stack", "Full-Stack", "sudo"],

generatePathMap.cjs.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,6 @@ function generatePathMap(
126126
} else if (route.startsWith('/start')) {
127127
filterKind = 'integration';
128128
}
129-
130-
if (filterKind !== '') {
131-
const aOrAn = 'aeiou'.includes(filterKind[0]) ? 'an' : 'a';
132-
pathMap[route] = {
133-
page: '/ChooseFilterPage',
134-
query: {
135-
address: route,
136-
directoryPath: '/ChooseFilterPage',
137-
filterKind: filterKind,
138-
message: `Choose ${aOrAn} ${filterKind}:`
139-
}
140-
};
141-
}
142129
}
143130

144131
if (items) {
@@ -208,17 +195,6 @@ function generatePathMap(
208195
page: `${route}/q/${routeType}/[${routeType}]`
209196
};
210197
});
211-
const aOrAn = 'aeiou'.includes(routeType[0]) ? 'an' : 'a';
212-
pathMap[route] = {
213-
page: '/ChooseFilterPage',
214-
query: {
215-
address: route,
216-
directoryPath: '/ChooseFilterPage',
217-
filterKind: routeType,
218-
filters: filters,
219-
message: `Choose ${aOrAn} ${routeType}:`
220-
}
221-
};
222198
}
223199
return pathMap;
224200
}

next.config.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export default async (phase, { defaultConfig }) => {
7070
// !! WARN !!
7171
ignoreBuildErrors: true
7272
},
73-
exportPathMap,
7473
trailingSlash: true,
7574
transpilePackages: [
7675
'@algolia/autocomplete-shared',

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@
129129
],
130130
"setupFilesAfterEnv": [
131131
"<rootDir>/jest.setup.js"
132-
]
132+
],
133+
"moduleNameMapper": {
134+
"\\.(css|less|scss)$": "<rootDir>/src/__mocks__/styleMock.js"
135+
},
136+
"transformIgnorePatterns": []
133137
},
134138
"scripts": {
135139
"clean": "rm -rf node_modules yarn.lock",

src/__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

src/components/Accordion/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ const Accordion: React.FC<AccordionProps> = ({
2020
const [expandedHeight, setExpandedHeight] = useState(0);
2121
const docsExpander = useRef<HTMLElement>(null);
2222

23+
let pathName = '';
24+
if (typeof window !== 'undefined') {
25+
pathName = window.location.pathname;
26+
}
27+
2328
useEffect(() => {
2429
const expander = docsExpander.current;
2530

@@ -62,7 +67,7 @@ const Accordion: React.FC<AccordionProps> = ({
6267

6368
const anchor = createElement(
6469
'a',
65-
{ href: window.location.pathname + '#' + headingId },
70+
{ href: pathName + '#' + headingId },
6671
expanderTitle
6772
);
6873

src/pages/ChooseFilterPage.tsx renamed to src/components/ChooseFilterPage/index.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
import Layout from '../components/Layout';
1+
import Layout from '../Layout';
22
import styled from '@emotion/styled';
33
import { Grid } from '@theme-ui/components';
44
import { useEffect, useRef, useState } from 'react';
5-
import MetaContent from '../components/Page/metaContent';
6-
import { Container } from '../components/Container';
7-
import { Card, CardDetail, CardGraphic } from '../components/Card';
5+
import MetaContent from '../Page/metaContent';
6+
import { Container } from '../Container';
7+
import { Card, CardDetail, CardGraphic } from '../Card';
88
import {
99
filterOptionsByName,
1010
filterMetadataByOption
11-
} from '../utils/filter-data';
11+
} from '../../utils/filter-data';
1212
import {
1313
getChapterDirectory,
1414
getProductDirectory,
1515
isProductRoot
16-
} from '../utils/getLocalDirectory';
16+
} from '../../utils/getLocalDirectory';
1717

1818
const H3 = styled.h3`
1919
margin-top: 0.375rem;
@@ -34,7 +34,6 @@ function ChooseFilterPage({
3434
// "url" cannot be a CFP prop for legacy reasons
3535
let url = address;
3636
const [_, setHref] = useState('https://docs.amplify.aws');
37-
const [menuIsOpen, setMenuIsOpen] = useState(false);
3837
const footerRef = useRef(null);
3938

4039
useEffect(() => {
@@ -125,7 +124,4 @@ function ChooseFilterPage({
125124
);
126125
}
127126

128-
ChooseFilterPage.getInitialProps = (initialProps) => {
129-
return initialProps.query;
130-
};
131127
export default ChooseFilterPage;

src/components/FeaturesGrid/__tests__/FeaturesGrid.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import * as React from 'react';
22
import { render, screen } from '@testing-library/react';
33
import FeaturesGrid from '../index';
44

5+
jest.mock('next/router', () => ({
6+
useRouter() {
7+
return {
8+
route: '/',
9+
pathname: '',
10+
query: '',
11+
asPath: ''
12+
};
13+
}
14+
}));
15+
516
describe('FeaturesGrid', () => {
617
const featureSections = [
718
'Authentication',

src/components/FilterChildren/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { useRouter } from 'next/router';
22

3-
export default function FilterChildren({ children }) {
3+
export default function FilterChildren({ children, filterKey = '' }) {
44
const router = useRouter();
55

6-
let filterKey = '';
76
if ('platform' in router.query) {
87
filterKey = router.query.platform as string;
98
} else if ('integration' in router.query) {

src/components/Fragments/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ export default function Fragments({ fragments }) {
77
let frontmatter: MdxFrontmatterType;
88

99
const { state, dispatch } = useLastUpdatedDatesContext();
10+
let filterKey = '';
1011

1112
for (const key in fragments) {
13+
if (!filterKey) filterKey = key;
1214
const fragment = fragments[key]([]);
1315
frontmatter = fragment.props.frontmatter;
1416

@@ -29,5 +31,5 @@ export default function Fragments({ fragments }) {
2931
children.push(<div key={key}>{fragment}</div>);
3032
}
3133

32-
return <FilterChildren>{children}</FilterChildren>;
34+
return <FilterChildren filterKey={filterKey}>{children}</FilterChildren>;
3335
}

0 commit comments

Comments
 (0)