import fs from "fs/promises";
import { glob } from 'astro/loaders';
import { defineCollection, z } from 'astro:content';
import { REPOS } from './consts';
import { checkFileExists } from "./utils/files";
export const collections = {
repos: defineCollection({
load: async ({ renderMarkdown, store }) => {
const repoPath = `/Users/pyrossh/Code/pyrossh/${r.title}`;
const readmePath = repoPath + "/README.md";
const readmeContent = await checkFileExists(readmePath) ? await renderMarkdown(await fs.readFile(readmePath, 'utf-8')) : {
description: r.description,
description: z.string().max(80),
tags: z.array(z.string()),
absolutePath: z.string(),
content: defineCollection({
loader: glob({ base: './src/content', pattern: '**/*.{md,mdx}' }),
// Type-check frontmatter using a schema
// Transform string to Date object
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
heroImage: z.string().optional(),