update content

This commit is contained in:
ryanchristo 2026-11-16 14:17:29 -08:00
parent f13cb160f3
commit 836f960a28
No known key found for this signature in database
27 changed files with 459 additions and 472 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "artifacts"]
path = artifacts
url = https://codeberg.org/ryanchristo/artifacts

View file

@ -0,0 +1,24 @@
.container {
composes: container from "../../../../styles/page.css";
}
.banner {
composes: banner from "../../../../styles/page.css";
}
.content {
composes: content from "../../../../styles/page.css";
}
.content {
text-align: center;
}
.content h1 {
font-size: 1.6em;
margin: 1em 0;
}
.content p {
margin: 1em 0;
}

View file

@ -0,0 +1,37 @@
import { Metadata } from "next";
import { getArtifact, getArtifacts } from "@utils";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
export const generateStaticParams = () => {
return getArtifacts("essays");
};
const ArtifactPage = async ({ params }: any) => {
const artifact = await getArtifact("essays", params.id);
return (
<div className={styles.container}>
<div>
<div className={styles.banner}>
<div>
<p>{`author: ${artifact.author}`}</p>
<p>{`title: ${artifact.title}`}</p>
<p>{`description: ${artifact.description}`}</p>
<p>{`created: ${artifact.created.toDateString()}`}</p>
<p>{`updated: ${artifact.updated.toDateString()}`}</p>
</div>
</div>
<div className={styles.content}>
<div dangerouslySetInnerHTML={{ __html: artifact.content }} />
</div>
</div>
</div>
);
};
export default ArtifactPage;

View file

@ -0,0 +1,24 @@
.container {
composes: container from "../../../../styles/page.css";
}
.banner {
composes: banner from "../../../../styles/page.css";
}
.content {
composes: content from "../../../../styles/page.css";
}
.content {
text-align: center;
}
.content h1 {
font-size: 1.6em;
margin: 1em 0;
}
.content p {
margin: 1em 0;
}

View file

@ -0,0 +1,37 @@
import { Metadata } from "next";
import { getArtifact, getArtifacts } from "@utils";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
export const generateStaticParams = () => {
return getArtifacts("film");
};
const ArtifactPage = async ({ params }: any) => {
const artifact = await getArtifact("film", params.id);
return (
<div className={styles.container}>
<div>
<div className={styles.banner}>
<div>
<p>{`author: ${artifact.author}`}</p>
<p>{`title: ${artifact.title}`}</p>
<p>{`description: ${artifact.description}`}</p>
<p>{`created: ${artifact.created.toDateString()}`}</p>
<p>{`updated: ${artifact.updated.toDateString()}`}</p>
</div>
</div>
<div className={styles.content}>
<div dangerouslySetInnerHTML={{ __html: artifact.content }} />
</div>
</div>
</div>
);
};
export default ArtifactPage;

View file

@ -1,11 +0,0 @@
.container {
composes: container from "../../../styles/page.css";
}
.content {
composes: content from "../../../styles/page.css";
}
.content {
text-align: center;
}

View file

