@movk/nuxt-docs 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { camelCase, upperFirst } from '@movk/core'
|
|
2
|
+
import { camelCase, kebabCase, upperFirst } from '@movk/core'
|
|
3
3
|
|
|
4
4
|
interface Commit {
|
|
5
5
|
sha: string
|
|
@@ -29,6 +29,15 @@ const props = defineProps<{
|
|
|
29
29
|
* The author to filter commits by.
|
|
30
30
|
*/
|
|
31
31
|
author?: string
|
|
32
|
+
/**
|
|
33
|
+
* The casing format for the file name.
|
|
34
|
+
* - 'auto': Vue files use PascalCase, others use camelCase (default)
|
|
35
|
+
* - 'kebab': Keep kebab-case (e.g., use-user.ts)
|
|
36
|
+
* - 'camel': Convert to camelCase (e.g., useUser.ts)
|
|
37
|
+
* - 'pascal': Convert to PascalCase (e.g., UseUser.ts)
|
|
38
|
+
* @defaultValue 'auto'
|
|
39
|
+
*/
|
|
40
|
+
casing?: 'auto' | 'kebab' | 'camel' | 'pascal'
|
|
32
41
|
}>()
|
|
33
42
|
|
|
34
43
|
const SHA_SHORT_LENGTH = 5
|
|
@@ -46,11 +55,26 @@ const filePath = computed(() => {
|
|
|
46
55
|
const fileExtension = props.suffix ?? (github && typeof github === 'object' ? github.suffix : 'vue')
|
|
47
56
|
const fileName = props.name ?? routeName.value
|
|
48
57
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
:
|
|
58
|
+
// 根据 casing 参数转换文件名
|
|
59
|
+
const transformedName = (() => {
|
|
60
|
+
const casing = props.casing ?? (github && typeof github === 'object' ? github.casing : undefined) ?? 'auto'
|
|
61
|
+
|
|
62
|
+
switch (casing) {
|
|
63
|
+
case 'kebab':
|
|
64
|
+
return kebabCase(fileName)
|
|
65
|
+
case 'camel':
|
|
66
|
+
return camelCase(fileName)
|
|
67
|
+
case 'pascal':
|
|
68
|
+
return upperFirst(camelCase(fileName))
|
|
69
|
+
case 'auto':
|
|
70
|
+
default:
|
|
71
|
+
return fileExtension === 'vue'
|
|
72
|
+
? upperFirst(camelCase(fileName))
|
|
73
|
+
: camelCase(fileName)
|
|
74
|
+
}
|
|
75
|
+
})()
|
|
52
76
|
|
|
53
|
-
return `${basePath}/${filePrefix}${
|
|
77
|
+
return `${basePath}/${filePrefix}${transformedName}.${fileExtension}`
|
|
54
78
|
})
|
|
55
79
|
|
|
56
80
|
const { data: commits } = await useLazyFetch<Commit[]>('/api/github/commits', {
|
package/app/types/index.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ declare module 'nuxt/schema' {
|
|
|
46
46
|
per_page: number
|
|
47
47
|
until: string
|
|
48
48
|
author: string
|
|
49
|
+
/**
|
|
50
|
+
* 文件命名格式
|
|
51
|
+
* @default 'auto'
|
|
52
|
+
* @example 'kebab' | 'camel' | 'pascal' | 'auto'
|
|
53
|
+
*/
|
|
54
|
+
casing: 'auto' | 'kebab' | 'camel' | 'pascal'
|
|
49
55
|
/**
|
|
50
56
|
* 日期格式化配置
|
|
51
57
|
* @example { locale: 'zh-CN', options: { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' } }
|
package/content.config.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineCollection, defineContentConfig
|
|
1
|
+
import { defineCollection, defineContentConfig } from '@nuxt/content'
|
|
2
2
|
import { useNuxt } from '@nuxt/kit'
|
|
3
3
|
import { asSeoCollection } from '@nuxtjs/seo/content'
|
|
4
4
|
import { joinURL } from 'ufo'
|
|
5
|
+
import { z } from 'zod/v4'
|
|
5
6
|
|
|
6
7
|
const { options } = useNuxt()
|
|
7
8
|
const cwd = joinURL(options.rootDir, 'content')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "An elegant documentation theme for Nuxt, powered by Nuxt UI and Nuxt Content.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"scule": "^1.3.0",
|
|
55
55
|
"shiki-transformer-color-highlight": "^1.0.0",
|
|
56
56
|
"tailwindcss": "^4.1.18",
|
|
57
|
-
"ufo": "^1.6.1"
|
|
57
|
+
"ufo": "^1.6.1",
|
|
58
|
+
"zod": "^4.2.1"
|
|
58
59
|
}
|
|
59
60
|
}
|