@vkuttyp/docus 5.4.6
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.
- package/README.md +116 -0
- package/app/app.config.ts +33 -0
- package/app/app.vue +79 -0
- package/app/components/IconMenuToggle.vue +83 -0
- package/app/components/LanguageSelect.vue +83 -0
- package/app/components/OgImage/OgImageDocs.vue +78 -0
- package/app/components/OgImage/OgImageLanding.vue +75 -0
- package/app/components/app/AppFooter.vue +11 -0
- package/app/components/app/AppFooterLeft.vue +5 -0
- package/app/components/app/AppFooterRight.vue +30 -0
- package/app/components/app/AppHeader.vue +82 -0
- package/app/components/app/AppHeaderBody.vue +13 -0
- package/app/components/app/AppHeaderCTA.vue +3 -0
- package/app/components/app/AppHeaderCenter.vue +10 -0
- package/app/components/app/AppHeaderLogo.vue +16 -0
- package/app/components/docs/DocsAsideLeftBody.vue +12 -0
- package/app/components/docs/DocsAsideLeftTop.vue +3 -0
- package/app/components/docs/DocsAsideRightBottom.vue +18 -0
- package/app/components/docs/DocsPageHeaderLinks.vue +96 -0
- package/app/composables/useDocusI18n.ts +35 -0
- package/app/error.vue +79 -0
- package/app/layouts/default.vue +5 -0
- package/app/layouts/docs.vue +15 -0
- package/app/pages/[[lang]]/[...slug].vue +145 -0
- package/app/plugins/i18n.ts +40 -0
- package/app/templates/landing.vue +44 -0
- package/app/types/index.d.ts +42 -0
- package/app/utils/navigation.ts +7 -0
- package/app/utils/prerender.ts +12 -0
- package/content.config.ts +67 -0
- package/i18n/locales/ar.json +22 -0
- package/i18n/locales/be.json +23 -0
- package/i18n/locales/bg.json +22 -0
- package/i18n/locales/bn.json +22 -0
- package/i18n/locales/ca.json +22 -0
- package/i18n/locales/ckb.json +18 -0
- package/i18n/locales/cs.json +22 -0
- package/i18n/locales/da.json +22 -0
- package/i18n/locales/de.json +22 -0
- package/i18n/locales/el.json +22 -0
- package/i18n/locales/en.json +22 -0
- package/i18n/locales/es.json +22 -0
- package/i18n/locales/et.json +22 -0
- package/i18n/locales/fi.json +22 -0
- package/i18n/locales/fr.json +22 -0
- package/i18n/locales/he.json +22 -0
- package/i18n/locales/hi.json +22 -0
- package/i18n/locales/hy.json +22 -0
- package/i18n/locales/it.json +22 -0
- package/i18n/locales/ja.json +22 -0
- package/i18n/locales/kk.json +22 -0
- package/i18n/locales/km.json +22 -0
- package/i18n/locales/ko.json +22 -0
- package/i18n/locales/ky.json +22 -0
- package/i18n/locales/lb.json +22 -0
- package/i18n/locales/ms.json +22 -0
- package/i18n/locales/nb.json +22 -0
- package/i18n/locales/nl.json +22 -0
- package/i18n/locales/pl.json +23 -0
- package/i18n/locales/ro.json +22 -0
- package/i18n/locales/ru.json +23 -0
- package/i18n/locales/sl.json +22 -0
- package/i18n/locales/sv.json +22 -0
- package/i18n/locales/uk.json +22 -0
- package/i18n/locales/ur.json +22 -0
- package/i18n/locales/vi.json +22 -0
- package/modules/config.ts +116 -0
- package/modules/css.ts +32 -0
- package/modules/routing.ts +41 -0
- package/nuxt.config.ts +84 -0
- package/nuxt.schema.ts +218 -0
- package/package.json +55 -0
- package/server/mcp/tools/get-page.ts +60 -0
- package/server/mcp/tools/list-pages.ts +60 -0
- package/server/routes/raw/[...slug].md.get.ts +45 -0
- package/server/utils/content.ts +37 -0
- package/utils/git.ts +110 -0
- package/utils/meta.ts +29 -0
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vkuttyp/docus",
|
|
3
|
+
"description": "Nuxt layer for Docus documentation theme",
|
|
4
|
+
"version": "5.4.6",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./nuxt.config.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/nuxt-content/docus.git"
|
|
10
|
+
},
|
|
11
|
+
"private": false,
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"files": [
|
|
14
|
+
"app",
|
|
15
|
+
"i18n",
|
|
16
|
+
"content.config.ts",
|
|
17
|
+
"modules",
|
|
18
|
+
"nuxt.config.ts",
|
|
19
|
+
"nuxt.schema.ts",
|
|
20
|
+
"server",
|
|
21
|
+
"utils",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@iconify-json/lucide": "^1.2.81",
|
|
26
|
+
"@iconify-json/simple-icons": "^1.2.63",
|
|
27
|
+
"@iconify-json/vscode-icons": "^1.2.37",
|
|
28
|
+
"@nuxt/content": "^3.9.0",
|
|
29
|
+
"@nuxt/image": "^2.0.0",
|
|
30
|
+
"@nuxt/kit": "^4.2.2",
|
|
31
|
+
"@nuxt/ui": "^4.3.0",
|
|
32
|
+
"@nuxtjs/i18n": "^10.2.1",
|
|
33
|
+
"@nuxtjs/mcp-toolkit": "^0.5.2",
|
|
34
|
+
"@nuxtjs/mdc": "^0.19.1",
|
|
35
|
+
"@nuxtjs/robots": "^5.6.7",
|
|
36
|
+
"@vueuse/core": "^13.9.0",
|
|
37
|
+
"defu": "^6.1.4",
|
|
38
|
+
"exsolve": "^1.0.8",
|
|
39
|
+
"git-url-parse": "^16.1.0",
|
|
40
|
+
"minimark": "^0.2.0",
|
|
41
|
+
"motion-v": "^1.7.4",
|
|
42
|
+
"nuxt-llms": "^0.1.3",
|
|
43
|
+
"nuxt-og-image": "^5.1.13",
|
|
44
|
+
"pkg-types": "^2.3.0",
|
|
45
|
+
"scule": "^1.3.0",
|
|
46
|
+
"tailwindcss": "^4.1.18",
|
|
47
|
+
"ufo": "^1.6.1",
|
|
48
|
+
"zod": "^4.2.1",
|
|
49
|
+
"zod-to-json-schema": "^3.25.0"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"better-sqlite3": "12.x",
|
|
53
|
+
"nuxt": "4.x"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { queryCollection } from '@nuxt/content/server'
|
|
3
|
+
import type { Collections } from '@nuxt/content'
|
|
4
|
+
import { getAvailableLocales, getCollectionFromPath } from '../../utils/content'
|
|
5
|
+
import { inferSiteURL } from '../../../utils/meta'
|
|
6
|
+
|
|
7
|
+
export default defineMcpTool({
|
|
8
|
+
description: `Retrieves the full content and details of a specific documentation page.
|
|
9
|
+
|
|
10
|
+
WHEN TO USE: Use this tool when you know the EXACT path to a documentation page. Common use cases:
|
|
11
|
+
- User asks for a specific page: "Show me the getting started guide" → /en/getting-started/installation
|
|
12
|
+
- User asks about a known topic with a dedicated page
|
|
13
|
+
- You found a relevant path from list-pages and want the full content
|
|
14
|
+
- User references a specific section or guide they want to read
|
|
15
|
+
|
|
16
|
+
WHEN NOT TO USE: If you don't know the exact path and need to search/explore, use list-pages first.
|
|
17
|
+
|
|
18
|
+
WORKFLOW: This tool returns the complete page content including title, description, and full markdown. Use this when you need to provide detailed answers or code examples from specific documentation pages.
|
|
19
|
+
`,
|
|
20
|
+
inputSchema: {
|
|
21
|
+
path: z.string().describe('The page path from list-pages or provided by the user (e.g., /en/getting-started/installation)'),
|
|
22
|
+
},
|
|
23
|
+
cache: '1h',
|
|
24
|
+
handler: async ({ path }) => {
|
|
25
|
+
const event = useEvent()
|
|
26
|
+
const config = useRuntimeConfig(event).public
|
|
27
|
+
const siteUrl = import.meta.dev ? 'http://localhost:3000' : inferSiteURL()
|
|
28
|
+
|
|
29
|
+
const availableLocales = getAvailableLocales(config)
|
|
30
|
+
const collectionName = config.i18n?.locales
|
|
31
|
+
? getCollectionFromPath(path, availableLocales)
|
|
32
|
+
: 'docs'
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const page = await queryCollection(event, collectionName as keyof Collections)
|
|
36
|
+
.where('path', '=', path)
|
|
37
|
+
.select('title', 'path', 'description')
|
|
38
|
+
.first()
|
|
39
|
+
|
|
40
|
+
if (!page) {
|
|
41
|
+
return errorResult('Page not found')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const content = await $fetch<string>(`/raw${path}.md`, {
|
|
45
|
+
baseURL: siteUrl,
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
return jsonResult({
|
|
49
|
+
title: page.title,
|
|
50
|
+
path: page.path,
|
|
51
|
+
description: page.description,
|
|
52
|
+
content,
|
|
53
|
+
url: `${siteUrl}${page.path}`,
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return errorResult('Failed to get page')
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { queryCollection } from '@nuxt/content/server'
|
|
3
|
+
import type { Collections } from '@nuxt/content'
|
|
4
|
+
import { getCollectionsToQuery, getAvailableLocales } from '../../utils/content'
|
|
5
|
+
|
|
6
|
+
export default defineMcpTool({
|
|
7
|
+
description: `Lists all available documentation pages with their categories and basic information.
|
|
8
|
+
|
|
9
|
+
WHEN TO USE: Use this tool when you need to EXPLORE or SEARCH for documentation about a topic but don't know the exact page path. Common scenarios:
|
|
10
|
+
- "Find documentation about markdown features" - explore available guides
|
|
11
|
+
- "Show me all getting started guides" - browse introductory content
|
|
12
|
+
- "Search for advanced configuration options" - find specific topics
|
|
13
|
+
- User asks general questions without specifying exact pages
|
|
14
|
+
- You need to understand the overall documentation structure
|
|
15
|
+
|
|
16
|
+
WHEN NOT TO USE: If you already know the specific page path (e.g., "/en/getting-started/installation"), use get-page directly instead.
|
|
17
|
+
|
|
18
|
+
WORKFLOW: This tool returns page titles, descriptions, and paths. After finding relevant pages, use get-page to retrieve the full content of specific pages that match the user's needs.
|
|
19
|
+
|
|
20
|
+
OUTPUT: Returns a structured list with:
|
|
21
|
+
- title: Human-readable page name
|
|
22
|
+
- path: Exact path for use with get-page
|
|
23
|
+
- description: Brief summary of page content
|
|
24
|
+
- url: Full URL for reference`,
|
|
25
|
+
inputSchema: {
|
|
26
|
+
locale: z.string().optional().describe('The locale to filter pages by'),
|
|
27
|
+
},
|
|
28
|
+
cache: '1h',
|
|
29
|
+
handler: async ({ locale }) => {
|
|
30
|
+
const event = useEvent()
|
|
31
|
+
const config = useRuntimeConfig(event).public
|
|
32
|
+
|
|
33
|
+
const siteUrl = import.meta.dev ? 'http://localhost:3000' : getRequestURL(event).origin
|
|
34
|
+
const availableLocales = getAvailableLocales(config)
|
|
35
|
+
const collections = getCollectionsToQuery(locale, availableLocales)
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const allPages = await Promise.all(
|
|
39
|
+
collections.map(async (collectionName) => {
|
|
40
|
+
const pages = await queryCollection(event, collectionName as keyof Collections)
|
|
41
|
+
.select('title', 'path', 'description')
|
|
42
|
+
.all()
|
|
43
|
+
|
|
44
|
+
return pages.map(page => ({
|
|
45
|
+
title: page.title,
|
|
46
|
+
path: page.path,
|
|
47
|
+
description: page.description,
|
|
48
|
+
locale: collectionName.replace('docs_', ''),
|
|
49
|
+
url: `${siteUrl}${page.path}`,
|
|
50
|
+
}))
|
|
51
|
+
}),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return jsonResult(allPages.flat())
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return errorResult('Failed to list pages')
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { withLeadingSlash } from 'ufo'
|
|
2
|
+
import { stringify } from 'minimark/stringify'
|
|
3
|
+
import { queryCollection } from '@nuxt/content/server'
|
|
4
|
+
import type { Collections } from '@nuxt/content'
|
|
5
|
+
|
|
6
|
+
export default eventHandler(async (event) => {
|
|
7
|
+
const slug = getRouterParams(event)['slug.md']
|
|
8
|
+
if (!slug?.endsWith('.md')) {
|
|
9
|
+
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const path = withLeadingSlash(slug.replace('.md', ''))
|
|
13
|
+
const config = useRuntimeConfig(event).public
|
|
14
|
+
|
|
15
|
+
let collectionName = 'docs'
|
|
16
|
+
if (config.i18n?.locales) {
|
|
17
|
+
const pathSegments = path.split('/').filter(Boolean)
|
|
18
|
+
const firstSegment = pathSegments[0]
|
|
19
|
+
|
|
20
|
+
const availableLocales = config.i18n.locales.map((locale: string | { code: string }) =>
|
|
21
|
+
typeof locale === 'string' ? locale : locale.code,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
if (firstSegment && availableLocales.includes(firstSegment)) {
|
|
25
|
+
collectionName = `docs_${firstSegment}`
|
|
26
|
+
}
|
|
27
|
+
else if (config.i18n.defaultLocale) {
|
|
28
|
+
collectionName = `docs_${config.i18n.defaultLocale}`
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const page = await queryCollection(event, collectionName as keyof Collections).path(path).first()
|
|
33
|
+
if (!page) {
|
|
34
|
+
throw createError({ statusCode: 404, statusMessage: 'Page not found', fatal: true })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Add title and description to the top of the page if missing
|
|
38
|
+
if (page.body.value[0]?.[0] !== 'h1') {
|
|
39
|
+
page.body.value.unshift(['blockquote', {}, page.description])
|
|
40
|
+
page.body.value.unshift(['h1', {}, page.title])
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
setHeader(event, 'Content-Type', 'text/markdown; charset=utf-8')
|
|
44
|
+
return stringify({ ...page.body, type: 'minimark' }, { format: 'markdown/html' })
|
|
45
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { LocaleObject } from '@nuxtjs/i18n'
|
|
2
|
+
|
|
3
|
+
type ConfigWithLocales = {
|
|
4
|
+
i18n?: { locales?: Array<string | LocaleObject> }
|
|
5
|
+
docus?: { filteredLocales?: LocaleObject<string>[] }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function getAvailableLocales(config: ConfigWithLocales): string[] {
|
|
9
|
+
if (config.docus?.filteredLocales) {
|
|
10
|
+
return config.docus.filteredLocales.map(locale => locale.code)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return config.i18n?.locales
|
|
14
|
+
? config.i18n.locales.map(locale => typeof locale === 'string' ? locale : locale.code)
|
|
15
|
+
: []
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getCollectionsToQuery(locale: string | undefined, availableLocales: string[]): string[] {
|
|
19
|
+
if (locale && availableLocales.includes(locale)) {
|
|
20
|
+
return [`docs_${locale}`]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return availableLocales.length > 0
|
|
24
|
+
? availableLocales.map(l => `docs_${l}`)
|
|
25
|
+
: ['docs']
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getCollectionFromPath(path: string, availableLocales: string[]): string {
|
|
29
|
+
const pathSegments = path.split('/').filter(Boolean)
|
|
30
|
+
const firstSegment = pathSegments[0]
|
|
31
|
+
|
|
32
|
+
if (firstSegment && availableLocales.includes(firstSegment)) {
|
|
33
|
+
return `docs_${firstSegment}`
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return 'docs'
|
|
37
|
+
}
|
package/utils/git.ts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
2
|
+
import { readGitConfig } from 'pkg-types'
|
|
3
|
+
import gitUrlParse from 'git-url-parse'
|
|
4
|
+
|
|
5
|
+
export interface GitInfo {
|
|
6
|
+
// Repository name
|
|
7
|
+
name: string
|
|
8
|
+
// Repository owner/organization
|
|
9
|
+
owner: string
|
|
10
|
+
// Repository URL
|
|
11
|
+
url: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function getGitBranch() {
|
|
15
|
+
const envName
|
|
16
|
+
= process.env.CF_PAGES_BRANCH
|
|
17
|
+
|| process.env.CI_COMMIT_BRANCH
|
|
18
|
+
|| process.env.VERCEL_GIT_COMMIT_REF
|
|
19
|
+
|| process.env.BRANCH
|
|
20
|
+
|| process.env.GITHUB_REF_NAME
|
|
21
|
+
|
|
22
|
+
if (envName && envName !== 'HEAD') {
|
|
23
|
+
return envName
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim()
|
|
27
|
+
if (branch && branch !== 'HEAD') {
|
|
28
|
+
return branch
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// Ignore error
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return 'main'
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export async function getLocalGitInfo(rootDir: string): Promise<GitInfo | undefined> {
|
|
39
|
+
const remote = await getLocalGitRemote(rootDir)
|
|
40
|
+
if (!remote) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// https://www.npmjs.com/package/git-url-parse#clipboard-example
|
|
45
|
+
const { name, owner, source } = gitUrlParse(remote)
|
|
46
|
+
const url = `https://${source}/${owner}/${name}`
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
name,
|
|
50
|
+
owner,
|
|
51
|
+
url,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function getLocalGitRemote(dir: string): Promise<string | undefined> {
|
|
56
|
+
try {
|
|
57
|
+
const parsed = await readGitConfig(dir)
|
|
58
|
+
if (!parsed) {
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
return parsed.remote?.['origin']?.url
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
// Ignore error
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function getGitEnv(): GitInfo {
|
|
69
|
+
// https://github.com/unjs/std-env/issues/59
|
|
70
|
+
const envInfo = {
|
|
71
|
+
// Provider
|
|
72
|
+
provider: process.env.VERCEL_GIT_PROVIDER // vercel
|
|
73
|
+
|| (process.env.GITHUB_SERVER_URL ? 'github' : undefined) // github
|
|
74
|
+
|| '',
|
|
75
|
+
// Owner
|
|
76
|
+
owner: process.env.VERCEL_GIT_REPO_OWNER // vercel
|
|
77
|
+
|| process.env.GITHUB_REPOSITORY_OWNER // github
|
|
78
|
+
|| process.env.CI_PROJECT_PATH?.split('/').shift() // gitlab
|
|
79
|
+
|| '',
|
|
80
|
+
// Name
|
|
81
|
+
name: process.env.VERCEL_GIT_REPO_SLUG
|
|
82
|
+
|| process.env.GITHUB_REPOSITORY?.split('/').pop() // github
|
|
83
|
+
|| process.env.CI_PROJECT_PATH?.split('/').splice(1).join('/') // gitlab
|
|
84
|
+
|| '',
|
|
85
|
+
// Url
|
|
86
|
+
url: process.env.REPOSITORY_URL || '', // netlify
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!envInfo.url && envInfo.provider && envInfo.owner && envInfo.name) {
|
|
90
|
+
envInfo.url = `https://${envInfo.provider}.com/${envInfo.owner}/${envInfo.name}`
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// If only url available (ex: Netlify)
|
|
94
|
+
if (!envInfo.name && !envInfo.owner && envInfo.url) {
|
|
95
|
+
try {
|
|
96
|
+
const { name, owner } = gitUrlParse(envInfo.url)
|
|
97
|
+
envInfo.name = name
|
|
98
|
+
envInfo.owner = owner
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
// Ignore error
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
name: envInfo.name,
|
|
107
|
+
owner: envInfo.owner,
|
|
108
|
+
url: envInfo.url,
|
|
109
|
+
}
|
|
110
|
+
}
|
package/utils/meta.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises'
|
|
2
|
+
import { resolve } from 'node:path'
|
|
3
|
+
|
|
4
|
+
export function inferSiteURL() {
|
|
5
|
+
// https://github.com/unjs/std-env/issues/59
|
|
6
|
+
return (
|
|
7
|
+
process.env.NUXT_SITE_URL
|
|
8
|
+
|| (process.env.NEXT_PUBLIC_VERCEL_URL && `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`) // Vercel
|
|
9
|
+
|| process.env.URL // Netlify
|
|
10
|
+
|| process.env.CI_PAGES_URL // Gitlab Pages
|
|
11
|
+
|| process.env.CF_PAGES_URL // Cloudflare Pages
|
|
12
|
+
)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function getPackageJsonMetadata(dir: string) {
|
|
16
|
+
try {
|
|
17
|
+
const packageJson = await readFile(resolve(dir, 'package.json'), 'utf-8')
|
|
18
|
+
const parsed = JSON.parse(packageJson)
|
|
19
|
+
return {
|
|
20
|
+
name: parsed.name,
|
|
21
|
+
description: parsed.description,
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return {
|
|
26
|
+
name: 'docs',
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|