Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC] standalone #1296

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions .changeset/gentle-humans-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"nextjs-website": major
---

Refactor pages that use gitbook to fetch data using S3
5 changes: 5 additions & 0 deletions .changeset/perfect-kiwis-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"infrastructure": patch
---

Fixed codebuild cicd lambda permissions
2,154 changes: 2,154 additions & 0 deletions apps/infrastructure/src/app.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/infrastructure/src/modules/cicd/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ resource "aws_iam_policy" "deploy_website" {
Action = [
"lambda:*",
]
Resource = ["arn:aws:lambda:${var.aws_region}:${data.aws_caller_identity.current.account_id}:function/*chatbot*"]
Resource = ["arn:aws:lambda:${var.aws_region}:${data.aws_caller_identity.current.account_id}:function:*chatbot*"]
}
]
})
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs-website/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
NextJS reference: https://nextjs.org/docs/advanced-features/compiler#module-transpilation
*/
const nextConfig = {
reactStrictMode: true,
output: 'export',
reactStrictMode: false,
output: 'standalone',
trailingSlash: false,
images: {
unoptimized: true,
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs-website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"update-docs": "./scripts/fetch-local-docs.sh",
"compile": "tsc --noEmit",
"dev": "next dev",
"build": "next build",
"start": "npx serve@latest out",
"build": "next build --debug",
"start": "next start",
"lint": "next lint",
"test": "jest -i"
},
Expand Down
3 changes: 3 additions & 0 deletions apps/nextjs-website/src/BrowserConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as t from 'io-ts';
import { pipe } from 'fp-ts/lib/function';
import * as E from 'fp-ts/lib/Either';
import * as PR from 'io-ts/lib/PathReporter';
import { secrets } from './config';

const BrowserConfigCodec = t.type({
NEXT_PUBLIC_COGNITO_REGION: t.string,
Expand All @@ -19,8 +20,10 @@ export type BrowserConfig = t.TypeOf<typeof BrowserConfigCodec>;
export const publicEnv = {
NEXT_PUBLIC_COGNITO_REGION: process.env.NEXT_PUBLIC_COGNITO_REGION,
NEXT_PUBLIC_COGNITO_USER_POOL_ID:
secrets.NEXT_PUBLIC_COGNITO_USER_POOL_ID ||
process.env.NEXT_PUBLIC_COGNITO_USER_POOL_ID,
NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID:
secrets.NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID ||
process.env.NEXT_PUBLIC_COGNITO_IDENTITY_POOL_ID,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,6 @@ type ReleaseNotePageStaticParams = {
releaseNoteSubPathSlugs: string[];
};

export async function generateStaticParams() {
return (await getReleaseNotesProps()).map((releaseNoteProps) => {
return {
productSlug: releaseNoteProps.product.slug,
releaseNoteSubPathSlugs: [
'release-note',
...getGitBookSubPaths(releaseNoteProps.page.path),
],
};
});
}

export async function generateMetadata({
params,
}: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import ProductLayout, {
ProductLayoutProps,
} from '@/components/organisms/ProductLayout/ProductLayout';
import { getGuide, getGitBookSubPaths } from '@/lib/api';
import { getGuide } from '@/lib/api';
import { Product } from '@/lib/types/product';
import React from 'react';
import { ParseContentConfig } from 'gitbook-docs/parseContent';
Expand All @@ -12,7 +12,7 @@ import {
} from '@/helpers/metadata.helpers';
import GitBookTemplate from '@/components/templates/GitBookTemplate/GitBookTemplate';
import { productPageToBreadcrumbs } from '@/helpers/breadcrumbs.helpers';
import { getGuidesProps, getUrlReplaceMapProps } from '@/lib/cmsApi';
import { getUrlReplaceMapProps } from '@/lib/cmsApi';
import { generateStructuredDataScripts } from '@/helpers/generateStructuredDataScripts.helpers';
import {
breadcrumbItemByProduct,
Expand All @@ -25,13 +25,6 @@ type Params = {
productGuidePage: Array<string>;
};

export async function generateStaticParams() {
return (await getGuidesProps()).map((guidePage) => ({
productSlug: guidePage.product.slug,
productGuidePage: getGitBookSubPaths(guidePage.page.path),
}));
}

export type ProductGuidePageProps = {
product: Product;
guide: { name: string; path: string };
Expand Down
2 changes: 1 addition & 1 deletion apps/nextjs-website/src/app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default function robots(): MetadataRoute.Robots {
userAgent: '*',
allow: '/',
},
sitemap: `${baseUrl}/sitemap.xml`,
// sitemap: `${baseUrl}/sitemap.xml`,
};
} else {
return {
Expand Down
165 changes: 0 additions & 165 deletions apps/nextjs-website/src/app/sitemap.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { Metadata } from 'next';
import { makeMetadata } from '@/helpers/metadata.helpers';
import { getSolutionDetail, getSolutionSubPaths } from '@/lib/api';
import { getSolutionDetail } from '@/lib/api';
import GitBookTemplate from '@/components/templates/GitBookTemplate/GitBookTemplate';
import { pageToBreadcrumbs } from '@/helpers/breadcrumbs.helpers';
import { ParseContentConfig } from 'gitbook-docs/parseContent';
import { getSolutionsProps, getUrlReplaceMapProps } from '@/lib/cmsApi';
import { getUrlReplaceMapProps } from '@/lib/cmsApi';
import { SolutionTemplateProps } from '@/components/templates/SolutionTemplate/SolutionTemplate';
import { generateStructuredDataScripts } from '@/helpers/generateStructuredDataScripts.helpers';
import { getItemFromPaths } from '@/helpers/structuredData.helpers';
Expand All @@ -25,11 +25,6 @@ type Params = {
solutionSubPathSlugs: string[];
};

export async function generateStaticParams() {
const solutions = await getSolutionsProps();
return solutions.flatMap(getSolutionSubPaths);
}

export async function generateMetadata({
params,
}: {
Expand All @@ -41,11 +36,9 @@ export async function generateMetadata({
);

return makeMetadata({
title: props?.solution.title,
title: props?.title,
url: props
? `/solutions/${props?.solution.slug}/${params.solutionSubPathSlugs.join(
'/'
)}`
? `/solutions/${props?.slug}/${params.solutionSubPathSlugs.join('/')}`
: '',
});
}
Expand All @@ -61,9 +54,11 @@ const Page = async ({ params }: { params: Params }) => {
return null;
}

const { page, solution, source } = solutionProps;
const solution = solutionProps;
const page = solution.page;
const source = solution.source;
const props: SolutionDetailPageTemplateProps = {
...page,
...solution.page,
solution,
pathPrefix: source.pathPrefix,
bodyConfig: {
Expand Down
12 changes: 6 additions & 6 deletions apps/nextjs-website/src/app/webinars/[webinarSlug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ type Params = {
webinarSlug: string;
};

export async function generateStaticParams() {
const webinars = await getWebinarsProps();
return [...webinars].map(({ slug }) => ({
webinarSlug: slug,
}));
}
// export async function generateStaticParams() {
// const webinars = await getWebinarsProps();
// return [...webinars].map(({ slug }) => ({
// webinarSlug: slug,
// }));
// }

export async function generateMetadata({
params,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ type Params = {
webinarSlug: string;
};

export async function generateStaticParams() {
const webinars = await getWebinarsProps();
return [...webinars].map(({ slug }) => ({
webinarSlug: slug,
}));
}
// export async function generateStaticParams() {
// const webinars = await getWebinarsProps();
// return [...webinars].map(({ slug }) => ({
// webinarSlug: slug,
// }));
// }

const WebinarQuestionsPage = async ({ params }: { params: Params }) => {
const webinar = await getWebinar(params?.webinarSlug);
Expand Down
Loading
Loading