1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-12-23 01:29:41 +01:00
portfolio/scripts/content/transformProject.ts
Matthias Kretschmann 7eb0075e6f
Migrate to Biome (#1322)
* migrate to Biome

* package updates

* ci fix

* typing fix
2024-07-26 11:45:20 +01:00

21 lines
574 B
TypeScript

import type { ProjectType } from '@/types/project'
import { getProjectImages } from './images'
import { markdownToHtml } from './markdown'
export async function transformProject(
projectsOriginal: ProjectType[],
slug: string
) {
const project = projectsOriginal.find((item) => item.slug === slug)
if (!project) return
// enhance data with additional fields
const descriptionHtml = await markdownToHtml(project.description)
project.descriptionHtml = descriptionHtml
const images = await getProjectImages(slug)
project.images = images
return project
}