mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
a9cf735f50
Slowly moving files over 💯
14 lines
440 B
TypeScript
14 lines
440 B
TypeScript
export async function generateBuildId (generate: () => string|null, fallback: () => string): Promise<string> {
|
|
let buildId = await generate()
|
|
// If there's no buildId defined we'll fall back
|
|
if (buildId === null) {
|
|
buildId = fallback()
|
|
}
|
|
|
|
if (typeof buildId !== 'string') {
|
|
throw new Error('generateBuildId did not return a string. https://err.sh/zeit/next.js/generatebuildid-not-a-string')
|
|
}
|
|
|
|
return buildId.trim()
|
|
}
|