@@ -54,7 +63,7 @@ export default function ProjectPage({ project }) {
-
Readme
+
Readme
{project.readmeContent}
@@ -65,17 +74,14 @@ export default function ProjectPage({ project }) {
// Generates `/posts/1` and `/posts/2`
export async function getStaticPaths() {
- const jsonDirectory = path.join(
- process.cwd(),
- 'datasets.json'
- );
- const repos = await fs.readFile(jsonDirectory, 'utf8');
+ const jsonDirectory = path.join(process.cwd(), "datasets.json");
+ const repos = await fs.readFile(jsonDirectory, "utf8");
return {
paths: JSON.parse(repos).map((repo) => {
const projectPath =
- repo.readme.split('/').length > 1
- ? repo.readme.split('/').slice(0, -1)
+ repo.readme && repo.readme.split("/").length > 1
+ ? repo.readme.split("/").slice(0, -1)
: null;
let path = [repo.repo];
if (projectPath) {
@@ -92,16 +98,13 @@ export async function getStaticPaths() {
}
export async function getStaticProps({ params }) {
- const jsonDirectory = path.join(
- process.cwd(),
- 'datasets.json'
- );
- const reposFile = await fs.readFile(jsonDirectory, 'utf8');
+ const jsonDirectory = path.join(process.cwd(), "datasets.json");
+ const reposFile = await fs.readFile(jsonDirectory, "utf8");
const repos: GithubProject[] = JSON.parse(reposFile);
const repo = repos.find((_repo) => {
const projectPath =
- _repo.readme.split('/').length > 1
- ? _repo.readme.split('/').slice(0, -1)
+ _repo.readme && _repo.readme.split("/").length > 1
+ ? _repo.readme.split("/").slice(0, -1)
: null;
let path = [_repo.repo];
if (projectPath) {
diff --git a/examples/github-backed-catalog/pages/_app.tsx b/examples/github-backed-catalog/pages/_app.tsx
index b14578b1..18ebdea4 100644
--- a/examples/github-backed-catalog/pages/_app.tsx
+++ b/examples/github-backed-catalog/pages/_app.tsx
@@ -1,6 +1,6 @@
-import { AppProps } from 'next/app';
-import Head from 'next/head';
-import './styles.css';
+import { AppProps } from "next/app";
+import Head from "next/head";
+import "./styles.css";
function CustomApp({ Component, pageProps }: AppProps) {
return (
diff --git a/examples/github-backed-catalog/pages/index.tsx b/examples/github-backed-catalog/pages/index.tsx
index 796edefe..c55521ba 100644
--- a/examples/github-backed-catalog/pages/index.tsx
+++ b/examples/github-backed-catalog/pages/index.tsx
@@ -1,21 +1,19 @@
-import { promises as fs } from 'fs';
-import path from 'path';
-import { getProject } from '../lib/octokit';
-import getConfig from 'next/config';
-import ExternalLinkIcon from '../components/icons/ExternalLinkIcon';
-import TimeAgo from 'react-timeago';
-import Link from 'next/link';
+import { promises as fs } from "fs";
+import path from "path";
+import { getProject } from "../lib/octokit";
+import getConfig from "next/config";
+import ExternalLinkIcon from "../components/icons/ExternalLinkIcon";
+import TimeAgo from "react-timeago";
+import Link from "next/link";
+import { NextSeo } from "next-seo";
export async function getStaticProps() {
- const jsonDirectory = path.join(
- process.cwd(),
- '/datasets.json'
- );
- const repos = await fs.readFile(jsonDirectory, 'utf8');
+ 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) => {
+ JSON.parse(repos).map(async (repo) => {
const project = await getProject(repo, github_pat);
return { ...project, repo_config: repo };
})
@@ -29,88 +27,112 @@ export async function getStaticProps() {
export function Datasets({ projects }) {
return (
-
-
-
-
- GitHub Datasets
-
-
- Data catalog with datasets hosted on GitHub by 🌀 PortalJS
-
-
-
-
-
-
-
-
- |
- Name
- |
-
- Repository
- |
-
- Description
- |
-
- Last updated
- |
- |
-
-
-
- {projects.map((project) => (
-
- |
- {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}
- |
-
-
- |
-
-
- info
-
- |
+ <>
+
+
+
+
+
+ GitHub Datasets
+
+
+ Data catalog with datasets hosted on GitHub by{" "}
+
+ 🌀 PortalJS
+
+
+
+
+
+
+
+
+
+ |
+ Name
+ |
+
+ Repository
+ |
+
+ Description
+ |
+
+ Last updated
+ |
+ |
- ))}
-
-
+
+
+ {projects.map((project) => (
+
+ |
+ {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}
+ |
+
+
+ |
+
+
+ info
+
+ |
+
+ ))}
+
+
+
-
+ >
);
}
diff --git a/examples/github-backed-catalog/postcss.config.js b/examples/github-backed-catalog/postcss.config.js
index 33ad091d..12a703d9 100644
--- a/examples/github-backed-catalog/postcss.config.js
+++ b/examples/github-backed-catalog/postcss.config.js
@@ -3,4 +3,4 @@ module.exports = {
tailwindcss: {},
autoprefixer: {},
},
-}
+};
diff --git a/examples/github-backed-catalog/tailwind.config.js b/examples/github-backed-catalog/tailwind.config.js
index bea4782c..12b40a02 100644
--- a/examples/github-backed-catalog/tailwind.config.js
+++ b/examples/github-backed-catalog/tailwind.config.js
@@ -8,8 +8,5 @@ module.exports = {
theme: {
extend: {},
},
- plugins: [
- require('@tailwindcss/typography')
- ],
-}
-
+ plugins: [require("@tailwindcss/typography")],
+};