Files
supabase/apps/studio/pages/api/connect/index.ts
Joshen Lim 7f5865872a Enforce noUnusedLocals and noUnusedParameters in tsconfig.json + fix all related issues (#45264)
## Context

Enforce `noUnusedLocals` and `noUnusedParameters` in tsconfig.json + fix
all related issues
2026-04-27 17:42:34 +08:00

39 lines
1.1 KiB
TypeScript

import fs from 'fs'
import path from 'path'
import { NextApiRequest, NextApiResponse } from 'next'
function getFilePaths(folderPath: string, baseFolder = ''): string[] {
const filepaths: string[] = []
const files = fs.readdirSync(folderPath)
for (const file of files) {
if (file === '.DS_Store') {
continue
}
const filePath = path.join(folderPath, file)
const stats = fs.statSync(filePath)
if (stats.isDirectory()) {
const subFolder = path.join(baseFolder, file)
const subFolderPaths = getFilePaths(filePath, subFolder)
filepaths.push(...subFolderPaths)
} else {
const filePathRelativeToBase = path.join(baseFolder, file)
if (file !== '.DS_Store') {
filepaths.push(filePathRelativeToBase)
}
filepaths.push(filePathRelativeToBase)
}
}
return filepaths
}
export default async function getFileNames(_req: NextApiRequest, res: NextApiResponse) {
const folderPath = path.join(process.cwd(), 'components/interfaces/Home/Connect/content')
const filepaths = getFilePaths(folderPath)
res.statusCode = 200
res.json(filepaths)
}