@ -1,107 +0,0 @@
import { Metadata } from "next";
import Link from "next/link";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
const ArtifactsPage = () => {
return (
<div className={styles.container}>
<div className={styles.content}>
<h2>{"Rosa - These Storms | 2014"}</h2>
<p>
<i>{"Camera Operator"}</i>
</p>
<p>
{
'"Rosa, a young Mayan woman, sits alone. She stares directly into the camera and for the first time has the courage to share her story. She has wrestled with rejection, forgiveness and the fight to keep her child alive. Now 27, she must overcome her past to follow dreams she once thought impossible."'
}
</p>
<p>
<i>{"Photography, Cinematography"}</i>
</p>
<p>
<Link
href="https://optimist.co/films/rosa-these-storms-documentary/"
target="_blank"
>
{"more information"}
</Link>
</p>
<hr />
<h2>{"Alleviating Poverty in Vietnam | 2013"}</h2>
<p>
<i>{"Videographer"}</i>
</p>
<p>
{
'"Alleviating Poverty in Vietnam is a short promotional video that explores a day in the life of Whole Planet Foundation\'s Field Director, Daniel Zoltani, as he visits one of their partners in Vietnam. Daniel visits Tao Yeu Mai (TYM) - the leading microfinance institution in Thai Nguyen Province of Northern Vietnam. Daniel and the TYM staff go out to meet with their clients."'
}
</p>
<p>
<i>
{
"Production, Photography, Videography, Audio Recording, Video Editing"
}
</i>
</p>
<p>
<Link
href="https://www.youtube.com/watch?v=HI_bLthLIXs"
target="_blank"
>
{"watch video"}
</Link>
</p>
<hr />
<h2>{"Living on One Dollar | 2010 - 2012"}</h2>
<p>
<i>{"Co-Producer, Cinematographer, Assistant Editor"}</i>
</p>
<p>
{
'"Living on One Dollar follows the experience of four young friends as they live on less than $1 a day for two months in rural Guatemala. They battle hunger, parasites and the realization that there are no easy answers. Yet, the generosity and strength of Rosa, a 20-year-old woman with her husband Anthony, and Chino, a 12-year-old boy gives them hope that there are ways to make a difference."'
}
</p>
<p>
<i>
{
"Production, Photography, Cinematography, Audio Recording, Video Editing"
}
</i>
</p>
<p>
<Link
href="https://optimist.co/films/living-on-one-dollar-documentary/"
target="_blank"
>
{"more information"}
</Link>
</p>
<hr />
<h2>{"Aspectator | 2010"}</h2>
<p>
<i>{"Co-Producer, Cinematographer"}</i>
</p>
<p>
{
'"The subject of a psychology study begins to lose his identity when he decides to follow a woman whose presence deteriorates his sight while also invigorating his desire to rediscover himself."'
}
</p>
<p>
<i>{"Production, Cinematography, Audio Recording, Video Editing"}</i>
</p>
<p>
<Link href="https://vimeo.com/17481141" target="_blank">
{"watch trailer"}
</Link>
</p>
</div>
</div>
);
};
export default ArtifactsPage;

View file

@ -5,3 +5,21 @@
.content {
composes: content from "../../styles/page.css";
}
.content h2 {
font-size: 1.3em;
margin: 2em 0 1.5em 0;
}
.content ul {
list-style: none inside none;
}
.content li {
margin: 2em 0;
}
.content p {
color: var(--color-text);
font-weight: 300;
}

View file

