Skip to content

Commit

Permalink
πŸ‘½οΈ Use improved docs page for ortfo/db cli correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gwennlbh committed Apr 15, 2024
1 parent 3162da0 commit 977ae8b
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 75 deletions.
14 changes: 10 additions & 4 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,16 @@ const ortfodbSidebar = [
collapsed: true,
items: [
{ text: "Global options", link: "/db/commands/global-options" },
...subcommand.paths().map(({ params: { subcommand } }) => ({
text: subcommand.replace("-", " "),
link: `/db/commands/${subcommand}`,
})),
...subcommand
.paths()
.filter(
({ params: { subcommand } }) =>
!["README", "global-options"].includes(subcommand)
)
.map(({ params: { subcommand } }) => ({
text: subcommand.replace("-", " "),
link: `/db/commands/${subcommand}`,
})),
],
},
{
Expand Down
4 changes: 1 addition & 3 deletions db/commands/[subcommand].data.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { createContentLoader } from "vitepress"
import transformer from "./transformer"

export default createContentLoader("ortfodb/docs/ortfodb_*.md", {
export default createContentLoader("ortfodb/docs/*.md", {
render: true,
transform: transformer,
})
2 changes: 1 addition & 1 deletion db/commands/[subcommand].md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ editLink: false
</script>

<main v-html="
commands.find(command => command.url.endsWith(`ortfodb_${$params.subcommand.replaceAll('-', '_')}`)).html
commands.find(command => command.url.endsWith($params.subcommand)).html
">
</main>
17 changes: 4 additions & 13 deletions db/commands/[subcommand].paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@ import { readdirSync } from "node:fs"
import path from "node:path"

export default {
paths() {
const files = readdirSync("ortfodb/docs")
.map((entry) => path.basename(entry))
.filter((name) => name.startsWith("ortfodb_") && name.endsWith(".md"))
.map((name) =>
path
.basename(name, ".md")
.replace(/^ortfodb_/, "")
.replace(/_/g, "-")
)

return files.map((file) => ({ params: { subcommand: file } }))
},
paths: () =>
readdirSync("ortfodb/docs").map((file) => ({
params: { subcommand: path.basename(file, ".md") },
})),
}
Empty file removed db/commands/completion.md
Empty file.
7 changes: 0 additions & 7 deletions db/commands/global-options.data.js

This file was deleted.

5 changes: 0 additions & 5 deletions db/commands/global-options.md

This file was deleted.

40 changes: 0 additions & 40 deletions db/commands/transformer.js

This file was deleted.

2 changes: 1 addition & 1 deletion ortfodb
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"favicons:generate": "real-favicon generate favicon.json .favicon-data.json public/ ",
"favicons:inject": "cp .vitepress/favicon.ts public/favicon.ts && real-favicon inject .favicon-data.json public favicon.ts && mv public/favicon.ts .vitepress/",
"jsonschemas:copy": "./copy-all-schemas",
"submodules:pull": "git submodule update --init --recursive && git submodule foreach git pull origin main"
"submodules:pull": "git submodule sync"
},
"devDependencies": {
"@types/json-schema": "^7.0.15",
Expand Down

0 comments on commit 977ae8b

Please sign in to comment.