mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
23 lines
443 B
JavaScript
23 lines
443 B
JavaScript
import fs from 'fs-extra'
|
|
|
|
|
|
|
|
const directoriesToTry = [
|
|
'./static/',
|
|
|
|
// Vercel Serverless Function
|
|
'./.next/server/chunks/static'
|
|
]
|
|
|
|
export async function getJsonDirectory () {
|
|
|
|
for ( const directory of directoriesToTry ) {
|
|
const directoryExists = await fs.pathExists( directory )
|
|
|
|
if ( directoryExists ) {
|
|
return directory
|
|
}
|
|
}
|
|
|
|
throw new Error( 'Could not find json directory' )
|
|
}
|