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
Fallen-Breath committed Nov 5, 2024
1 parent 3c6f88b commit c26049f
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";
@@ -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 {
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";
@@ -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 []
}
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 c26049f

Please sign in to comment.