From 335c23ad9c19cd52c1282f4ff296a14cdc950611 Mon Sep 17 00:00:00 2001 From: developomp Date: Sun, 9 Jul 2023 11:17:00 +0900 Subject: [PATCH] refactor(content): remove unsearchable content --- .../content/markdown/unsearchable/resume.md | 34 ------------------- packages/content/src/index.ts | 5 --- packages/content/src/parseMarkdown.ts | 2 +- packages/content/src/recursiveParse/index.ts | 5 --- .../src/recursiveParse/parseUnsearchable.ts | 34 ------------------- packages/content/src/types/types.ts | 5 --- 6 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 packages/content/markdown/unsearchable/resume.md delete mode 100644 packages/content/src/recursiveParse/parseUnsearchable.ts diff --git a/packages/content/markdown/unsearchable/resume.md b/packages/content/markdown/unsearchable/resume.md deleted file mode 100644 index 74ab857..0000000 --- a/packages/content/markdown/unsearchable/resume.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Resume ---- - -## Jimin Kim - -[![Github](https://img.shields.io/badge/github-black?style=for-the-badge&logo=github)](https://github.com/developomp) -[![Portfolio](https://img.shields.io/badge/portfolio-grey?style=for-the-badge)](https://portfolio.developomp.com) - -Frontend engineer wannabe - -A natural-born developer who has got to create everything with his own hand. -He won't be satisfied until he breaks everything down to its components and understands what's behind it. - -Characteristics: - -- daily drives [arch linux](https://archlinux.org) -- can fluently speak, read, and write English and Korean at a native level - -Email: developomp@gmail.com - -## Education - -### [Hongik university](https://wwwce.hongik.ac.kr) computer science major - -- Mar 2022 - now - -## Github - -github metrics - -## Skills - -programming skills diff --git a/packages/content/src/index.ts b/packages/content/src/index.ts index aee7d41..03fd28c 100644 --- a/packages/content/src/index.ts +++ b/packages/content/src/index.ts @@ -22,7 +22,6 @@ export const contentMap: ContentMap = { }, posts: {}, series: {}, - unsearchable: {}, } export const seriesMap: SeriesMap = {} export const portfolioData: PortfolioData = { @@ -49,9 +48,6 @@ if (!fs.lstatSync(markdownPath).isDirectory()) if (!fs.lstatSync(markdownPath + "/posts").isDirectory()) throw Error(`Cannot find directory: ${markdownPath + "/posts"}`) -if (!fs.lstatSync(markdownPath + "/unsearchable").isDirectory()) - throw Error(`Cannot find directory: ${markdownPath + "/posts"}`) - if (!fs.lstatSync(markdownPath + "/series").isDirectory()) throw Error(`Cannot find directory: ${markdownPath + "/posts"}`) @@ -60,7 +56,6 @@ if (!fs.lstatSync(markdownPath + "/series").isDirectory()) */ recursiveParse(ParseMode.POSTS, markdownPath + "/posts") -recursiveParse(ParseMode.UNSEARCHABLE, markdownPath + "/unsearchable") recursiveParse(ParseMode.SERIES, markdownPath + "/series") recursiveParse(ParseMode.PORTFOLIO, markdownPath + "/projects") diff --git a/packages/content/src/parseMarkdown.ts b/packages/content/src/parseMarkdown.ts index 3f2b9a5..d602633 100644 --- a/packages/content/src/parseMarkdown.ts +++ b/packages/content/src/parseMarkdown.ts @@ -77,7 +77,7 @@ export default function parseMarkdown( if (!frontMatter.title) throw Error(`Title is not defined in file: ${path}`) - if (mode != ParseMode.UNSEARCHABLE && !frontMatter.date) + if (!frontMatter.date) throw Error(`Date is not defined in file: ${path}`) } diff --git a/packages/content/src/recursiveParse/index.ts b/packages/content/src/recursiveParse/index.ts index 06db5bb..4134d74 100644 --- a/packages/content/src/recursiveParse/index.ts +++ b/packages/content/src/recursiveParse/index.ts @@ -7,7 +7,6 @@ import { path2FileOrFolderName, path2URL } from "../util" import parsePost from "./parsePost" import parseProjects from "./parseProjects" import parseSeries from "./parseSeries" -import parseUnsearchable from "./parseUnsearchable" /** * Data that's passed from {@link parseFile} to other function @@ -95,10 +94,6 @@ function parseFile(mode: ParseMode, path: string): void { parseSeries(dataToPass) break - case ParseMode.UNSEARCHABLE: - parseUnsearchable(dataToPass) - break - case ParseMode.PORTFOLIO: parseProjects(dataToPass) break diff --git a/packages/content/src/recursiveParse/parseUnsearchable.ts b/packages/content/src/recursiveParse/parseUnsearchable.ts deleted file mode 100644 index 8cccf8b..0000000 --- a/packages/content/src/recursiveParse/parseUnsearchable.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { contentMap } from ".." -import { contentDirectoryPath } from "../config" -import { addDocument } from "../searchIndex" -import { writeToFile } from "../util" -import { DataToPass } from "." - -export default function parseUnsearchable(data: DataToPass): void { - const { urlPath: _urlPath, markdownData } = data - - // convert path like /XXX/YYY/ZZZ to /YYY/ZZZ - const urlPath = _urlPath.slice(_urlPath.slice(1).indexOf("/") + 1) - - addDocument({ - title: markdownData.title, - body: markdownData.content, - url: urlPath, - }) - - // Parse data that will be written to map.js - contentMap.unsearchable[urlPath] = { - title: markdownData.title as string, - } - - /** - * Save content - */ - - writeToFile( - `${contentDirectoryPath}/unsearchable${urlPath}.json`, - JSON.stringify({ - content: markdownData.content, - }) - ) -} diff --git a/packages/content/src/types/types.ts b/packages/content/src/types/types.ts index 4f20fc8..36182ff 100644 --- a/packages/content/src/types/types.ts +++ b/packages/content/src/types/types.ts @@ -23,10 +23,6 @@ export interface ContentMap { // series posts have "previous post" and "next post" button so they need to be ordered series: { [key: string]: Series } - - // urls of unsearchable posts - // it is here to quickly check if a post exists or not - unsearchable: { [key: string]: { title: string } } } /** @@ -36,7 +32,6 @@ export interface ContentMap { export enum ParseMode { POSTS, SERIES, - UNSEARCHABLE, PORTFOLIO, }