@@ -9,7 +9,7 @@ import fg from "fast-glob";
99import { processMarkdown } from "./markdown" ;
1010import yaml from "js-yaml" ;
1111
12- import { PostFrontmatter , Post , PostParams , Person } from "lib/types" ;
12+ import { PostFrontmatter , Post , PostParams , Person , Job } from "lib/types" ;
1313import _ from "lodash" ;
1414
1515const postsDirectory = path . join ( process . cwd ( ) , "posts" ) ;
@@ -27,7 +27,7 @@ export const getRandomCta = () => {
2727export const getPeople = async ( ) : Promise < Record < string , Person > > => {
2828 const peopleFile = readFileSync (
2929 path . join ( dataDirectory , "people.yml" ) ,
30- "utf8" ,
30+ "utf8"
3131 ) ;
3232 return yaml . load ( peopleFile ) ;
3333} ;
@@ -36,10 +36,21 @@ export const getCurrentPeople = async (): Promise<Record<string, Person>> => {
3636 const people = await getPeople ( ) ;
3737
3838 return Object . fromEntries (
39- Object . entries ( people ) . filter ( ( [ _ , p ] ) => p . current ) ,
39+ Object . entries ( people ) . filter ( ( [ _ , p ] ) => p . current )
4040 ) ;
4141} ;
4242
43+ export const getJobs = async ( ) : Promise < Record < string , Job > > => {
44+ const jobFile = readFileSync ( path . join ( dataDirectory , "jobs.yml" ) , "utf8" ) ;
45+ return yaml . load ( jobFile ) ;
46+ } ;
47+
48+ export const getActiveJobs = async ( ) : Promise < Record < string , Job > > => {
49+ const jobs = await getJobs ( ) ;
50+
51+ return Object . fromEntries ( Object . entries ( jobs ) . filter ( ( [ _ , j ] ) => j . active ) ) ;
52+ } ;
53+
4354const getPostPaths = ( ) => {
4455 return fg . sync ( path . join ( postsDirectory , "**" ) , { objectMode : true } ) ;
4556} ;
@@ -124,7 +135,7 @@ async function getAllPosts(): Promise<Post[]> {
124135 person : people [ matterResult . data . author ] ?? null ,
125136 ...matterResult . data ,
126137 } ;
127- } ) ,
138+ } )
128139 ) ;
129140}
130141
@@ -157,7 +168,7 @@ export async function getPostData({
157168 const people = await getPeople ( ) ;
158169 const fullPath = path . join (
159170 postsDirectory ,
160- `${ year } -${ month } -${ day } -${ slug } .md` ,
171+ `${ year } -${ month } -${ day } -${ slug } .md`
161172 ) ;
162173 const fileContents = readFileSync ( fullPath , "utf8" ) ;
163174 const { content, data } = await parseMatter ( fileContents ) ;
0 commit comments