Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/accessibility_scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
uses: ./.github/actions/set_yarn_berry
- name: Install dependencies
run: yarn
- name: Install Chrome for Puppeteer
run: npx puppeteer browsers install chrome
- name: Build
run: yarn build
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
uses: ./.github/actions/set_yarn_berry
- name: Install Dependencies
run: yarn
- name: Install Chrome for Puppeteer
run: npx puppeteer browsers install chrome
- name: Run tests
run: yarn prebuild && yarn test:unit
- name: Run Build
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check_for_console_errors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
uses: ./.github/actions/set_yarn_berry
- name: Install Dependencies
run: yarn
- name: Install Chrome for Puppeteer
run: npx puppeteer browsers install chrome
- name: Run Build
run: yarn build:release
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/check_pr_for_broken_links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ jobs:
uses: ./.github/actions/set_yarn_berry
- name: Install Dependencies
run: yarn
- name: Install Chrome for Puppeteer
run: npx puppeteer browsers install chrome
- name: Run Build
run: yarn build
env:
Expand Down
6 changes: 6 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"_userauth.auth_fail",
"_userauth.sign_in",
"_userauth.sign_up",
"agentic",
"awslabs",
"@aws-amplify/auth",
"@aws-amplify/core",
"@aws-amplify/storage",
Expand Down Expand Up @@ -1122,7 +1124,9 @@
"reactnative",
"realtime",
"reCaptcha",
"recordcache",
"RecyclerView",
"retryable",
"redirect_to",
"referrerpolicy",
"refetches",
Expand Down Expand Up @@ -1346,6 +1350,7 @@
"UIViewController",
"unauth",
"Unauth",
"uncategorized",
"uncommenting",
"unencrypted",
"unioned",
Expand Down Expand Up @@ -1522,6 +1527,7 @@
"CHALLENGEANSWER",
"Fargate",
"Dockerizing",
"duckdb",
"WORKDIR",
"endregion",
"entrypoint",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,5 @@
"overrides": {
"tmp": "^0.2.4"
},
"packageManager": "yarn@4.9.0"
"packageManager": "yarn@4.14.1"
}
55 changes: 15 additions & 40 deletions redirects.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,46 +129,6 @@
"target": "/<platform>/frontend/server-side-rendering/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/analytics/<*>",
"target": "/<platform>/frontend/analytics/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/geo/<*>",
"target": "/<platform>/frontend/geo/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/in-app-messaging/<*>",
"target": "/<platform>/frontend/in-app-messaging/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/rest-api/<*>",
"target": "/<platform>/frontend/rest-api/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/predictions/<*>",
"target": "/<platform>/frontend/predictions/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/logging/<*>",
"target": "/<platform>/frontend/logging/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/interactions/<*>",
"target": "/<platform>/frontend/interactions/<*>",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/add-aws-services/pubsub/<*>",
"target": "/<platform>/frontend/pubsub/<*>",
"status": "301"
},
{
"source": "/<platform>/ai/conversation/<*>",
"target": "/<platform>/frontend/ai/conversation/<*>",
Expand Down Expand Up @@ -10453,5 +10413,20 @@
"source": "/vue/start/connect-existing-aws-resources",
"target": "/vue/start/connect-to-aws-resources",
"status": "301"
},
{
"source": "/<platform>/build-a-backend/q-developer/",
"target": "/<platform>/develop-with-ai/q-developer/",
"status": "301"
},
{
"source": "/<platform>/start/mcp-server/",
"target": "/<platform>/develop-with-ai/mcp-server/",
"status": "301"
},
{
"source": "/<platform>/start/mcp-server/<*>",
"target": "/<platform>/develop-with-ai/mcp-server/<*>",
"status": "301"
}
]
64 changes: 30 additions & 34 deletions src/components/Breadcrumbs/__tests__/Breadcrumbs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Breadcrumbs', () => {
it('should render the Breadcrumbs component', async () => {
const component = (
<Breadcrumbs
route={'/react/build-a-backend/auth/set-up-auth/'}
route={'/[platform]/build-a-backend/auth/set-up-auth/'}
platform={'react'}
/>
);
Expand All @@ -18,28 +18,25 @@ describe('Breadcrumbs', () => {
it('should render links for Breadcrumbs including platform', async () => {
const component = (
<Breadcrumbs
route={'/react/build-a-backend/auth/set-up-auth/'}
route={'/[platform]/build-a-backend/auth/set-up-auth/'}
platform={'react'}
/>
);
render(component);
const routeList = component.props.route.split('/').filter(function (el) {
return el != '';
});
const breadcrumbsNode = await screen.findByLabelText('Breadcrumb');
const breadcrumbsList =
breadcrumbsNode.getElementsByClassName('breadcrumb__item');

let route = '';
// Verify each rendered breadcrumb has a valid link
for (let i = 0; i < breadcrumbsList.length; i++) {
const breadcrumbLink = breadcrumbsList[i].getElementsByClassName(
'amplify-breadcrumbs__link'
)[0];
route = route + '/' + routeList[i];

expect(breadcrumbLink).toBeInTheDocument();
expect(breadcrumbLink).toHaveAttribute('href', route);
expect(breadcrumbLink).toHaveAttribute('href');
}
// Should have breadcrumbs for: [platform], build-a-backend, auth, set-up-auth
expect(breadcrumbsList.length).toBeGreaterThanOrEqual(4);
});

it('should replace "prev" with applicable version in Breadcrumbs text', async () => {
Expand Down Expand Up @@ -83,49 +80,48 @@ describe('Breadcrumbs', () => {

it('should render links for Breadcrumbs for gen2', async () => {
const component = (
<Breadcrumbs route={'/gen2/build-a-backend/auth/set-up-auth/'} />
<Breadcrumbs
route={'/[platform]/build-a-backend/auth/set-up-auth/'}
platform={'react'}
/>
);
render(component);
const routeList = component.props.route.split('/').filter(function (el) {
return el != '';
});
const breadcrumbsNode = await screen.findByLabelText('Breadcrumb');
const breadcrumbsList =
breadcrumbsNode.getElementsByClassName('breadcrumb__item');

let route = '';
for (let i = 0; i < breadcrumbsList.length; i++) {
const breadcrumbLink = breadcrumbsList[i].getElementsByClassName(
'amplify-breadcrumbs__link'
)[0];
route = route + '/' + routeList[i];

expect(breadcrumbLink).toBeInTheDocument();
expect(breadcrumbLink).toHaveAttribute('href', route);
expect(breadcrumbLink).toHaveAttribute('href');
}
});

it('should render links for Breadcrumbs with no platform', async () => {
it('should skip segments without directory entries', async () => {
const component = (
<Breadcrumbs route={'/build-a-backend/auth/set-up-auth/'} />
<Breadcrumbs
route={
'/[platform]/build-a-backend/add-aws-services/analytics/existing-resources/'
}
platform={'react'}
/>
);
render(component);
const routeList = component.props.route.split('/').filter(function (el) {
return el != '';
});
const breadcrumbsNode = await screen.findByLabelText('Breadcrumb');
const breadcrumbsList =
breadcrumbsNode.getElementsByClassName('breadcrumb__item');

let route = '';
for (let i = 0; i < breadcrumbsList.length; i++) {
const breadcrumbLink = breadcrumbsList[i].getElementsByClassName(
'amplify-breadcrumbs__link'
)[0];
route = route + '/' + routeList[i];
const breadcrumbsList = breadcrumbsNode.getElementsByClassName(
'amplify-breadcrumbs__link'
);

expect(breadcrumbLink).toBeInTheDocument();
expect(breadcrumbLink).toHaveAttribute('href', route);
}
const labels = Array.from(breadcrumbsList).map((el) => el.textContent);
// "add-aws-services" should be skipped since it has no directory entry
expect(labels).not.toContain('add-aws-services');
expect(labels).not.toContain(
'/[platform]/build-a-backend/add-aws-services'
);
// But other segments should still be present
expect(labels).toContain('React');
expect(labels).toContain('Build a Backend');
});
});
6 changes: 6 additions & 0 deletions src/components/Breadcrumbs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function generateBreadcrumbs(
if (url.includes('[platform]')) {
href['query'] = { platform };
}

let label = directoryEntry ? directoryEntry.title : url;

const override = overrides[url]
Expand All @@ -77,6 +78,11 @@ function generateBreadcrumbs(
label = override;
}

// Skip path segments that have no directory entry and no override.
// These are intermediate URL segments that were flattened out of
// the directory tree (e.g. "add-aws-services").
if (!directoryEntry && !override) return;

breadcrumbs.push({
href,
label
Expand Down
8 changes: 5 additions & 3 deletions src/components/Layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@ export const Layout = ({
)}
{(asPathWithNoHash.includes('/push-notifications/') ||
asPathWithNoHash.includes('/analytics/') ||
asPathWithNoHash.includes('/in-app-messaging/')) && (
<PinpointEOLBanner />
)}
asPathWithNoHash.includes('/in-app-messaging/')) &&
!asPathWithNoHash.includes('/kinesis') &&
!asPathWithNoHash.includes('/firehose') && (
<PinpointEOLBanner />
)}
{asPathWithNoHash.includes('/interactions/') && (
<LexV1EOLBanner />
)}
Expand Down
15 changes: 14 additions & 1 deletion src/data/__tests__/sections.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ describe('getSectionFromPath', () => {
);
});

it('returns ai for /develop-with-ai/ paths', () => {
expect(getSectionFromPath('/react/develop-with-ai/q-developer/')).toBe(
'ai'
);
});

it('returns backend for /build-a-backend/ paths', () => {
expect(getSectionFromPath('/react/build-a-backend/auth/set-up-auth/')).toBe(
'backend'
Expand Down Expand Up @@ -81,16 +87,23 @@ describe('getDefaultPathForSection', () => {
'/swift/reference/'
);
});

it('returns ai path', () => {
expect(getDefaultPathForSection('ai', 'react')).toBe(
'/react/develop-with-ai/'
);
});
});

describe('SECTIONS config', () => {
it('has all 6 sections defined', () => {
it('has all 7 sections defined', () => {
const keys = Object.keys(SECTIONS) as SectionKey[];
expect(keys).toEqual([
'quickstart',
'backend',
'frontend',
'ui',
'ai',
'hosting',
'reference'
]);
Expand Down
7 changes: 6 additions & 1 deletion src/data/sections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ export type SectionKey =
| 'quickstart'
| 'backend'
| 'frontend'
| 'hosting'
| 'ui'
| 'ai'
| 'hosting'
| 'reference';

export interface SectionConfig {
Expand All @@ -18,6 +19,7 @@ export const SECTIONS: Record<SectionKey, SectionConfig> = {
backend: { label: 'Build a Backend', subtitle: 'What runs on AWS' },
frontend: { label: 'Frontend Libraries', subtitle: 'What runs in your app' },
ui: { label: 'UI Libraries', subtitle: 'Pre-built components' },
ai: { label: 'Develop with AI' },
hosting: { label: 'Hosting' },
reference: { label: 'Reference' }
};
Expand All @@ -40,6 +42,8 @@ export function getDefaultPathForSection(
return `/${platform}/deploy-and-host/`;
case 'ui':
return `/${platform}/build-ui/`;
case 'ai':
return `/${platform}/develop-with-ai/`;
case 'reference':
return `/${platform}/reference/`;
default:
Expand Down Expand Up @@ -77,6 +81,7 @@ export function getSectionFromPath(path: string): SectionKey | undefined {
if (/\/start(\/|$)/.test(path) || /\/how-amplify-works(\/|$)/.test(path)) {
return 'quickstart';
}
if (/\/develop-with-ai(\/|$)/.test(path)) return 'ai';
if (/\/deploy-and-host(\/|$)/.test(path)) return 'hosting';
if (/\/reference(\/|$)/.test(path)) return 'reference';
if (/\/build-ui(\/|$)/.test(path)) return 'ui';
Expand Down
7 changes: 7 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,10 @@ export const directory = {
path: 'src/pages/[platform]/build-a-backend/add-aws-services/analytics/set-up-analytics/index.mdx',
section: 'backend'
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/analytics/kinesis/index.mdx',
section: 'backend'
},
{
path: 'src/pages/[platform]/build-a-backend/add-aws-services/analytics/existing-resources/index.mdx',
section: 'backend'
Expand Down Expand Up @@ -800,6 +804,9 @@ export const directory = {
{
path: 'src/pages/[platform]/frontend/analytics/index.mdx',
children: [
{
path: 'src/pages/[platform]/frontend/analytics/kinesis/index.mdx'
},
{
path: 'src/pages/[platform]/frontend/analytics/record-events/index.mdx'
},
Expand Down
Loading