Upgrade dependencies.
This commit is contained in:
parent
498fa8519e
commit
bc19f9a638
@ -1,7 +1,8 @@
|
||||
import { z, defineCollection } from 'astro:content';
|
||||
import { glob } from 'astro/loaders';
|
||||
|
||||
const blogCollection = defineCollection({
|
||||
type: 'content',
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/blog" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
@ -10,7 +11,7 @@ const blogCollection = defineCollection({
|
||||
}),
|
||||
});
|
||||
const noteCollection = defineCollection({
|
||||
type: 'content',
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/note" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
@ -19,7 +20,7 @@ const noteCollection = defineCollection({
|
||||
}),
|
||||
});
|
||||
const translationCollection = defineCollection({
|
||||
type: 'content',
|
||||
loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: "./src/content/translation" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
@ -32,4 +33,4 @@ export const collections = {
|
||||
'blog': blogCollection,
|
||||
'note': noteCollection,
|
||||
'translation': translationCollection,
|
||||
};
|
||||
};
|
5939
package-lock.json
generated
5939
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -10,16 +10,16 @@
|
||||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.7.0",
|
||||
"@astrojs/sitemap": "^3.1.5",
|
||||
"@astrojs/vue": "^4.5.0",
|
||||
"astro": "^4.9.2",
|
||||
"@astrojs/check": "^0.9.4",
|
||||
"@astrojs/sitemap": "^3.2.1",
|
||||
"@astrojs/vue": "^5.0.7",
|
||||
"astro": "^5.5.2",
|
||||
"bignumber.js": "^9.1.2",
|
||||
"pinyin-pro": "^3.22.0",
|
||||
"prettier": "^3.3.3",
|
||||
"pinyin-pro": "^3.26.0",
|
||||
"prettier": "^3.5.3",
|
||||
"prettier-plugin-astro": "^0.14.1",
|
||||
"remark-toc": "^9.0.0",
|
||||
"typescript": "^5.4.5",
|
||||
"vue": "^3.4.29"
|
||||
"typescript": "^5.8.2",
|
||||
"vue": "^3.5.13"
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,8 @@ const { collectionName, categoryName, posts } = Astro.props;
|
||||
{
|
||||
posts.map((post) => (
|
||||
<li>
|
||||
<a href={`/article/${collectionName}/${post.slug}`} target="_blank">
|
||||
{/* Hide .md extension from URL */}
|
||||
<a href={`/article/${collectionName}/${post.id.replace(".md", "")}`} target="_blank">
|
||||
{post.data.title}
|
||||
</a>
|
||||
</li>
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
import type { CollectionEntry, ContentEntryMap } from "astro:content";
|
||||
import type { CollectionEntry } from "astro:content";
|
||||
import { getCollection, type CollectionKey } from "astro:content";
|
||||
import CategorySummary from "./CategorySummary.astro";
|
||||
|
||||
@ -57,9 +57,9 @@ const categoriedPostList: Array<CategoriedPosts> = allCategories.map((key) => {
|
||||
} else if (sortByArticleTitle) {
|
||||
// sort article by title
|
||||
// get articles with titles started in Chinese or the alphabet
|
||||
let postWithAlphabetStartedTitle: CollectionEntry<keyof ContentEntryMap>[] =
|
||||
let postWithAlphabetStartedTitle: CollectionEntry<CollectionKey>[] =
|
||||
object[key].filter((post) => /^[a-zA-Z]/.test(post.data.title));
|
||||
let postWithChineseStartedTitle: CollectionEntry<keyof ContentEntryMap>[] =
|
||||
let postWithChineseStartedTitle: CollectionEntry<CollectionKey>[] =
|
||||
object[key].filter((post) => /^[^a-zA-Z]/.test(post.data.title));
|
||||
// sort two Array by article title
|
||||
postWithAlphabetStartedTitle.sort((postA, postB) =>
|
||||
|
@ -1,15 +1,19 @@
|
||||
---
|
||||
import { getEntry, type CollectionKey } from "astro:content";
|
||||
import { getCollection, type CollectionEntry } from "astro:content";
|
||||
import { render, type CollectionKey } from "astro:content";
|
||||
|
||||
interface Props {
|
||||
articleSlug: string;
|
||||
articleId: string;
|
||||
collectionName: CollectionKey;
|
||||
}
|
||||
const { articleSlug, collectionName } = Astro.props;
|
||||
const { articleId, collectionName } = Astro.props;
|
||||
|
||||
const article = await getEntry(collectionName, articleSlug);
|
||||
const { Content } = await article!.render();
|
||||
const articlePrettyName = article!.id.split("/").pop()!.replace(".md", "");
|
||||
const articles = await getCollection(collectionName);
|
||||
const article = articles.find(
|
||||
(post: CollectionEntry<CollectionKey>) => post.id === articleId
|
||||
);
|
||||
const { Content } = await render(article!);
|
||||
const articlePrettyName = article!.data.title;
|
||||
---
|
||||
|
||||
<div class="article">
|
||||
|
@ -4,15 +4,15 @@ import ArticleBody from "./ArticleBody.astro";
|
||||
import ArticleBodyContent from "./ArticleBodyContent.astro";
|
||||
|
||||
interface Props {
|
||||
articleSlug: string;
|
||||
articleId: string;
|
||||
collectionName: CollectionKey;
|
||||
}
|
||||
const { articleSlug, collectionName } = Astro.props;
|
||||
const { articleId, collectionName } = Astro.props;
|
||||
---
|
||||
|
||||
<ArticleBody>
|
||||
<ArticleBodyContent
|
||||
articleId={articleId}
|
||||
collectionName={collectionName}
|
||||
articleSlug={articleSlug}
|
||||
/>
|
||||
</ArticleBody>
|
||||
|
@ -7,6 +7,6 @@ import ArticleBodyWrapper from "../components/article/article_body/ArticleBodyWr
|
||||
|
||||
<DefaultLayout title="404">
|
||||
<Nav />
|
||||
<ArticleBodyWrapper collectionName="site" articleSlug="404" />
|
||||
<ArticleBodyWrapper collectionName="site" articleId="404.md" />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
@ -1,10 +1,6 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import type { CollectionEntry, CollectionKey } from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBodyWrapper from "../../../components/article/article_body/ArticleBodyWrapper.astro";
|
||||
@ -13,22 +9,23 @@ import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "blog";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { blog: entry.slug },
|
||||
props: { entry },
|
||||
return blogEntries.map((post: CollectionEntry<CollectionKey>) => ({
|
||||
// Hide .md extension from URL
|
||||
params: { blog: post.id.replace(".md", "") },
|
||||
props: { post },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
post: CollectionEntry<CollectionKey>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
const { post } = Astro.props;
|
||||
|
||||
const articlePrettyName: string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
const articlePrettyName: string = post.data.title;
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBodyWrapper collectionName="blog" articleSlug={entry.slug} />
|
||||
<ArticleBodyWrapper collectionName="blog" articleId={post.id} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
@ -1,10 +1,6 @@
|
||||
---
|
||||
import { getCollection } from "astro:content";
|
||||
import type {
|
||||
CollectionEntry,
|
||||
CollectionKey,
|
||||
ContentEntryMap,
|
||||
} from "astro:content";
|
||||
import type { CollectionEntry, CollectionKey } from "astro:content";
|
||||
import Footer from "../../../components/Footer.astro";
|
||||
import Nav from "../../../components/Nav.astro";
|
||||
import ArticleBodyWrapper from "../../../components/article/article_body/ArticleBodyWrapper.astro";
|
||||
@ -13,22 +9,22 @@ import DefaultLayout from "../../../layouts/DefaultLayout.astro";
|
||||
export async function getStaticPaths() {
|
||||
const collectionName: CollectionKey = "note";
|
||||
const blogEntries = await getCollection(collectionName);
|
||||
return blogEntries.map((entry) => ({
|
||||
params: { note: entry.slug },
|
||||
props: { entry },
|
||||
return blogEntries.map((post: CollectionEntry<CollectionKey>) => ({
|
||||
params: { note: post.id.replace(".md", "") },
|
||||
props: { post },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Props {
|
||||
entry: CollectionEntry<keyof ContentEntryMap>;
|
||||
post: CollectionEntry<CollectionKey>;
|
||||
}
|
||||
const { entry } = Astro.props;
|
||||
const { post } = Astro.props;
|
||||
|
||||
const articlePrettyName: string = entry.id.split("/").pop()!.replace(".md", "");
|
||||
const articlePrettyName: string = post.data.title;
|
||||
---
|
||||
|
||||
<DefaultLayout title=`${articlePrettyName} - 李守中`>
|
||||
<Nav />
|
||||
<ArticleBodyWrapper collectionName="note" articleSlug={entry.slug} />
|
||||
<ArticleBodyWrapper collectionName="note" articleId={post.id} />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
@ -7,6 +7,6 @@ import ArticleBodyWrapper from "../components/article/article_body/ArticleBodyWr
|
||||
|
||||
<DefaultLayout title="李守中">
|
||||
<Nav />
|
||||
<ArticleBodyWrapper collectionName="site" articleSlug="关于本站" />
|
||||
<ArticleBodyWrapper collectionName="site" articleId="关于本站.md" />
|
||||
<Footer />
|
||||
</DefaultLayout>
|
||||
|
@ -1,5 +1,7 @@
|
||||
{
|
||||
"extends": "astro/tsconfigs/strict",
|
||||
"include": [".astro/types.d.ts", "**/*"],
|
||||
"exclude": ["dist"],
|
||||
"compilerOptions": {
|
||||
"jsx": "preserve"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user