mirror of
https://github.com/walkxcode/dashboard-icons.git
synced 2025-11-19 18:11:14 +01:00
feat: configure static generation for icon pages with development optimization
- Add `revalidate = false` and `dynamic = "force-static"` exports - Add CI_MODE check in generateStaticParams to limit to 5 icons in local dev - This speeds up local development builds while maintaining full static generation in CI
This commit is contained in:
@@ -4,17 +4,26 @@ import { IconDetails } from "@/components/icon-details"
|
|||||||
import { BASE_URL, WEB_URL } from "@/constants"
|
import { BASE_URL, WEB_URL } from "@/constants"
|
||||||
import { getAllIcons, getAuthorData } from "@/lib/api"
|
import { getAllIcons, getAuthorData } from "@/lib/api"
|
||||||
import { AuthorData } from "@/types"
|
import { AuthorData } from "@/types"
|
||||||
|
|
||||||
export const dynamicParams = false
|
export const dynamicParams = false
|
||||||
|
export const revalidate = false
|
||||||
|
export const dynamic = "force-static"
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
const iconsData = await getAllIcons()
|
const iconsData = await getAllIcons()
|
||||||
|
if (process.env.CI_MODE === "false") {
|
||||||
|
// This is meant to speed up the build process in local development
|
||||||
|
return Object.keys(iconsData)
|
||||||
|
.slice(0, 5)
|
||||||
|
.map((icon) => ({
|
||||||
|
icon,
|
||||||
|
}))
|
||||||
|
}
|
||||||
return Object.keys(iconsData).map((icon) => ({
|
return Object.keys(iconsData).map((icon) => ({
|
||||||
icon,
|
icon,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
export const dynamic = "force-static"
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
params: Promise<{ icon: string }>
|
params: Promise<{ icon: string }>
|
||||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
|
searchParams: Promise<{ [key: string]: string | string[] | undefined }>
|
||||||
|
|||||||
Reference in New Issue
Block a user