Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add pro source #2775

Draft
wants to merge 4 commits into
base: v3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 37 additions & 16 deletions docs/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
import { defineCollection, z } from '@nuxt/content'

const schema = z.object({
navigation: z.object({
title: z.string().optional(),
framework: z.string().optional()
}),
links: z.array(z.object({
label: z.string(),
icon: z.string(),
avatar: z.object({
src: z.string(),
alt: z.string()
}).optional(),
to: z.string(),
target: z.string().optional()
}))
})

const source = process.env.NUXT_UI_PRO_PATH
? {
cwd: process.env.NUXT_UI_PRO_PATH,
path: 'docs'
}
: process.env.NUXT_GITHUB_TOKEN
? {
repository: 'nuxt/ui-pro',
branch: 'v3',
dir: 'docs',
token: process.env.NUXT_GITHUB_TOKEN
}
: undefined

export const collections = {
pro: source && defineCollection({
type: 'page',
source,
schema
}),
content: defineCollection({
type: 'page',
source: '**/*',
schema: z.object({
navigation: z.object({
title: z.string().optional(),
framework: z.string().optional()
}),
links: z.array(z.object({
label: z.string(),
icon: z.string(),
avatar: z.object({
src: z.string(),
alt: z.string()
}).optional(),
to: z.string(),
target: z.string().optional()
}))
})
schema
})
}
10 changes: 5 additions & 5 deletions docs/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import pkg from '../package.json'
const { resolve } = createResolver(import.meta.url)

export default defineNuxtConfig({
// extends: [
// process.env.NUXT_UI_PRO_PATH ? resolve(process.env.NUXT_UI_PRO_PATH, 'docs') : process.env.NUXT_GITHUB_TOKEN && ['github:nuxt/ui-pro/docs#dev', { giget: { auth: process.env.NUXT_GITHUB_TOKEN } }]
// ],
extends: [
process.env.NUXT_UI_PRO_PATH ? resolve(process.env.NUXT_UI_PRO_PATH, 'docs') : process.env.NUXT_GITHUB_TOKEN && ['github:nuxt/ui-pro/docs#v3', { giget: { auth: process.env.NUXT_GITHUB_TOKEN } }]
],

modules: [
'../src/module',
Expand Down Expand Up @@ -93,8 +93,8 @@ export default defineNuxtConfig({
// '/api/pulls.json'
],
crawlLinks: true,
autoSubfolderIndex: false
// ignore: !process.env.NUXT_GITHUB_TOKEN ? ['/pro'] : []
autoSubfolderIndex: false,
ignore: !process.env.NUXT_GITHUB_TOKEN ? ['/pro'] : []
},
cloudflare: {
pages: {
Expand Down
Loading