@ -1,39 +1,75 @@
import { Metadata } from "next";
import Link from "next/link";
import { getArtifacts } from "@utils";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
const ArtifactsPage = () => {
async function getArtifactsByGroup() {
return [
{
group: "essays",
items: getArtifacts("essays").sort((a, b) => b.order - a.order),
},
{
group: "film / video",
items: [...getArtifacts("film"), ...getArtifacts("videos")].sort(
(a, b) => b.order - a.order,
),
},
{
group: "software",
items: getArtifacts("software").sort((a, b) => b.order - a.order),
},
];
}
const ArtifactsPage = async () => {
const artifacts = await getArtifactsByGroup();
return (
<div className={styles.container}>
<div className={styles.content}>
<h1>{"artifacts"}</h1>
{!artifacts.length ? (
<p>
<i>{"What do artifacts do?"}</i>
<i>{"failed to load artifacts"}</i>
</p>
<hr />
<h2>{"essays"}</h2>
) : (
<div>
{artifacts.map(({ group, items }) => (
<div key={group} style={{ margin: "2em 0" }}>
<h2>{group}</h2>
<ul>
{items.map(
({
id,
category,
title,
description,
created,
updated,
}) => (
<li key={id}>
<Link href={`/artifacts/` + category + "/" + id}>
<h3>{title}</h3>
<p>{description}</p>
<p>
<i>{"maybe something soon"}</i>
</p>
<hr />
<h2>{"film / video"}</h2>
<p>
<i>
<Link href="/artifacts/film">{"just this page for now"}</Link>
</i>
</p>
<hr />
<h2>{"software"}</h2>
<p>
<i>
<Link href="/artifacts/software">{"just this page for now"}</Link>
</i>
<i>{`created: ${created.toDateString()}`}</i>
{" | "}
<i>{`updated: ${updated.toDateString()}`}</i>
</p>
</Link>
</li>
),
)}
</ul>
</div>
))}
</div>
)}
</div>
</div>
);

View file

@ -0,0 +1,24 @@
.container {
composes: container from "../../../../styles/page.css";
}
.banner {
composes: banner from "../../../../styles/page.css";
}
.content {
composes: content from "../../../../styles/page.css";
}
.content {
text-align: center;
}
.content h1 {
font-size: 1.6em;
margin: 1em 0;
}
.content p {
margin: 1em 0;
}

View file

@ -0,0 +1,37 @@
import { Metadata } from "next";
import { getArtifact, getArtifacts } from "@utils";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
export const generateStaticParams = () => {
return getArtifacts("software");
};
const ArtifactPage = async ({ params }: any) => {
const artifact = await getArtifact("software", params.id);
return (
<div className={styles.container}>
<div>
<div className={styles.banner}>
<div>
<p>{`author: ${artifact.author}`}</p>
<p>{`title: ${artifact.title}`}</p>
<p>{`description: ${artifact.description}`}</p>
<p>{`created: ${artifact.created.toDateString()}`}</p>
<p>{`updated: ${artifact.updated.toDateString()}`}</p>
</div>
</div>
<div className={styles.content}>
<div dangerouslySetInnerHTML={{ __html: artifact.content }} />
</div>
</div>
</div>
);
};
export default ArtifactPage;

View file

@ -1,11 +0,0 @@
.container {
composes: container from "../../../styles/page.css";
}
.content {
composes: content from "../../../styles/page.css";
}
.content {
text-align: center;
}

View file

@ -1,269 +0,0 @@
import { Metadata } from "next";
import Link from "next/link";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
const ArtifactsPage = () => {
return (
<div className={styles.container}>
<div className={styles.content}>
<h2>{"Chora AI | 2026 - Present"}</h2>
<p>
<i>{"Software Engineer, Protocol Researcher"}</i>
</p>
<p>
{
"Chora AI is focused on local-first and privacy-preserving tools and infrastructure for building and managing agents. Chora AI is a project of Chora Studio that feeds back into research on agentic systems."
}
</p>
<p>
<i>{"Rust, LLMs"}</i>
</p>
<p>
{/*<Link href="https://chora.studio/chora-ai" target="_blank">
{"website"}
</Link>
{" | "}*/}
<Link href="https://github.com/chora-ai" target="_blank">
{"source"}
</Link>
</p>
<hr />
<h2>{"Chora Studio | 2024 - Present"}</h2>
<p>
<i>{"Owner, Software Engineer, Protocol Researcher"}</i>
</p>
<p>
{
"Chora Studio is a software research and development company building software for decentralized protocols and agentic systems. Chora Studio also offers software research and development as a service."
}
</p>
<p>
<i>{"Rust, LLMs, Go, TypeScript, Cosmos"}</i>
</p>
<p>
<Link href="https://chora.studio" target="_blank">
{"website"}
</Link>
{" | "}
<Link href="https://github.com/chora-studio" target="_blank">
{"source"}
</Link>
</p>
<hr />
<h2>{"Regen Network | 2021 - 2023"}</h2>
<p>
<i>
{"Technical Product Manager, Software Engineer, Network Operations"}
</i>
</p>
<p>
{
"Regen Network aligns economics with ecology to drive regenerative land management. I primarily worked on Regen Ledger and Cosmos SDK, the underlying blockchain infrastructure for Regen Network."
}
</p>
<p>
<i>{"Go, TypeScript, Cosmos"}</i>
</p>
<p>
<Link href="https://regen.network" target="_blank">
{"website"}
</Link>
{" | "}
<Link href="https://github.com/regen-network" target="_blank">
{"source"}
</Link>
</p>
<hr />
<h2>{"Chora | 2020 - 2023"}</h2>
<p>
<i>{"Software Engineer, Protocol Researcher"}</i>
</p>
<p>
{
"Chora is software for commons governance and ecological regeneration built with distributed ledger technology. Chora started out as an evolving side project that later became a project of Chora Studio."
}
</p>
<p>
<i>{"Go, TypeScript, Cosmos"}</i>
</p>
<p>
<Link href="https://chora.io" target="_blank">
{"website"}
</Link>
{" | "}
<Link href="https://github.com/chora-io" target="_blank">
{"source"}
</Link>
</p>
<hr />
<h2>{"ChainSafe | 2019 - 2020"}</h2>
<p>
<i>{"Software Engineer, Protocol Researcher"}</i>
</p>
<p>
{
"ChainSafe is a team of developers building tools and infrastructure for a variety of decentralized protocols. I primarily worked on Gossamer, a node client implementation for the Polkadot network written in Go."
}
</p>
<p>
<i>{"Go, Polkadot, Solidity, Ethereum"}</i>
</p>
<p>
<Link href="https://chainsafe.io" target="_blank">
{"website"}
</Link>
{" | "}
<Link href="https://github.com/chainsafe" target="_blank">
{"source"}
</Link>
</p>
<hr />
<h2>{"Colony | 2018 - 2019"}</h2>
<p>
<i>{"Developer Relations Manager, Software Engineer"}</i>
</p>
<p>
{
"Colony is a platform for open organizations built on Ethereum. I helped build and maintain developer tools, wrote documentation, explored integrations, and managed developer relations."
}
</p>
<p>
<i>{"JavaScript, React, Redux, Webpack, IPFS, Solidity, Ethereum"}</i>
</p>
<p>
<Link href="https://colony.io" target="_blank">
{"website"}
</Link>
{" | "}
<Link href="https://github.com/joincolony" target="_blank">
{"source"}
</Link>
</p>
<hr />
<h2>{"Chora | 2018"}</h2>
<p>
<i>{"Software Engineer"}</i>
</p>
<p>
{
"Chora was a project I created to learn about and explore Ethereum. The demo application allowed users to create organizations, projects, and tasks using smart contracts on the Ethereum network."
}
</p>
<p>
<i>{"JavaScript, React, Redux, Webpack, Solidity, Ethereum"}</i>
</p>
<hr />
<h2>{"Horizon App | 2017 - 2018"}</h2>
<p>
<i>{"Full Stack Engineer"}</i>
</p>
<p>
{
"Horizon App uses groups and mutual friends to help members find people and places to stay. I designed and developed the web application, rebuilt the latest version of the API, and integrated email services."
}
</p>
<p>
<i>{"JavaScript, React, Redux, Webpack, Ruby, Rails, PostgreSQL"}</i>
</p>
<hr />
<h2>{"Ushahidi | 2017"}</h2>
<p>
<i>{"Full Stack Engineer"}</i>
</p>
<p>
{
"Ushahidi is a crowdsourcing application with a focus on disaster response that makes it easy to collect and visualize data on a map. I volunteered for three months implementing features and fixing bugs."
}
</p>
<p>
<i>{"JavaScript, AngularJS, PHP"}</i>
</p>
<hr />
<h2>{"Joglo Northwest | 2017"}</h2>
<p>
<i>{"Full Stack Engineer"}</i>
</p>
<p>
{
"Joglo Northwest is a small business that buys and sells Indonesian art, furniture and stone. I rebuilt the website and content management system using my very own simple-cms as the foundation (see below)."
}
</p>
<p>
<i>{"JavaScript, React, Redux, Webpack, Node, Express, MongoDB"}</i>
</p>
<hr />
<h2>{"Simple CMS | 2017"}</h2>
<p>
<i>{"Full Stack Engineer"}</i>
</p>
<p>
{
"After working my way through freeCodeCamp, I developed Simple CMS to test my skills on a larger project - a simple yet customizable content management system for small businesses and freelancers."
}
</p>
<p>
<i>{"JavaScript, React, Redux, Webpack, Node, Express, MongoDB"}</i>
</p>
<hr />
<h2>{"freeCodeCamp | 2016 - 2017"}</h2>
<p>
<i>{"Full Stack Engineer"}</i>
</p>
<p>
{
"To advance my skills, I worked my way through the freeCodeCamp coursework and projects. The freeCodeCamp curriculum focuses on full-stack development with React, Node, Express, and MongoDB."
}
</p>
<p>
<i>{"JavaScript, React, Redux, Webpack, Node, Express, MongoDB"}</i>
</p>
<hr />
<h2>{"Joglo Northwest | 2014"}</h2>
<p>
<i>{"Web Developer"}</i>
</p>
<p>
{
"Joglo Northwest is a small business that buys and sells Indonesian art, furniture, and stone. I designed and developed a simple gallery website with a custom content management system and integrated email services."
}
</p>
<p>
<i>{"HTML, CSS, JavaScript, PHP, SQL"}</i>
</p>
<hr />
<h2>{"Ancient Greek | 2014"}</h2>
<p>
<i>{"Web Developer"}</i>
</p>
<p>
{
"Ancient Greek was a web application for learning Ancient Greek. The app included a dictionary, interactive reading exercises, and flashcards for practicing vocabulary, verb conjugations, and noun declensions."
}
</p>
<p>
<i>{"HTML, CSS, JavaScript, PHP, SQL"}</i>
</p>
<hr />
<h2>{"Documentary Art Network | 2013"}</h2>
<p>
<i>{"Web Developer"}</i>
</p>
<p>
{
"Documentary Art Network was a professional network for documentary artists. Users could post articles and stories, discuss ideas, find people to collaborate with, and rent or exchange equipment."
}
</p>
<p>
<i>{"HTML, CSS, JavaScript, PHP, SQL"}</i>
</p>
</div>
</div>
);
};
export default ArtifactsPage;

View file

@ -0,0 +1,24 @@
.container {
composes: container from "../../../../styles/page.css";
}
.banner {
composes: banner from "../../../../styles/page.css";
}
.content {
composes: content from "../../../../styles/page.css";
}
.content {
text-align: center;
}
.content h1 {
font-size: 1.6em;
margin: 1em 0;
}
.content p {
margin: 1em 0;
}

View file

@ -0,0 +1,37 @@
import { Metadata } from "next";
import { getArtifact, getArtifacts } from "@utils";
import styles from "./page.module.css";
export const metadata: Metadata = {
title: "ryan christoffersen | artifacts",
};
export const generateStaticParams = () => {
return getArtifacts("videos");
};
const ArtifactPage = async ({ params }: any) => {
const artifact = await getArtifact("videos", params.id);
return (
<div className={styles.container}>
<div>
<div className={styles.banner}>
<div>
<p>{`author: ${artifact.author}`}</p>
<p>{`title: ${artifact.title}`}</p>
<p>{`description: ${artifact.description}`}</p>
<p>{`created: ${artifact.created.toDateString()}`}</p>
<p>{`updated: ${artifact.updated.toDateString()}`}</p>
</div>
</div>
<div className={styles.content}>
<div dangerouslySetInnerHTML={{ __html: artifact.content }} />
</div>
</div>
</div>
);
};
export default ArtifactPage;

View file

@ -62,9 +62,9 @@
--transition: 0.25s;
/* light theme */
--background-primary: rgb(245, 245, 245); /* #F5F5F5 */
--box-shadow: 0 0 3px rgb(200, 200, 200); /* #C8C8C8 */
--box-shadow-color: rgb(200, 200, 200); /* #C8C8C8 */
--background-primary: rgb(255, 255, 255); /* #FFFFFF */
--box-shadow: 0 0 3px rgb(230, 230, 230); /* #C8C8C8 */
--box-shadow-color: rgb(230, 230, 230); /* #C8C8C8 */
--color-text: rgb(25, 25, 25); /* #191919 */
}
@ -72,7 +72,7 @@
--background-primary: rgb(25, 25, 25); /* #191919 */
--box-shadow: 0 0 3px rgb(75, 75, 75); /* #4B4B4B */
--box-shadow-color: rgb(75, 75, 75); /* #4B4B4B */
--color-text: rgb(245, 245, 245); /* #F5F5F5 */
--color-text: rgb(255, 255, 255); /* #FFFFFF */
}
* {
@ -99,7 +99,7 @@ h2,
h3,
h4,
h5 {
font-weight: 400;
font-weight: 300;
}
p,
@ -110,7 +110,6 @@ li {
a,
a:active {
color: var(--color-theme);
font-weight: 400;
text-decoration: none;
transition: var(--transition);
}

View file

@ -6,6 +6,33 @@
composes: content from "../styles/page.css";
}
.item {
composes: item from "../styles/page.css";
.content h2 {
font-size: 1.3em;
margin: 2em 0 1.5em 0;
}
.content h3 {
font-size: 1.1em;
margin: 1em 0;
}
.content hr {
margin: 5vh 0;
}
.content p {
margin: 1em 0;
}
.content div {
margin: 2em 0;
}
.content ul {
list-style-position: inside;
margin: 1em 0;
}
.content li {
margin: 0.5em 0;
}

View file

@ -92,7 +92,7 @@ const HomePage = () => {
<h2>{"public accounts"}</h2>
<p>
{
"I take a minimalist approach to social media and other platforms. All public accounts that I'm actively using are listed here:"
"I take a minimalist approach to social media and other platforms. All public accounts that I'm actively (or occasionally) using are listed here:"
}
</p>
<ul>

1
artifacts Submodule

@ -0,0 +1 @@
Subproject commit 65a118e4a27b93f175018506952f754f7b4d1100

BIN
bun.lockb Normal file → Executable file

Binary file not shown.

View file

@ -3,13 +3,13 @@ import * as React from "react";
const ThemeIcon = ({ darkTheme }: any) => (
<svg
xmlns="http://www.w3.org/2000/svg"
style={{ background: darkTheme ? "#191919" : "#F5F5F5" }}
style={{ background: darkTheme ? "#191919" : "#FFFFFF" }}
height="1.5em"
width="1.5em"
viewBox="0 0 100 100"
>
<circle cx="50" cy="50" r="40" fill={darkTheme ? "#F5F5F5" : "#191919"} />
<circle cx="60" cy="50" r="37" fill={darkTheme ? "#191919" : "#F5F5F5"} />
<circle cx="50" cy="50" r="40" fill={darkTheme ? "#FFFFFF" : "#191919"} />
<circle cx="60" cy="50" r="37" fill={darkTheme ? "#191919" : "#FFFFFF"} />
</svg>
);

View file

@ -19,9 +19,12 @@
"clean": "rm -rf .next dist node_modules"
},
"dependencies": {
"gray-matter": "^4",
"next": "^14",
"react": "^18",
"react-dom": "^18"
"react-dom": "^18",
"remark": "^15",
"remark-html": "^16"
},
"devDependencies": {
"@types/node": "^20",
@ -34,6 +37,7 @@
"eslint-config-next": "^14",
"postcss": "^8",
"prettier": "^3",
"sharp": "^0.33",
"typescript": "^5"
}
}

View file

@ -10,6 +10,34 @@
padding-top: var(--header-height);
}
/* banner */
.banner {
align-items: center;
display: flex;
font-size: 1em;
justify-content: center;
min-height: 10vh;
padding: 2em 0;
text-align: center;
}
@media (max-width: 850px) {
.banner {
font-size: 1em;
}
}
.banner p {
padding: 0.2em 0;
}
@media (max-width: 850px) {
.banner p {
padding: 0.15em 0 !important;
}
}
/* content */
.content {
@ -25,39 +53,3 @@
width: auto;
}
}
.content h1 {
font-size: 1.6em;
margin: 1em 0;
}
.content h2 {
font-size: 1.3em;
margin: 1em 0;
}
.content h3 {
font-size: 1em;
margin: 1em 0;
}
.content hr {
margin: 5vh 0;
}
.content p {
margin: 1em 0;
}
.content div {
margin: 2em 0;
}
.content ul {
list-style-position: inside;
margin: 1em 0;
}
.content li {
margin: 0.5em 0;
}

