import { promises as fs } from 'fs';
import path from 'path';
import { getProject } from '../lib/octokit';
import getConfig from 'next/config';
import NavBar from '../components/NavBar';
import Footer from '../components/Footer';
export async function getStaticProps() {
const jsonDirectory = path.join(process.cwd(), '/datasets.json');
const repos = await fs.readFile(jsonDirectory, 'utf8');
const github_pat = getConfig().serverRuntimeConfig.github_pat;
const projects = await Promise.all(
JSON.parse(repos).map(async (repo) => {
const project = await getProject(repo, github_pat);
return { ...project, repo_config: repo };
})
);
return {
props: {
projects,
},
};
}
const formatter = new Intl.DateTimeFormat('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric',
hour: 'numeric',
timeZone: 'UTC',
});
export default function Datasets({ projects }) {
return (
<>
Here is a list of all my datasets for easy access and sharing all stored on multiple github accounts and repos and joined together here
| Name | Repo | Description | Last updated | More info |
|---|---|---|---|---|
| {project.repo_config.name ? project.repo_config.name : project.full_name + (project.base_path === '/' ? '' : '/' + project.base_path)} | {project.full_name} | {project.repo_config.description ? project.repo_config.description : project.description} | {formatter.format(new Date(project.last_updated))} | More info on, {project.repo_config.name ? project.repo_config.name : project.full_name + (project.base_path === '/' ? '' : '/' + project.base_path)} |