Skip to content

Commit

Permalink
Merge branch 'feature' of https://github.com/KinhoLeung/Oathblade int…
Browse files Browse the repository at this point in the history
…o feature

* 'feature' of https://github.com/KinhoLeung/Oathblade:
  refactor: css cleanup and style tweaks
  chore: enforce pnpm usage (saicaca#238)
  refactor: upgrade to Svelte v5 (saicaca#212)
  • Loading branch information
liangjianhao committed Dec 4, 2024
2 parents 64b30ee + 079abbc commit 5e787fd
Show file tree
Hide file tree
Showing 26 changed files with 1,149 additions and 1,229 deletions.
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
manage-package-manager-versions = true
122 changes: 53 additions & 69 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,47 +1,40 @@
import sitemap from '@astrojs/sitemap'
import svelte from '@astrojs/svelte'
import tailwind from '@astrojs/tailwind'
import swup from '@swup/astro'
import Compress from 'astro-compress'
import icon from 'astro-icon'
import { defineConfig } from 'astro/config'
import Color from 'colorjs.io'
import rehypeAutolinkHeadings from 'rehype-autolink-headings'
import rehypeComponents from 'rehype-components' /* Render the custom directive content */
import rehypeKatex from 'rehype-katex'
import rehypeSlug from 'rehype-slug'
import remarkDirective from 'remark-directive' /* Handle directives */
import remarkGithubAdmonitionsToDirectives from 'remark-github-admonitions-to-directives'
import remarkMath from 'remark-math'
import { AdmonitionComponent } from './src/plugins/rehype-component-admonition.mjs'
import { GithubCardComponent } from './src/plugins/rehype-component-github-card.mjs'
import { parseDirectiveNode } from './src/plugins/remark-directive-rehype.js'
import { remarkExcerpt } from './src/plugins/remark-excerpt.js'
import { remarkReadingTime } from './src/plugins/remark-reading-time.mjs'

const oklchToHex = str => {
const DEFAULT_HUE = 250
const regex = /-?\d+(\.\d+)?/g
const matches = str.string.match(regex)
const lch = [matches[0], matches[1], DEFAULT_HUE]
return new Color('oklch', lch).to('srgb').toString({
format: 'hex',
})
}
import sitemap from "@astrojs/sitemap";
import svelte from "@astrojs/svelte";
import tailwind from "@astrojs/tailwind";
import swup from "@swup/astro";
import Compress from "astro-compress";
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
import rehypeKatex from "rehype-katex";
import rehypeSlug from "rehype-slug";
import remarkDirective from "remark-directive"; /* Handle directives */
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
import remarkMath from "remark-math";
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs";
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs";
import { parseDirectiveNode } from "./src/plugins/remark-directive-rehype.js";
import { remarkExcerpt } from "./src/plugins/remark-excerpt.js";
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";

// https://astro.build/config
export default defineConfig({
site: 'https://fuwari.vercel.app/',
base: '/',
trailingSlash: 'always',
site: "https://fuwari.vercel.app/",
base: "/",
trailingSlash: "always",
integrations: [
tailwind(),
tailwind(
{
nesting: true,
}
),
swup({
theme: false,
animationClass: 'transition-swup-', // see https://swup.js.org/options/#animationselector
// the default value `transition-` cause transition delay
// when the Tailwind class `transition-all` is used
containers: ['main', '#toc'],
animationClass: "transition-swup-", // see https://swup.js.org/options/#animationselector
// the default value `transition-` cause transition delay
// when the Tailwind class `transition-all` is used
containers: ["main", "#toc"],
smoothScrolling: true,
cache: true,
preload: true,
Expand All @@ -52,10 +45,10 @@ export default defineConfig({
}),
icon({
include: {
'material-symbols': ['*'],
'fa6-brands': ['*'],
'fa6-regular': ['*'],
'fa6-solid': ['*'],
"preprocess: vitePreprocess(),": ["*"],
"fa6-brands": ["*"],
"fa6-regular": ["*"],
"fa6-solid": ["*"],
},
}),
svelte(),
Expand Down Expand Up @@ -85,32 +78,32 @@ export default defineConfig({
{
components: {
github: GithubCardComponent,
note: (x, y) => AdmonitionComponent(x, y, 'note'),
tip: (x, y) => AdmonitionComponent(x, y, 'tip'),
important: (x, y) => AdmonitionComponent(x, y, 'important'),
caution: (x, y) => AdmonitionComponent(x, y, 'caution'),
warning: (x, y) => AdmonitionComponent(x, y, 'warning'),
note: (x, y) => AdmonitionComponent(x, y, "note"),
tip: (x, y) => AdmonitionComponent(x, y, "tip"),
important: (x, y) => AdmonitionComponent(x, y, "important"),
caution: (x, y) => AdmonitionComponent(x, y, "caution"),
warning: (x, y) => AdmonitionComponent(x, y, "warning"),
},
},
],
[
rehypeAutolinkHeadings,
{
behavior: 'append',
behavior: "append",
properties: {
className: ['anchor'],
className: ["anchor"],
},
content: {
type: 'element',
tagName: 'span',
type: "element",
tagName: "span",
properties: {
className: ['anchor-icon'],
'data-pagefind-ignore': true,
className: ["anchor-icon"],
"data-pagefind-ignore": true,
},
children: [
{
type: 'text',
value: '#',
type: "text",
value: "#",
},
],
},
Expand All @@ -124,23 +117,14 @@ export default defineConfig({
onwarn(warning, warn) {
// temporarily suppress this warning
if (
warning.message.includes('is dynamically imported by') &&
warning.message.includes('but also statically imported by')
warning.message.includes("is dynamically imported by") &&
warning.message.includes("but also statically imported by")
) {
return
return;
}
warn(warning)
},
},
},
css: {
preprocessorOptions: {
stylus: {
define: {
oklchToHex: oklchToHex,
},
warn(warning);
},
},
},
},
})
});
65 changes: 30 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,65 +11,60 @@
"type-check": "tsc --noEmit --isolatedDeclarations",
"new-post": "node scripts/new-post.js",
"format": "biome format --write ./src",
"lint": "biome check --apply ./src"
"lint": "biome check --apply ./src",
"preinstall": "npx only-allow pnpm"
},
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/rss": "^4.0.7",
"@astrojs/sitemap": "^3.1.6",
"@astrojs/svelte": "^5.7.1",
"@astrojs/tailwind": "^5.1.1",
"@fontsource-variable/jetbrains-mono": "^5.0.22",
"@fontsource/roboto": "^5.0.14",
"@astrojs/check": "^0.9.4",
"@astrojs/rss": "^4.0.9",
"@astrojs/sitemap": "^3.2.1",
"@astrojs/svelte": "^6.0.1",
"@astrojs/tailwind": "^5.1.2",
"@fontsource-variable/jetbrains-mono": "^5.1.1",
"@fontsource/roboto": "^5.1.0",
"@iconify-json/fa6-brands": "^1.2.1",
"@iconify-json/fa6-regular": "^1.2.1",
"@iconify-json/fa6-solid": "^1.2.1",
"@iconify-json/material-symbols": "^1.2.5",
"@iconify/svelte": "^4.0.2",
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"@swup/astro": "^1.4.1",
"astro": "^4.15.9",
"astro-compress": "^2.3.1",
"@tailwindcss/typography": "^0.5.15",
"astro": "^4.16.13",
"astro-compress": "^2.3.5",
"astro-icon": "^1.1.1",
"colorjs.io": "^0.5.2",
"hastscript": "^9.0.0",
"markdown-it": "^14.1.0",
"mdast-util-to-string": "^4.0.0",
"overlayscrollbars": "^2.10.0",
"pagefind": "^1.1.0",
"pagefind": "^1.1.1",
"photoswipe": "^5.4.4",
"reading-time": "^1.5.0",
"rehype-autolink-headings": "^7.1.0",
"rehype-components": "^0.3.0",
"rehype-katex": "^7.0.1",
"rehype-slug": "^6.0.0",
"remark-directive": "^3.0.0",
"remark-directive-rehype": "^0.4.2",
"remark-github-admonitions-to-directives": "^1.0.5",
"remark-math": "^6.0.0",
"sanitize-html": "^2.13.0",
"sanitize-html": "^2.13.1",
"sharp": "^0.33.5",
"svelte": "^4.2.19",
"tailwindcss": "^3.4.10",
"typescript": "^5.5.4",
"stylus": "^0.63.0",
"svelte": "^5.2.2",
"tailwindcss": "^3.4.14",
"typescript": "^5.6.3",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@astrojs/ts-plugin": "^1.10.2",
"@astrojs/ts-plugin": "^1.10.4",
"@biomejs/biome": "1.8.3",
"@iconify-json/fa6-brands": "^1.1.22",
"@iconify-json/fa6-regular": "^1.1.22",
"@iconify-json/fa6-solid": "^1.1.24",
"@iconify-json/material-symbols": "^1.1.89",
"@iconify-json/mdi": "^1.2.1",
"@iconify/svelte": "^4.0.2",
"@rollup/plugin-yaml": "^4.1.2",
"@tailwindcss/typography": "^0.5.15",
"@types/markdown-it": "^14.1.2",
"@types/mdast": "^4.0.4",
"@types/sanitize-html": "^2.13.0",
"photoswipe": "^5.4.4",
"remark-github-admonitions-to-directives": "^1.0.5",
"sass": "^1.77.8",
"stylus": "^0.63.0"
},
"pnpm": {
"overrides": {
"vite-imagetools": "^6.2.7",
"sharp": "^0.33.0"
}
"postcss-import": "^16.1.0",
"postcss-nesting": "^13.0.1"
},
"packageManager": "pnpm@9.6.0+sha512.38dc6fba8dba35b39340b9700112c2fe1e12f10b17134715a4aa98ccf7bb035e76fd981cf0bb384dfa98f8d6af5481c2bef2f4266a24bfa20c34eb7147ce0b5e"
"packageManager": "pnpm@9.14.4"
}
Loading

0 comments on commit 5e787fd

Please sign in to comment.