This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import path from 'path'; | |
import matter from 'gray-matter'; | |
import OpenAI from 'openai'; | |
import { remark } from 'remark'; | |
import strip from 'strip-markdown'; | |
async function markdownToPlainText(parsedMarkdown) { | |
const result = await remark().use(strip).process(parsedMarkdown.content); | |
return String(result.value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const util = require("util"); | |
const moment = require("moment"); // require | |
const exec = util.promisify(require("child_process").exec); | |
require("dotenv").config(); | |
// Overall, it isn't clear what the best method of building these webhooks is. | |
// Is Express the answer? Is an entirely different language more efficient than Node? | |
// I'm leaning towards Node primarily because Gatsby builds with Node (we already need the node image) | |
const app = express(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gatsby-node.js | |
const path = require("path"); | |
const fs = require("fs").promises; | |
exports.createPages = async ({ graphql, actions }) => { | |
if (process.env.NODE_ENV === "development") { | |
const { data } = await graphql(` | |
{ | |
pages: allSitePage { | |
nodes { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState} from "react" | |
import { Link } from "gatsby" | |
import { StaticImage } from "gatsby-plugin-image" | |
import Layout from "../components/layout" | |
import Seo from "../components/seo" | |
const IndexPage = () => { | |
const [currentPage, setCurrentPage] = useState("") | |
const getActive = ({ isCurrent, href }) => { |