import parse from '../lib/markdown'; import Project from '../lib/project'; import { promises as fs } from 'fs'; import path from 'path'; import Link from 'next/link'; export async function getStaticProps() { const jsonDirectory = path.join( process.cwd(), '/examples/simple-example/repos.json' ); const repos = await fs.readFile(jsonDirectory, 'utf8'); const projects = await Promise.all( JSON.parse(repos).map(async (repo) => { const project = await Project.getFromGitHub(repo.owner, repo.repo); console.log(project); // Defaults to README const content = project.readme ? project.readme : ''; let { mdxSource, frontMatter, excerpt } = await parse(content, '.mdx'); if (project.metadata?.resources) { frontMatter.layout = 'datapackage'; } return { mdxSource, frontMatter, excerpt, project: project.serialize(), }; }) ); return { props: { projects, }, }; } export function Datasets({ projects }) { console.log(projects); return (
Here is a list of all my datasets for easy access and sharing, if you have any questions{' '} sending me an email {' '} and i’ll get back to you as soon as we can.