Skip to content

Commit e8f47b2

Browse files
chore: fix typescript issues
1 parent 8c2fe67 commit e8f47b2

9 files changed

+34
-31
lines changed

components/AppFooter.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const year = new Date().getFullYear()
1717
>
1818
<span class="flex-none flex flex-row items-center">
1919
<NuxtLink
20-
v-if="appConfig.stylo.footer.logo.src"
20+
v-if="appConfig.stylo?.footer?.logo?.src"
2121
class="flex title-font font-medium items-center lg:justify-start justify-center text-muted-800 dark:text-muted-100 mr-4 pr-4 border-r border-muted-300 dark:border-muted-600/60"
2222
to="/"
2323
>
@@ -36,7 +36,7 @@ const year = new Date().getFullYear()
3636
/>
3737
</NuxtLink>
3838
<p
39-
v-if="appConfig.stylo.footer.copyright.enabled"
39+
v-if="appConfig.stylo.footer?.copyright?.enabled"
4040
class="font-sans text-sm text-muted-500 dark:text-muted-400"
4141
>
4242
© {{ year }}
@@ -52,7 +52,7 @@ const year = new Date().getFullYear()
5252
</span>
5353
<span class="flex items-center gap-x-6">
5454
<p
55-
v-for="link in appConfig.stylo.footer.links"
55+
v-for="link in appConfig.stylo?.footer?.links"
5656
:key="link.href"
5757
class="text-sm text-muted-600 dark:text-muted-300"
5858
>
@@ -70,7 +70,7 @@ const year = new Date().getFullYear()
7070
class="grow inline-flex gap-1 lg:ml-auto justify-center sm:justify-end mt-2 sm:mt-0"
7171
>
7272
<NuxtLink
73-
v-for="social in appConfig.stylo.footer.social"
73+
v-for="social in appConfig.stylo?.footer?.social"
7474
:key="social.href"
7575
:to="social.href"
7676
:title="social.title"

components/AppFooterAction.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const appConfig = useAppConfig()
33
</script>
44

55
<template>
6-
<div class="app-section bg-white dark:bg-muted-1000">
6+
<div v-if="appConfig.stylo.footer?.action" class="app-section bg-white dark:bg-muted-1000">
77
<div class="app-container">
88
<div class="relative">
99
<div class="text-center mb-8">

components/AppLayout.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const appConfig = useAppConfig()
88
<div>
99
<slot />
1010
</div>
11-
<AppFooterAction v-if="appConfig.stylo.footer.action.enabled" />
11+
<AppFooterAction v-if="appConfig.stylo.footer?.action?.enabled" />
1212
<AppFooter />
1313
</div>
1414
</template>

components/AppNavbar.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ const { data: navigation } = await useAsyncData('navigation', () =>
5656
class="shrink-0 flex gap-2 items-center justify-center pb-1"
5757
>
5858
<img
59-
v-if="appConfig.stylo.header.logo.src"
59+
v-if="appConfig.stylo.header.logo?.src"
6060
class="block dark:hidden h-9 lg:h-10"
6161
:src="appConfig.stylo.header.logo.src"
6262
:alt="appConfig.stylo.header.logo.alt"
6363
/>
6464
<img
6565
v-if="
66-
appConfig.stylo.header.logo.srcDark ||
67-
appConfig.stylo.header.logo.src
66+
appConfig.stylo.header.logo?.srcDark ||
67+
appConfig.stylo.header.logo?.src
6868
"
6969
class="hidden dark:block h-9 lg:h-10"
7070
:src="
@@ -132,15 +132,15 @@ const { data: navigation } = await useAsyncData('navigation', () =>
132132
<NuxtLink to="/">
133133
<div class="shrink-0 flex items-center">
134134
<img
135-
v-if="appConfig.stylo.header.logo.src"
135+
v-if="appConfig.stylo.header?.logo?.src"
136136
class="block dark:hidden h-10 w-10"
137137
:src="appConfig.stylo.header.logo.src"
138138
:alt="appConfig.stylo.header.logo.alt"
139139
/>
140140
<img
141141
v-if="
142-
appConfig.stylo.header.logo.srcDark ||
143-
appConfig.stylo.header.logo.src
142+
appConfig.stylo.header?.logo?.srcDark ||
143+
appConfig.stylo.header?.logo?.src
144144
"
145145
class="hidden dark:block h-10 w-10"
146146
:src="

composables/useAsyncAuthorMeta.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
import type { MaybeComputedRef } from '@vueuse/core'
21
import type { AuthorPage } from '../types'
32

4-
export function useAsyncAuthorMeta(path: MaybeComputedRef<string | undefined>) {
5-
const _path = computed(() => {
6-
return typeof path === 'function' ? path() : isRef(path) ? path.value : path
7-
})
3+
export function useAsyncAuthorMeta(path: MaybeRefOrGetter<string | undefined>) {
4+
const _path = toRef(path)
85

96
return useAsyncData(
107
`author-meta-${_path.value}`,

composables/useAsyncCategoryMeta.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import type { MaybeComputedRef } from '@vueuse/core'
21
import type { CategoryPage } from '../types'
32

43
export function useAsyncCategoryMeta(
5-
path: MaybeComputedRef<string | undefined>
4+
path: MaybeRefOrGetter<string | undefined>
65
) {
7-
const _path = computed(() => {
8-
return typeof path === 'function' ? path() : isRef(path) ? path.value : path
9-
})
6+
const _path = toRef(path)
107

118
return useAsyncData(
129
`category-meta-${_path.value}`,

composables/useAsyncTagsMeta.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
import type { MaybeComputedRef } from '@vueuse/core'
21
import type { TagPage } from '../types'
32

43
export function useAsyncTagsMeta(
5-
paths: MaybeComputedRef<string[] | undefined>
4+
paths: MaybeRefOrGetter<string[] | undefined>
65
) {
7-
const _paths = computed(() => {
8-
return typeof paths === 'function'
9-
? paths()
10-
: isRef(paths)
11-
? paths.value
12-
: paths
13-
})
6+
const _paths = toRef(paths)
147

158
return useAsyncData(
169
`tags-meta-${_paths.value?.join('-')}`,

package.json

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
"license": "MIT",
66
"main": "./nuxt.config.ts",
77
"packageManager": "pnpm@8.5.1",
8+
"files": [
9+
"components",
10+
"composables",
11+
"layouts",
12+
"server",
13+
"styles",
14+
"types",
15+
"utils",
16+
"app.vue",
17+
"app.config.ts",
18+
"nuxt.schema.ts",
19+
"nuxt.config.ts",
20+
"tailwind.config.cjs",
21+
"tokens.config.ts"
22+
],
823
"scripts": {
924
"dev": "nuxi prepare & nuxi dev .blog",
1025
"dev:starter": "nuxi prepare & nuxi dev .starter",

server/plugins/content.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import getReadingTime from 'reading-time'
22
import { toString } from 'mdast-util-to-string'
33

44
export default defineNitroPlugin((nitroApp) => {
5+
// @ts-ignore
56
nitroApp.hooks.hook('content:file:afterParse', (file) => {
67
if (file._id.endsWith('.md')) {
78
const textOnPage = toString(file.body)

0 commit comments

Comments
 (0)