Skip to content

Commit

Permalink
bump vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 8, 2023
1 parent 9ab8d12 commit d2d53d6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .vitepress/genFeed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import { readFileSync, writeFileSync } from 'fs'
import { Feed } from 'feed'
import { fileURLToPath } from 'url'
import postsData from './theme/posts.data.js'
import { load } from './theme/posts.data.js'

const url = `https://blog.vuejs.org`
const dirname = path.dirname(fileURLToPath(import.meta.url))
Expand All @@ -18,7 +18,7 @@ const feed = new Feed({
copyright: 'Copyright (c) 2021-present, Yuxi (Evan) You and blog contributors'
})

postsData.load(true).then((posts) => {
load(true).then((posts) => {
posts.forEach((post) => {
const file = path.resolve(dirname, `dist${post.href}`)
const rendered = readFileSync(file, 'utf-8')
Expand Down
10 changes: 6 additions & 4 deletions .vitepress/theme/posts.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ interface PostWithData extends Post {
declare const data: Post[]
export { data }

async function load(): Promise<Post[]>
async function load(asFeed: boolean): Promise<PostWithData[]>
async function load(asFeed = false) {
export async function load(): Promise<Post[]>
export async function load(asFeed: boolean): Promise<PostWithData[]>
export async function load(asFeed = false) {
md = md || (await createMarkdownRenderer(process.cwd()))
return fs
.readdirSync(postDir)
Expand All @@ -38,7 +38,9 @@ async function load(asFeed = false) {

export default {
watch: path.join(postDir, '*.md'),
load
load() {
return load()
}
}

const cache = new Map()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"gray-matter": "^4.0.2",
"tailwindcss": "^3.1.8",
"tsx": "^3.8.2",
"vitepress": "^1.0.0-alpha.45",
"vitepress": "^1.0.0-alpha.50",
"vue": "^3.2.47"
}
}
44 changes: 22 additions & 22 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d2d53d6

Please sign in to comment.