refactor: remove portfolio

This commit is contained in:
Kim, Jimin 2024-03-23 14:13:13 +09:00
parent 565297c9b3
commit 584b4a60da
Signed by: pomp
GPG key ID: 77DAC7BB5CA8C7AA
54 changed files with 28 additions and 1085 deletions

View file

@ -1,14 +0,0 @@
import portfolio from "../dist/portfolio.json" assert { type: "json" }
import type { PortfolioProject } from "../src/types/types"
export type ProjectKey = keyof typeof portfolio.projects
// sort of like src/types/types.ts > PortfolioData but exported
export default portfolio as {
// waiting for https://github.com/microsoft/TypeScript/issues/32063
skills: string[]
projects: {
[key in ProjectKey]: PortfolioProject
}
}

View file

@ -1,30 +0,0 @@
---
name: developomp-site
overview: my websites for blogging, portfolio, resume, etc.
image: /img/portfolio/developomp-site.avif
repo: https://github.com/developomp/developomp-site
badges:
- typescript
- tailwindcss
- react
- svelte
- nextdotjs
- firebase
- terraform
---
## Introduction
developomp-site is a monorepo managed by [turborepo](https://turbo.build/repo)
and pnpm workspace.
- https://developomp.com - about me, built with **Svelte with SvelteKit**
- https://blog.developomp.com - Blogging site, built with **React with NextJS**
- https://portfolio.developomp.com - Portfolio, built with **React with NextJS**
## Interesting Stuff
- [markdown parsing][markdown-parsing]
- [test post](https://blog.developomp.com/posts/test-post)
[markdown-parsing]: https://github.com/developomp/developomp-site/tree/081855a4ecb6f5bf74b76758c358ea54b465b2b7/packages/blog-content

View file

@ -1,38 +0,0 @@
---
name: War Brokers Mods
overview: A game mod for a unity game. Provides in-game UI and OBS overlays.
image: /img/portfolio/wbm.avif
repo: https://github.com/War-Brokers-Mods
badges:
- rust
- csharp
- svelte
- tailwindcss
- unity
- tauri
---
## Introduction
The War Brokers Mods (WBM) is a mod for the game
[War Brokers](https://warbrokers.io) consisting of 3 sub-projects:
- [mod][mod] - Built with C#, it uses the [BepInEx][bepinex] framework to patch
different aspects of the game
- [OBS overlay][overlays] - Customizable overlays for [OBS studio](https://github.com/obsproject/obs-studio)
![Overlay image](/img/portfolio/wbm-overlays.avif "Overlay image")
- [installer][installer] - Utility for installing updating the mod. Built with [tauri][tauri],
[rust][rust], [svelte][svelte], and [tailwind css][tailwindcss].
![Installer image](/img/portfolio/wbm-installer.avif "Installer image")
[mod]: https://github.com/War-Brokers-Mods/WBM
[overlays]: https://github.com/War-Brokers-Mods/WBM-Overlays
[installer]: https://github.com/War-Brokers-Mods/WBM-installer
[bepinex]: https://github.com/BepInEx/BepInEx
[tauri]: https://github.com/tauri-apps/tauri
[rust]: https://github.com/rust-lang/rust
[svelte]: https://github.com/sveltejs/svelte
[tailwindcss]: https://github.com/tailwindlabs/tailwindcss

View file

@ -1,23 +0,0 @@
---
name: War Brokers Projects
overview: An attempt to bring together community projects related to War Brokers with the goal of making them more visible and making collaboration easier.
image: /img/portfolio/wbp.avif
repo: https://github.com/War-Brokers
badges:
- csharp
- typescript
- express
- swagger
- firebase
---
## Introduction
WBP (War Brokers Projects) is an attempt to bring together community projects
related to War Brokers with the goal of making them more visible and making
collaboration easier.
You can find more information in their [homepage][homepage] or in their [GitHub organization][github]
[Homepage]: https://war-brokers-projects.notion.site/War-Brokers-Projects-0ab13d7077a843e79b99a328e00d2008
[github]: https://github.com/orgs/War-Brokers/repositories

View file

@ -4,5 +4,4 @@ export const outPath = "./dist" // path to the json database
export const contentDirectoryPath = `${outPath}/content`
export const iconsDirectoryPath = `${outPath}/icons`
export const mapFilePath = `${outPath}/map.json`
export const portfolioFilePath = `${outPath}/portfolio.json`
export const searchIndexFilePath = `${outPath}/search.json`

View file

@ -8,11 +8,11 @@
import fs from "fs"
import { mapFilePath, markdownPath, outPath, portfolioFilePath } from "./config"
import { mapFilePath, markdownPath, outPath } from "./config"
import { fillTags, parseSeries, sortDates } from "./postProcess"
import { recursiveParse } from "./recursiveParse"
import { saveIndex } from "./searchIndex"
import type { ContentMap, PortfolioData, SeriesMap } from "./types/types"
import type { ContentMap, SeriesMap } from "./types/types"
import { ParseMode } from "./types/types"
export const contentMap: ContentMap = {
@ -25,10 +25,6 @@ export const contentMap: ContentMap = {
series: {},
}
export const seriesMap: SeriesMap = {}
export const portfolioData: PortfolioData = {
skills: new Set(),
projects: {},
}
async function main() {
/**
@ -60,7 +56,6 @@ async function main() {
// parse markdown
await recursiveParse(ParseMode.POSTS, markdownPath + "/posts")
await recursiveParse(ParseMode.SERIES, markdownPath + "/series")
await recursiveParse(ParseMode.PORTFOLIO, markdownPath + "/projects")
sortDates()
fillTags()
@ -71,14 +66,6 @@ async function main() {
*/
fs.writeFileSync(mapFilePath, JSON.stringify(contentMap))
fs.writeFileSync(
portfolioFilePath,
JSON.stringify({
...portfolioData,
skills: Array.from(portfolioData.skills),
}),
)
saveIndex()
}

View file

@ -23,7 +23,6 @@ import supersub from "remark-supersub"
import { unified } from "unified"
import type { MarkdownData } from "./types/types"
import { ParseMode } from "./types/types"
import { nthIndex } from "./util"
const processor = unified() // interface for remark and rehype
@ -50,12 +49,10 @@ const processor = unified() // interface for remark and rehype
*
* @param {string} markdownRaw - raw unparsed text data of the markdown file
* @param {string} path - filename of the markdown file
* @param {ParseMode} mode
*/
export default async function parseMarkdown(
markdownRaw: string,
path: string,
mode: ParseMode,
): Promise<MarkdownData> {
const fileHasFrontMatter = markdownRaw.startsWith("---")
@ -64,21 +61,11 @@ export default async function parseMarkdown(
: {}
if (fileHasFrontMatter) {
if (mode != ParseMode.PORTFOLIO) {
if (!frontMatter.title)
throw Error(`Title is not defined in file: ${path}`)
if (!frontMatter.title)
throw Error(`Title is not defined in file: ${path}`)
if (!frontMatter.date)
throw Error(`Date is not defined in file: ${path}`)
}
if (mode === ParseMode.PORTFOLIO) {
if (frontMatter.overview) {
frontMatter.overview = String(
processor.processSync(frontMatter.overview),
)
}
}
if (!frontMatter.date)
throw Error(`Date is not defined in file: ${path}`)
}
frontMatter.content = touchupHTML(

View file

@ -5,7 +5,6 @@ import parseMarkdown from "../parseMarkdown"
import { ParseMode } from "../types/types"
import { path2FileOrFolderName, path2URL } from "../util"
import parsePost from "./parsePost"
import parseProjects from "./parseProjects"
import parseSeries from "./parseSeries"
/**
@ -98,9 +97,5 @@ async function parseFile(mode: ParseMode, path: string): Promise<void> {
case ParseMode.SERIES:
await parseSeries(dataToPass)
break
case ParseMode.PORTFOLIO:
await parseProjects(dataToPass)
break
}
}

View file

@ -1,57 +0,0 @@
import type { SimpleIcon } from "simple-icons"
import * as icons from "simple-icons"
import tinycolor from "tinycolor2"
import { portfolioData } from ".."
import { contentDirectoryPath, iconsDirectoryPath } from "../config"
import { generateToc } from "../parseMarkdown"
import { writeToFile } from "../util"
import type { DataToPass } from "."
export default async function parseProjects({
urlPath,
markdownRaw,
markdownData,
}: DataToPass): Promise<void> {
if (markdownData.badges) {
;(markdownData.badges as string[]).forEach((slug) => {
// todo: handle cases when icon is not on simple-icons
const icon: SimpleIcon =
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
icons["si" + slug[0].toUpperCase() + slug.slice(1)]
portfolioData.skills.add(slug)
const color = tinycolor(icon.hex).lighten(5).desaturate(5)
// save svg icon
writeToFile(
`${iconsDirectoryPath}/${icon.slug}.json`,
JSON.stringify({
svg: icon.svg,
hex: color.toHexString(),
isDark: color.isDark(),
title: icon.title,
}),
)
})
}
// remove /projects/ prefix
portfolioData.projects[urlPath.replace("/projects/", "")] = {
name: markdownData.name as string,
image: markdownData.image as string,
overview: markdownData.overview as string,
badges: (markdownData.badges as string[]) || [],
repo: (markdownData.repo as string) || "",
}
writeToFile(
`${contentDirectoryPath}${urlPath}.json`,
JSON.stringify({
content: markdownData.content,
toc: await generateToc(markdownRaw),
}),
)
}

View file

@ -32,7 +32,6 @@ export interface ContentMap {
export enum ParseMode {
POSTS,
SERIES,
PORTFOLIO,
}
export interface MarkdownData {
@ -67,13 +66,6 @@ export interface PageData {
order: string[]
length: number
// portfolio
image: string // image url
overview: string
badges: string[]
repo: string
}
export interface Badge {
@ -106,31 +98,3 @@ export interface SeriesEntry {
index: number
url: string
}
/**
* Portfolio
*/
export interface PortfolioData {
// a set of valid simple icons slug
skills: Set<string>
// key: url
projects: {
[key: string]: PortfolioProject
}
}
export interface PortfolioOverview {
// link to my github
github: string
description: string
}
export interface PortfolioProject {
name: string
image: string // url to the image
overview: string
badges: string[] // array of valid simpleIcons slug
repo: string // url of the git repository
}