Skip to content

Commit 99f6f2f

Browse files
authored
feat(studio): integration (#2836)
1 parent 14b5085 commit 99f6f2f

34 files changed

+2333
-340
lines changed

docs/app/layouts/docs.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { ContentNavigationItem } from '@nuxt/content'
33
44
const nav = inject<Ref<ContentNavigationItem[]>>('navigation')
55
6-
const navigation = computed(() => nav?.value.find(item => item.path === '/docs')?.children || [])
6+
const navigation = computed(() => nav?.value?.find(item => item.path === '/docs')?.children || [])
77
</script>
88

99
<template>

docs/app/pages/docs/[...slug].vue

+22-18
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,29 @@ if (!data.value || !data.value.page) {
2020
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
2121
}
2222
23-
const headline = computed(() => findPageHeadline(navigation.value, data.value.page))
23+
const page = computed(() => data.value?.page)
24+
const surround = computed(() => data.value?.surround)
25+
const title = computed(() => page.value?.navigation?.title || page.value?.title)
26+
27+
const headline = computed(() => findPageHeadline(navigation.value, page.value))
2428
2529
useSeoMeta({
2630
titleTemplate: '%s - Nuxt Content v3',
27-
title: data.value.page.navigation?.title || data.value.page.title,
28-
ogTitle: `${data.value.page.navigation?.title || data.value.page.title} - Nuxt Content v3`,
29-
description: data.value.page.description,
30-
ogDescription: data.value.page.description,
31+
title: title.value,
32+
ogTitle: `${title.value} - Nuxt Content v3`,
33+
description: page.value?.description,
34+
ogDescription: page.value?.description,
3135
})
3236
3337
defineOgImageComponent('Docs', {
3438
headline: headline.value,
35-
title: data.value.page.title,
39+
title: title.value,
3640
})
3741
3842
const communityLinks = computed(() => [{
3943
icon: 'i-lucide-pencil',
4044
label: 'Edit this page',
41-
to: `https://github.com/nuxt/content/edit/v3/docs/content/${data.value.page.stem}.${data.value.page.extension}`,
45+
to: `https://github.com/nuxt/content/edit/v3/docs/content/${page.value?.stem}.${page.value?.extension}`,
4246
target: '_blank',
4347
}, {
4448
icon: 'i-lucide-star',
@@ -49,43 +53,43 @@ const communityLinks = computed(() => [{
4953
</script>
5054

5155
<template>
52-
<UPage v-if="data.page">
56+
<UPage v-if="page">
5357
<UPageHeader
54-
:title="data.page.title"
55-
:links="data.page.links"
58+
:title="page.title"
59+
:links="page.links"
5660
:headline="headline"
5761
>
5862
<template #description>
5963
<MDC
60-
v-if="data.page.description"
61-
:value="data.page.description"
64+
v-if="page.description"
65+
:value="page.description"
6266
unwrap="p"
6367
/>
6468
</template>
6569
</UPageHeader>
6670

6771
<UPageBody>
6872
<ContentRenderer
69-
v-if="data.page.body"
70-
:value="data.page"
73+
v-if="page.body"
74+
:value="page"
7175
/>
7276

7377
<USeparator />
7478

75-
<UContentSurround :surround="(data.surround as any)" />
79+
<UContentSurround :surround="surround" />
7680
</UPageBody>
7781

7882
<template
79-
v-if="data.page?.body?.toc?.links?.length"
83+
v-if="page?.body?.toc?.links?.length"
8084
#right
8185
>
8286
<UContentToc
83-
:links="data.page.body.toc.links"
87+
:links="page.body.toc.links"
8488
class="z-[2]"
8589
>
8690
<template #bottom>
8791
<USeparator
88-
v-if="data.page.body?.toc?.links?.length"
92+
v-if="page.body.toc.links.length"
8993
type="dashed"
9094
/>
9195

docs/app/pages/index.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ if (!page.value) {
77
}
88
99
useSeoMeta({
10-
title: page.value.title,
11-
description: page.value.description,
12-
ogTitle: page.value.title,
13-
ogDescription: page.value.description,
10+
title: page.value.seo?.title,
11+
description: page.value.seo?.description,
12+
ogTitle: page.value.seo?.title,
13+
ogDescription: page.value.seo?.description,
1414
ogImage: `${siteConfig.url}/social.png`,
1515
twitterImage: `${siteConfig.url}/social.png`,
1616
})

docs/content/index.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
title: The git-based CMS for Nuxt projects.
2-
description: Nuxt Content is a module for Nuxt that provides a simple way to manage content for your application. It allows developers to write their content in Markdown, YAML, or JSON files and then query and display it in their application.
1+
seo:
2+
title: The git-based CMS for Nuxt projects.
3+
description: Nuxt Content is a module for Nuxt that provides a simple way to manage content for your application. It allows developers to write their content in Markdown, YAML, or JSON files and then query and display it in their application.
34
hero:
45
title: The git-based CMS for<br> Nuxt projects.
56
description: Nuxt Content is a module for Nuxt that provides a simple way to manage content for your application. It allows developers to write their content in Markdown, YAML, or JSON files and then query and display it in their application.

docs/nuxt.config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export default defineNuxtConfig({
3939
// url: process.env.TURSO_DATABASE_URL!,
4040
// authToken: process.env.TURSO_AUTH_TOKEN!,
4141
},
42+
studio: {
43+
enabled: true,
44+
},
4245
},
4346

4447
mdc: {

docs/nuxt.schema.ts

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { field, group } from '@nuxt/content/studio'
2+
3+
export default defineNuxtSchema({
4+
appConfig: {
5+
ui: group({
6+
title: 'UI',
7+
description: 'UI Customization.',
8+
icon: 'i-lucide-palette',
9+
fields: {
10+
colors: group({
11+
title: 'Colors',
12+
description: 'Customize color aliases',
13+
icon: 'i-lucide-brush',
14+
fields: {
15+
primary: field({
16+
type: 'string',
17+
title: 'Primary',
18+
description: 'Primary color of your UI.',
19+
icon: 'i-lucide-brush',
20+
default: 'green',
21+
required: ['sky', 'mint', 'rose', 'amber', 'violet', 'emerald', 'fuchsia', 'indigo', 'lime', 'orange', 'pink', 'purple', 'red', 'teal', 'yellow', 'green', 'blue', 'cyan', 'gray', 'white', 'black'],
22+
}),
23+
secondary: field({
24+
type: 'string',
25+
title: 'Secondary',
26+
description: 'Secondary color of your UI.',
27+
icon: 'i-lucide-brush',
28+
default: 'sky',
29+
required: ['sky', 'mint', 'rose', 'amber', 'violet', 'emerald', 'fuchsia', 'indigo', 'lime', 'orange', 'pink', 'purple', 'red', 'teal', 'yellow', 'green', 'blue', 'cyan', 'gray', 'white', 'black'],
30+
}),
31+
neutral: field({
32+
type: 'string',
33+
title: 'Neutral',
34+
description: 'Neutral color of your UI.',
35+
icon: 'i-lucide-brush',
36+
default: 'slate',
37+
required: ['slate', 'cool', 'zinc', 'neutral', 'stone'],
38+
}),
39+
},
40+
}),
41+
},
42+
}),
43+
},
44+
})

package.json

+26-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
"types": "./dist/module.d.ts",
2020
"import": "./dist/module.mjs",
2121
"require": "./dist/module.cjs"
22+
},
23+
"./studio": {
24+
"types": "./dist/studio.d.ts",
25+
"import": "./dist/studio.mjs",
26+
"require": "./dist/studio.cjs"
2227
}
2328
},
2429
"main": "./dist/module.cjs",
@@ -51,6 +56,7 @@
5156
"defu": "^6.1.4",
5257
"destr": "^2.0.3",
5358
"fast-glob": "^3.3.2",
59+
"git-url-parse": "^15.0.0",
5460
"jiti": "^2.4.0",
5561
"knitwork": "^1.1.0",
5662
"listhen": "^1.9.0",
@@ -62,12 +68,16 @@
6268
"micromark-util-resolve-all": "^2.0.1",
6369
"micromark-util-sanitize-uri": "^2.0.1",
6470
"micromatch": "^4.0.8",
71+
"nuxt-component-meta": "^0.9.0",
6572
"ohash": "^1.1.4",
73+
"parse-git-config": "^3.0.0",
6674
"pathe": "^1.1.2",
75+
"pkg-types": "^1.2.1",
6776
"remark-mdc": "latest",
6877
"scule": "^1.3.0",
6978
"shiki": "^1.23.1",
7079
"slugify": "^1.6.6",
80+
"socket.io-client": "^4.8.1",
7181
"tar": "^7.4.3",
7282
"typescript": "^5.6.3",
7383
"ufo": "^1.5.4",
@@ -110,5 +120,20 @@
110120
"@nuxt/content": "workspace:*",
111121
"vue": "^3.5.12"
112122
},
113-
"packageManager": "[email protected]"
123+
"packageManager": "[email protected]",
124+
"unbuild": {
125+
"entries": [
126+
"./src/module",
127+
"./src/studio"
128+
],
129+
"externals": [
130+
"untyped"
131+
],
132+
"rollup": {
133+
"output": {
134+
"exports": "named"
135+
},
136+
"emitCJS": true
137+
}
138+
}
114139
}

0 commit comments

Comments
 (0)