diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f643b2a..37eec91 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -2,6 +2,7 @@ "recommendations": [ "biomejs.biome", "astro-build.astro-vscode", + "svelte.svelte-vscode", "davidanson.markdownlint" ] } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index b91cc0d..3685133 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,10 +13,12 @@ "[typescriptreact]": { "editor.defaultFormatter": "biomejs.biome" }, + "[svelte]": { + "editor.defaultFormatter": "biomejs.biome", + }, "editor.codeActionsOnSave": { - "source.fixAll": "explicit", "quickfix.biome": "always", "source.organizeImports.biome": "always" }, "frontMatter.dashboard.openOnStart": false -} +} \ No newline at end of file diff --git a/biome.json b/biome.json index f2af656..72bac25 100644 --- a/biome.json +++ b/biome.json @@ -1,7 +1,9 @@ { "$schema": "https://biomejs.dev/schemas/1.4.1/schema.json", "extends": [], - "files": { "ignoreUnknown": true }, + "files": { + "ignoreUnknown": true + }, "organizeImports": { "enabled": true }, @@ -17,16 +19,20 @@ "parser": { "unsafeParameterDecoratorsEnabled": true }, + "globals": [ + "Astro" + ], "formatter": { - "quoteStyle": "single", - "jsxQuoteStyle": "single", - "trailingComma": "all", - "semicolons": "asNeeded", + "quoteStyle": "double", + "jsxQuoteStyle": "double", + "semicolons": "always", "arrowParentheses": "asNeeded" } }, "json": { - "parser": { "allowComments": true }, + "parser": { + "allowComments": true + }, "formatter": { "enabled": true, "indentStyle": "space", @@ -41,7 +47,8 @@ "recommended": true }, "complexity": { - "recommended": true + "recommended": true, + "noForEach": "off" }, "correctness": { "recommended": true @@ -53,14 +60,32 @@ "recommended": true }, "style": { - "recommended": true + "recommended": true, + "noParameterAssign": "off", + "useNodejsImportProtocol": "off" }, "suspicious": { - "recommended": true + "recommended": true, + "noExplicitAny": "off" }, "nursery": { "recommended": true } } - } -} + }, + "overrides": [ + { + "include": [ + "*.svelte", + "*.astro" + ], + "linter": { + "rules": { + "style": { + "useConst": "off" + } + } + } + } + ] +} \ No newline at end of file diff --git a/frontmatter.json b/frontmatter.json index cb9e910..c41dce3 100644 --- a/frontmatter.json +++ b/frontmatter.json @@ -59,4 +59,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/package.json b/package.json index e4d57c4..2f33847 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "fuwari", + "name": "blog.devcomp.xyz", "type": "module", "version": "0.0.1", "scripts": { @@ -9,8 +9,8 @@ "preview": "astro preview", "astro": "astro", "new-post": "node scripts/new-post.js", - "format": "biome format --write ./src", - "lint": "biome check --apply ./src" + "fmt": "biome format --write ./src", + "lint": "biome check ./src" }, "dependencies": { "@astrojs/check": "^0.7.0", @@ -68,4 +68,4 @@ "sharp": "^0.33.0" } } -} +} \ No newline at end of file diff --git a/public/favicon-dark.png b/public/favicon-dark.png new file mode 100644 index 0000000..54e60f4 Binary files /dev/null and b/public/favicon-dark.png differ diff --git a/public/favicon-light.png b/public/favicon-light.png new file mode 100644 index 0000000..3409858 Binary files /dev/null and b/public/favicon-light.png differ diff --git a/public/favicon/favicon-dark-128.png b/public/favicon/favicon-dark-128.png deleted file mode 100644 index 7422ce8..0000000 Binary files a/public/favicon/favicon-dark-128.png and /dev/null differ diff --git a/public/favicon/favicon-dark-180.png b/public/favicon/favicon-dark-180.png deleted file mode 100644 index de0f89b..0000000 Binary files a/public/favicon/favicon-dark-180.png and /dev/null differ diff --git a/public/favicon/favicon-dark-192.png b/public/favicon/favicon-dark-192.png deleted file mode 100644 index e8d4a2d..0000000 Binary files a/public/favicon/favicon-dark-192.png and /dev/null differ diff --git a/public/favicon/favicon-dark-32.png b/public/favicon/favicon-dark-32.png deleted file mode 100644 index fce9b80..0000000 Binary files a/public/favicon/favicon-dark-32.png and /dev/null differ diff --git a/public/favicon/favicon-light-128.png b/public/favicon/favicon-light-128.png deleted file mode 100644 index 83dc7c7..0000000 Binary files a/public/favicon/favicon-light-128.png and /dev/null differ diff --git a/public/favicon/favicon-light-180.png b/public/favicon/favicon-light-180.png deleted file mode 100644 index bbb666b..0000000 Binary files a/public/favicon/favicon-light-180.png and /dev/null differ diff --git a/public/favicon/favicon-light-192.png b/public/favicon/favicon-light-192.png deleted file mode 100644 index 2853594..0000000 Binary files a/public/favicon/favicon-light-192.png and /dev/null differ diff --git a/public/favicon/favicon-light-32.png b/public/favicon/favicon-light-32.png deleted file mode 100644 index 327ee0b..0000000 Binary files a/public/favicon/favicon-light-32.png and /dev/null differ diff --git a/src/components/ArchivePanel.astro b/src/components/ArchivePanel.astro index 243bd30..5d4c5b3 100644 --- a/src/components/ArchivePanel.astro +++ b/src/components/ArchivePanel.astro @@ -1,63 +1,65 @@ --- -import {getSortedPosts} from "../utils/content-utils"; -import {getPostUrlBySlug} from "../utils/url-utils"; -import {i18n} from "../i18n/translation"; +import { UNCATEGORIZED } from "@constants/constants"; import I18nKey from "../i18n/i18nKey"; -import {UNCATEGORIZED} from "@constants/constants"; +import { i18n } from "../i18n/translation"; +import { getSortedPosts } from "../utils/content-utils"; +import { getPostUrlBySlug } from "../utils/url-utils"; interface Props { - keyword: string; - tags: string[]; - categories: string[]; + keyword?: string; + tags: string[]; + categories?: string[]; } -const { keyword, tags, categories} = Astro.props; +const { keyword, tags, categories } = Astro.props; -let posts = await getSortedPosts() +let posts = await getSortedPosts(); if (Array.isArray(tags) && tags.length > 0) { - posts = posts.filter(post => - Array.isArray(post.data.tags) && post.data.tags.some(tag => tags.includes(tag)) - ); + posts = posts.filter( + post => + Array.isArray(post.data.tags) && + post.data.tags.some(tag => tags.includes(tag)), + ); } if (Array.isArray(categories) && categories.length > 0) { - posts = posts.filter(post => - (post.data.category && categories.includes(post.data.category)) || - (!post.data.category && categories.includes(UNCATEGORIZED)) - ); + posts = posts.filter( + post => + (post.data.category && categories.includes(post.data.category)) || + (!post.data.category && categories.includes(UNCATEGORIZED)), + ); } -const groups = function () { - const groupedPosts = posts.reduce((grouped, post) => { - const year = post.data.published.getFullYear() - if (!grouped[year]) { - grouped[year] = [] - } - grouped[year].push(post) - return grouped - }, {}) +const groups = (() => { + const groupedPosts = posts.reduce((grouped, post) => { + const year = post.data.published.getFullYear(); + if (!grouped[year]) { + grouped[year] = []; + } + grouped[year].push(post); + return grouped; + }, {}); - // convert the object to an array - const groupedPostsArray = Object.keys(groupedPosts).map(key => ({ - year: key, - posts: groupedPosts[key] - })) + // convert the object to an array + const groupedPostsArray = Object.keys(groupedPosts).map(key => ({ + year: key, + posts: groupedPosts[key], + })); - // sort years by latest first - groupedPostsArray.sort((a, b) => b.year - a.year) - return groupedPostsArray; -}(); + // sort years by latest first + groupedPostsArray.sort((a, b) => b.year - a.year); + return groupedPostsArray; +})(); function formatDate(date: Date) { - const month = (date.getMonth() + 1).toString().padStart(2, '0'); - const day = date.getDate().toString().padStart(2, '0'); - return `${month}-${day}`; + const month = (date.getMonth() + 1).toString().padStart(2, "0"); + const day = date.getDate().toString().padStart(2, "0"); + return `${month}-${day}`; } function formatTag(tag: string[]) { - return tag.map(t => `#${t}`).join(' '); + return tag.map(t => `#${t}`).join(" "); } - ---
diff --git a/src/components/ConfigCarrier.astro b/src/components/ConfigCarrier.astro index 445be0f..68b3dde 100644 --- a/src/components/ConfigCarrier.astro +++ b/src/components/ConfigCarrier.astro @@ -1,7 +1,6 @@ --- -import {siteConfig} from "../config"; - +import { siteConfig } from "../config"; ---
diff --git a/src/components/Footer.astro b/src/components/Footer.astro index 15eabb5..98af7b8 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,7 +1,6 @@ --- -import {profileConfig} from "../config"; - +import { profileConfig } from "../config"; ---
diff --git a/src/components/LightDarkSwitch.svelte b/src/components/LightDarkSwitch.svelte index 9b44385..87bb84c 100644 --- a/src/components/LightDarkSwitch.svelte +++ b/src/components/LightDarkSwitch.svelte @@ -1,74 +1,60 @@ diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 5b7a78c..a739ad3 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -1,22 +1,23 @@ --- -import { Icon } from 'astro-icon/components'; -import DisplaySettings from "./widget/DisplaySettings.svelte"; -import {LinkPreset, NavBarLink} from "../types/config"; -import {navBarConfig, siteConfig} from "../config"; -import NavMenuPanel from "./widget/NavMenuPanel.astro"; -import Search from "./Search.svelte"; -import {LinkPresets} from "../constants/link-presets"; +import { Icon } from "astro-icon/components"; +import { navBarConfig, siteConfig } from "../config"; +import { LinkPresets } from "../constants/link-presets"; +import type { LinkPreset, NavBarLink } from "../types/config"; +import { url } from "../utils/url-utils"; import LightDarkSwitch from "./LightDarkSwitch.svelte"; -import {url} from "../utils/url-utils"; +import Search from "./Search.svelte"; +import DisplaySettings from "./widget/DisplaySettings.svelte"; +import NavMenuPanel from "./widget/NavMenuPanel.astro"; const className = Astro.props.class; -let links: NavBarLink[] = navBarConfig.links.map((item: NavBarLink | LinkPreset): NavBarLink => { +const links: NavBarLink[] = navBarConfig.links.map( + (item: NavBarLink | LinkPreset): NavBarLink => { if (typeof item === "number") { - return LinkPresets[item] + return LinkPresets[item]; } return item; -}); - + }, +); ---
diff --git a/src/components/PostMeta.astro b/src/components/PostMeta.astro index 34ec1d0..ab7bba2 100644 --- a/src/components/PostMeta.astro +++ b/src/components/PostMeta.astro @@ -1,18 +1,18 @@ --- -import {formatDateToYYYYMMDD} from "../utils/date-utils"; -import { Icon } from 'astro-icon/components'; -import {i18n} from "../i18n/translation"; +import { Icon } from "astro-icon/components"; import I18nKey from "../i18n/i18nKey"; -import {url} from "../utils/url-utils"; +import { i18n } from "../i18n/translation"; +import { formatDateToYYYYMMDD } from "../utils/date-utils"; +import { url } from "../utils/url-utils"; interface Props { - class: string; - published: Date; - tags: string[]; - category: string; - hideTagsForMobile: boolean; + class: string; + published: Date; + tags: string[]; + category: string; + hideTagsForMobile: boolean; } -const {published, tags, category, hideTagsForMobile} = Astro.props; +const { published, tags, category, hideTagsForMobile } = Astro.props; const className = Astro.props.class; --- diff --git a/src/components/PostPage.astro b/src/components/PostPage.astro index a221cb7..ace3b33 100644 --- a/src/components/PostPage.astro +++ b/src/components/PostPage.astro @@ -1,11 +1,11 @@ --- -import {getPostUrlBySlug} from "@utils/url-utils"; +import { getPostUrlBySlug } from "@utils/url-utils"; import PostCard from "./PostCard.astro"; -const {page} = Astro.props; +const { page } = Astro.props; -let delay = 0 -const interval = 50 +let delay = 0; +const interval = 50; ---
{page.data.map((entry: { data: { draft: boolean; title: string; tags: string[]; category: string; published: Date; image: string; description: string; }; slug: string; }) => { @@ -16,7 +16,7 @@ const interval = 50 tags={entry.data.tags} category={entry.data.category} published={entry.data.published} - url={getPostUrlBySlug(entry.slug)} + url={getPostUrlBySlug(entry.slug)!} image={entry.data.image} description={entry.data.description} draft={entry.data.draft} diff --git a/src/components/Search.svelte b/src/components/Search.svelte index df64cf8..c288bb1 100644 --- a/src/components/Search.svelte +++ b/src/components/Search.svelte @@ -1,69 +1,74 @@ diff --git a/src/components/control/BackToTop.astro b/src/components/control/BackToTop.astro index 2929472..42d6f84 100644 --- a/src/components/control/BackToTop.astro +++ b/src/components/control/BackToTop.astro @@ -1,5 +1,5 @@ --- -import { Icon } from 'astro-icon/components'; +import { Icon } from "astro-icon/components"; --- diff --git a/src/components/control/ButtonLink.astro b/src/components/control/ButtonLink.astro index b58d920..d296a4d 100644 --- a/src/components/control/ButtonLink.astro +++ b/src/components/control/ButtonLink.astro @@ -1,10 +1,10 @@ --- interface Props { - badge?: string - url?: string - label?: string + badge?: string; + url?: string; + label?: string; } -const { badge, url, name } = Astro.props +const { badge, url, name } = Astro.props; ---