View file

@ -21,7 +21,8 @@
],
"paths": {
"@components/*": ["components/*"],
"@contexts": ["contexts"]
"@contexts": ["contexts"],
"@utils": ["utils"]
}
},
"include": [

27
utils/getArtifact.ts Normal file
View file

@ -0,0 +1,27 @@
import fs from "fs";
import path from "path";
import matter from "gray-matter";
import { remark } from "remark";
import html from "remark-html";
const root = path.join(process.cwd(), "artifacts");
export async function getArtifact(dir: string, id: string) {
const fullPath = path.join(root, dir, `${id}.md`);
// read file contents
const fileContents = fs.readFileSync(fullPath, "utf8");
// parse file contents
const { content, data } = matter(fileContents);
// convert markdown to html
const processedContent = await remark().use(html).process(content);
// return id, content, and data
return {
id,
content: processedContent.toString(),
...data,
} as any;
}

31
utils/getArtifacts.ts Normal file
View file

@ -0,0 +1,31 @@
import fs from "fs";
import path from "path";
import matter from "gray-matter";
const root = path.join(process.cwd(), "artifacts");
export const getArtifacts = (dir: string) => {
const fileNames = fs.readdirSync(root + "/" + dir);
const filtered = fileNames.filter((fileName) => fileName.includes(`.md`));
return filtered.map((fileName) => {
// set id
const id = fileName.replace(/\.md$/, "");
// set full path
const fullPath = path.join(root, dir, fileName);
// read file contents
const fileContents = fs.readFileSync(fullPath, "utf8");
// parse file contents
const { data } = matter(fileContents);
// return id and data
return {
id,
...data,
};
}) as any[];
};

2
utils/index.ts Normal file
View file

@ -0,0 +1,2 @@
export { getArtifact } from "./getArtifact";
export { getArtifacts } from "./getArtifacts";