From 0aabb961b654feb7aad8bed4c751b8d05c7b458e Mon Sep 17 00:00:00 2001 From: BlakeBr0 Date: Mon, 15 Dec 2025 23:27:29 -0600 Subject: [PATCH 1/5] Upgrade to Nuxt Content 3 --- .gitignore | 1 + apps/web/app/components/ContentLinks.vue | 2 +- apps/web/app/components/content/ProseCode.vue | 4 +- apps/web/app/components/docs/Pagination.vue | 21 +- .../app/components/docs/SidebarContent.vue | 6 +- .../app/components/global/DocsSectionList.vue | 13 +- apps/web/app/components/wiki/ArticleLink.vue | 2 +- apps/web/app/components/wiki/Header.vue | 4 +- .../components/wiki/ListingSidebarContent.vue | 4 +- apps/web/app/components/wiki/Mods.vue | 10 +- apps/web/app/components/wiki/Pagination.vue | 27 +- .../app/components/wiki/SidebarContent.vue | 6 +- apps/web/app/composables/api.ts | 2 +- apps/web/app/composables/docs.ts | 48 +- apps/web/app/composables/wiki.ts | 127 +- .../docs/[[version]]/[[mod]]/[...slug].vue | 14 +- .../[[version]]/[mod]/[category]/[slug].vue | 28 +- .../pages/wiki/[[version]]/[mod]/index.vue | 18 +- apps/web/app/pages/wiki/[[version]]/index.vue | 5 +- apps/web/app/utils/docs.ts | 21 + apps/web/app/utils/wiki.ts | 29 + apps/web/content.config.ts | 25 + apps/web/nuxt.config.ts | 29 +- apps/web/package.json | 3 +- apps/web/server/api/search.ts | 25 +- apps/web/server/tsconfig.json | 3 + package.json | 5 +- pnpm-lock.yaml | 1030 ++++++++++++----- 28 files changed, 1037 insertions(+), 475 deletions(-) create mode 100644 apps/web/content.config.ts create mode 100644 apps/web/server/tsconfig.json diff --git a/.gitignore b/.gitignore index 90f9f23..6a1dbe8 100644 --- a/.gitignore +++ b/.gitignore @@ -92,3 +92,4 @@ sw.* .vercel .turbo .output +.data diff --git a/apps/web/app/components/ContentLinks.vue b/apps/web/app/components/ContentLinks.vue index a2283b0..9a7de2b 100644 --- a/apps/web/app/components/ContentLinks.vue +++ b/apps/web/app/components/ContentLinks.vue @@ -54,6 +54,6 @@ const { mod } = useDocsMetadata(); const editURL = computed( () => - `https://github.com/blakesmods/web/edit/main/apps/web/content${props.page._path}.${props.page._extension}` + `https://github.com/blakesmods/web/edit/main/apps/web/content${props.page.path}.${props.page.extension}` ); diff --git a/apps/web/app/components/content/ProseCode.vue b/apps/web/app/components/content/ProseCode.vue index 2bf3b98..efa57b9 100644 --- a/apps/web/app/components/content/ProseCode.vue +++ b/apps/web/app/components/content/ProseCode.vue @@ -3,7 +3,7 @@ queryContent(parts[0], parts[1]).findSurround(props.current._path) + "docs/" + props.current.path + "/pagination", + () => queryCollectionItemSurroundings("docs", props.current.path) ); const previous = computed(() => data.value[0]); @@ -57,22 +55,19 @@ const next = computed(() => data.value[1]); // the latest version doesn't have the version in the url if (isLatestVersion.value) { if (previous.value) { - previous.value._path = removeDocsVersionFromPath( - previous.value._path, + previous.value.path = removeDocsVersionFromPath( + previous.value.path, version.value ); } if (next.value) { - next.value._path = removeDocsVersionFromPath( - next.value._path, - version.value - ); + next.value.path = removeDocsVersionFromPath(next.value.path, version.value); } } function formatModName(document) { - const modID = document._path.split("/")[isLatestVersion.value ? 2 : 3]; + const modID = document.path.split("/")[isLatestVersion.value ? 2 : 3]; const mod = getMod(modID); return mod ? mod.name : modID; } diff --git a/apps/web/app/components/docs/SidebarContent.vue b/apps/web/app/components/docs/SidebarContent.vue index 83f4270..9e575c5 100644 --- a/apps/web/app/components/docs/SidebarContent.vue +++ b/apps/web/app/components/docs/SidebarContent.vue @@ -39,10 +39,10 @@ v-for="document in documents[category]" class="relative pl-2 py-0.5 text-sm first:mt-2 hover:text-dimmed border-l border-neutral-300 dark:border-neutral-700" :class="{ - '!text-primary-500 dark:!text-primary-400 font-semibold': - document._path === route.path + 'text-primary-500! dark:text-primary-400! font-semibold': + document.path === route.path }" - :to="document._path" + :to="document.path" > {{ document.title }} diff --git a/apps/web/app/components/global/DocsSectionList.vue b/apps/web/app/components/global/DocsSectionList.vue index cefeb4b..856dd3b 100644 --- a/apps/web/app/components/global/DocsSectionList.vue +++ b/apps/web/app/components/global/DocsSectionList.vue @@ -4,7 +4,7 @@ {{ page.title }} @@ -17,15 +17,16 @@ const { version, mod, isLatestVersion } = useDocsMetadata(); const { data } = await useAsyncData( `${mod.value?.mod_id}-${version.value}-docs-listing`, () => - queryContent("docs", version.value, mod.value?.mod_id ?? "") - .only(["title", "_path"]) - .find() + queryCollection("docs") + .where("path", "LIKE", createDocsPathSQL(version.value, mod.value.mod_id)) + .select("title", "path") + .all() ); const pages = computed(() => data.value.slice(1).map(doc => { - if (isLatestVersion.value && doc._path) { - doc._path = removeDocsVersionFromPath(doc._path, version.value); + if (isLatestVersion.value && doc.path) { + doc.path = removeDocsVersionFromPath(doc.path, version.value); } return doc; diff --git a/apps/web/app/components/wiki/ArticleLink.vue b/apps/web/app/components/wiki/ArticleLink.vue index 5cb8f7f..035663e 100644 --- a/apps/web/app/components/wiki/ArticleLink.vue +++ b/apps/web/app/components/wiki/ArticleLink.vue @@ -1,7 +1,7 @@