mirror of
https://github.com/liyunze-coding/coworking-website.git
synced 2026-11-06 13:13:34 +00:00
fixed vulnerabilities, updated glob
This commit is contained in:
parent
cc0779f4e1
commit
20c575eb98
4 changed files with 1400 additions and 1979 deletions
3339
package-lock.json
generated
3339
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -10,15 +10,15 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/mdx": "^3.1.9",
|
"@astrojs/mdx": "^4.2.5",
|
||||||
"@astrojs/react": "^3.6.2",
|
"@astrojs/react": "^3.6.2",
|
||||||
"@astrojs/tailwind": "^5.1.2",
|
"@astrojs/tailwind": "^5.1.2",
|
||||||
"@astrojs/ts-plugin": "^1.10.4",
|
"@astrojs/ts-plugin": "^1.10.4",
|
||||||
"@types/react": "^18.2.65",
|
"@types/react": "^18.2.65",
|
||||||
"@types/react-dom": "^18.2.22",
|
"@types/react-dom": "^18.2.22",
|
||||||
"@vercel/analytics": "^1.0.1",
|
"@vercel/analytics": "^1.0.1",
|
||||||
"astro": "^4.16.13",
|
"astro": "^5.7.8",
|
||||||
"astro-expressive-code": "^0.33.5",
|
"astro-expressive-code": "^0.41.2",
|
||||||
"clsx": "^2.1.0",
|
"clsx": "^2.1.0",
|
||||||
"framer-motion": "^11.0.12",
|
"framer-motion": "^11.0.12",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const { path } = Astro.props;
|
||||||
const editUrl = `${baseRepoUrl}${path}`;
|
const editUrl = `${baseRepoUrl}${path}`;
|
||||||
---
|
---
|
||||||
|
|
||||||
<ul class="list-none text-sm">
|
<ul class="list-none text-sm" transition:name="community-links">
|
||||||
<li class="ml-[0.5rem] my-2">
|
<li class="ml-[0.5rem] my-2">
|
||||||
<a
|
<a
|
||||||
href="https://rython.dev/discord"
|
href="https://rython.dev/discord"
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,17 @@ type Navigation = Record<
|
||||||
{ title: string; url: string; order: number }[]
|
{ title: string; url: string; order: number }[]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
interface MarkdownFile {
|
||||||
|
frontmatter: Record<string, any>; // Adjust the type if you know the exact structure of frontmatter
|
||||||
|
getHeadings?: () => Array<{ depth: number; slug: string; text: string }>; // Optional, based on the structure of headings
|
||||||
|
url: string;
|
||||||
|
file: string;
|
||||||
|
rawContent?: string; // Optional, as not all entries have it
|
||||||
|
compiledContent?: string; // Optional, as not all entries have it
|
||||||
|
Content: () => Promise<any>; // Function that returns a component or content
|
||||||
|
default: any; // Default export, adjust type if needed
|
||||||
|
}
|
||||||
|
|
||||||
const currentUrl = Astro.url.pathname;
|
const currentUrl = Astro.url.pathname;
|
||||||
|
|
||||||
const isCurrentUrl = (url: string) => currentUrl === url;
|
const isCurrentUrl = (url: string) => currentUrl === url;
|
||||||
|
|
@ -23,15 +34,20 @@ export async function setup() {
|
||||||
// Define the order of categories
|
// Define the order of categories
|
||||||
let categoryOrder = ["Get Started", "Guide", "Tutorials"];
|
let categoryOrder = ["Get Started", "Guide", "Tutorials"];
|
||||||
|
|
||||||
const getStartedFiles = await Astro.glob("../../pages/get-started/*");
|
const getStartedFiles = Object.values(import.meta.glob("../../pages/get-started/*", { eager: true }));
|
||||||
const guideFiles = await Astro.glob("../../pages/guide/*");
|
const guideFiles = Object.values(import.meta.glob("../../pages/guide/*", { eager: true }));
|
||||||
const tutorialFiles = await Astro.glob("../../pages/tutorials/*");
|
const tutorialFiles = Object.values(import.meta.glob("../../pages/tutorials/*", { eager: true }));
|
||||||
|
|
||||||
let markdownFiles = [...getStartedFiles, ...guideFiles, ...tutorialFiles];
|
let markdownFiles: MarkdownFile[] = [
|
||||||
|
...(getStartedFiles as MarkdownFile[]),
|
||||||
|
...(guideFiles as MarkdownFile[]),
|
||||||
|
...(tutorialFiles as MarkdownFile[])
|
||||||
|
];
|
||||||
let navigation: Navigation = {};
|
let navigation: Navigation = {};
|
||||||
|
|
||||||
for (const file of markdownFiles) {
|
for (const file of markdownFiles) {
|
||||||
let filePath = file.url;
|
let filePath = file.url;
|
||||||
|
|
||||||
let [_, category] = filePath!.split("/");
|
let [_, category] = filePath!.split("/");
|
||||||
let formattedCategory = formatTitle(category).toLowerCase();
|
let formattedCategory = formatTitle(category).toLowerCase();
|
||||||
let formattedTitle = file.frontmatter.title;
|
let formattedTitle = file.frontmatter.title;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue