Skip to content

Commit

Permalink
limit the count of the static pages to avoid the build time being too…
Browse files Browse the repository at this point in the history
… long during CI
  • Loading branch information
Fallen-Breath committed Nov 5, 2024
1 parent 3c6d625 commit 10c9166
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/app/[locale]/plugin/[pluginId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createSimplePlugin } from "@/catalogue/conversion";
import { getEverything, getPlugin, getPluginOr404 } from "@/catalogue/data";
import { CommonContentLayout } from "@/components/layout/common-content-layout";
import { staticParamsMaxSize } from "@/utils/build-utils";
import { Divider } from "@mantine/core";
import { getTranslations, unstable_setRequestLocale } from "next-intl/server";
import React from "react";
Expand All @@ -20,7 +21,7 @@ export async function generateMetadata({params: {locale, pluginId}}: {params: {l

export async function generateStaticParams() {
const everything = await getEverything()
return Object.keys(everything.plugins).map(pluginId => ({pluginId}))
return Object.keys(everything.plugins).map(pluginId => ({pluginId})).slice(0, staticParamsMaxSize)
}

interface LayoutProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createSimplePlugin } from "@/catalogue/conversion";
import { getEverything, getPlugin, getPluginOr404 } from "@/catalogue/data";
import { AllOfAPlugin, ReleaseInfo } from "@/catalogue/meta-types";
import { staticParamsMaxSize } from "@/utils/build-utils";
import { getTranslations, unstable_setRequestLocale } from "next-intl/server";
import { notFound } from "next/navigation";
import { ReleaseDisplay } from "./release-display";
Expand Down Expand Up @@ -45,7 +46,7 @@ export async function generateStaticParams({params}: {params: {pluginId: string}
if (plugin.release) {
return plugin.release.releases.map(r => {
return {version: r.meta.version}
})
}).slice(0, staticParamsMaxSize)
} else {
return []
}
Expand Down
3 changes: 3 additions & 0 deletions src/utils/build-utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// limit the count of the static pages to avoid the build time being too long during CI
// we still keep a few generateStaticParams() here to validate that the pages are build-able
export const staticParamsMaxSize = 10

0 comments on commit 10c9166

Please sign in to comment.