undocs 0.2.0 → 0.2.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.
package/bin/cli.mjs
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
export default defineNitroPlugin((nitroApp) => {
|
|
2
2
|
nitroApp.hooks.hook('content:file:afterParse', (file) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
// Filter out non-markdown files
|
|
4
|
+
if (!file._id.endsWith('.md')) {
|
|
5
|
+
return
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// Remove first h1 from markdown files as it is added to front-matter as title
|
|
9
|
+
if (file.body?.children?.[0]?.tag === 'h1' && file.title === file.body.children[0].children?.[0]?.value) {
|
|
10
|
+
file.body.children.shift()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Only use the first blockquote as the description
|
|
14
|
+
const firstChild = file.body.children?.[0]
|
|
15
|
+
const firstChildContent = firstChild?.children?.[0]?.children?.[0]?.value
|
|
16
|
+
if (firstChild.tag === 'blockquote' && firstChildContent) {
|
|
17
|
+
file.description = firstChildContent
|
|
18
|
+
file.body.children.shift()
|
|
19
|
+
} else {
|
|
20
|
+
file.description = '' // Avoid duplication
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Handle GitHub flavoured markdown blockquotes
|
|
24
|
+
// https://github.com/orgs/community/discussions/16925
|
|
25
|
+
for (const node of file.body?.children || []) {
|
|
26
|
+
if (
|
|
27
|
+
node.tag === 'blockquote' && // bloquote > p x 2 > span > text
|
|
28
|
+
['!NOTE', '!TIP', '!IMPORTANT', '!WARNING', '!CAUTION'].includes(
|
|
29
|
+
node.children?.[0]?.children?.[0]?.children?.[0]?.value,
|
|
30
|
+
)
|
|
31
|
+
) {
|
|
32
|
+
node.type = 'element'
|
|
33
|
+
node.tag = node.children?.[0]?.children?.[0]?.children?.[0]?.value.slice(1).toLowerCase()
|
|
34
|
+
node.children[0].children.shift()
|
|
24
35
|
}
|
|
25
36
|
}
|
|
26
37
|
})
|
package/layers/core/cli/cli.ts
CHANGED
|
@@ -25,7 +25,7 @@ export function createCLI(opts: DocsCLIOptions = {}) {
|
|
|
25
25
|
},
|
|
26
26
|
args: { ...sharedArgs },
|
|
27
27
|
async setup({ args }) {
|
|
28
|
-
const { appDir, nuxtConfig } = await setupDocs(args.dir, opts.setup)
|
|
28
|
+
const { appDir, nuxtConfig } = await setupDocs(args.dir, { ...opts.setup, dev: true })
|
|
29
29
|
process.chdir(appDir)
|
|
30
30
|
await import('nuxi').then((nuxi) =>
|
|
31
31
|
nuxi.runCommand('dev', [appDir, '--no-fork', '--port', '4000'], { overrides: nuxtConfig }),
|
package/layers/core/cli/setup.ts
CHANGED
|
@@ -10,6 +10,7 @@ const pkgDir = fileURLToPath(new URL('../../..', import.meta.url))
|
|
|
10
10
|
|
|
11
11
|
export interface SetupDocsOptions {
|
|
12
12
|
defaults?: DocsConfig
|
|
13
|
+
dev?: boolean
|
|
13
14
|
extends?: string[]
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -21,7 +22,7 @@ export async function setupDocs(docsDir: string, opts: SetupDocsOptions = {}) {
|
|
|
21
22
|
docsconfig.dir = docsDir = resolve(docsconfig.dir || docsDir)
|
|
22
23
|
|
|
23
24
|
// URL is required for production build (SEO)
|
|
24
|
-
if (!docsconfig.url) {
|
|
25
|
+
if (!docsconfig.url && !opts.dev) {
|
|
25
26
|
throw new Error('`url` config is required for production build!')
|
|
26
27
|
}
|
|
27
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "undocs",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"repository": "unjs/undocs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,24 +27,25 @@
|
|
|
27
27
|
"undocs": "./bin/cli.mjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nuxt/content": "^2.
|
|
30
|
+
"@nuxt/content": "^2.12.0",
|
|
31
31
|
"@nuxt/ui": "^2.13.0",
|
|
32
32
|
"@nuxt/ui-pro": "^0.7.5",
|
|
33
33
|
"@nuxthq/studio": "^1.0.10",
|
|
34
34
|
"@nuxtjs/fontaine": "^0.4.1",
|
|
35
35
|
"@nuxtjs/google-fonts": "^3.1.3",
|
|
36
36
|
"@nuxtjs/plausible": "^0.2.4",
|
|
37
|
-
"@nuxtjs/seo": "^2.0.0-rc.
|
|
38
|
-
"@nuxtjs/tailwindcss": "^6.11.
|
|
39
|
-
"c12": "^1.
|
|
37
|
+
"@nuxtjs/seo": "^2.0.0-rc.8",
|
|
38
|
+
"@nuxtjs/tailwindcss": "^6.11.3",
|
|
39
|
+
"c12": "^1.7.0",
|
|
40
40
|
"citty": "^0.1.5",
|
|
41
41
|
"consola": "^3.2.3",
|
|
42
42
|
"defu": "^6.1.4",
|
|
43
43
|
"is-buffer": "^2.0.5",
|
|
44
44
|
"nuxi": "^3.10.0",
|
|
45
|
-
"nuxt": "^3.10.
|
|
45
|
+
"nuxt": "^3.10.1",
|
|
46
|
+
"nuxt-build-cache": "^0.1.1",
|
|
46
47
|
"pkg-types": "^1.0.3",
|
|
47
|
-
"scule": "^1.
|
|
48
|
+
"scule": "^1.3.0",
|
|
48
49
|
"tailwindcss": "^3.4.1",
|
|
49
50
|
"theme-colors": "^0.1.0",
|
|
50
51
|
"unstorage": "^1.10.1",
|
|
@@ -58,9 +59,9 @@
|
|
|
58
59
|
"eslint": "^8.56.0",
|
|
59
60
|
"eslint-config-unjs": "^0.2.1",
|
|
60
61
|
"jiti": "^1.21.0",
|
|
61
|
-
"prettier": "^3.2.
|
|
62
|
+
"prettier": "^3.2.5",
|
|
62
63
|
"typescript": "^5.3.3",
|
|
63
64
|
"vue-tsc": "^1.8.27"
|
|
64
65
|
},
|
|
65
|
-
"packageManager": "bun@1.0.
|
|
66
|
-
}
|
|
66
|
+
"packageManager": "bun@1.0.26"
|
|
67
|
+
}
|