@@ -2,8 +2,8 @@ import { DefaultTheme, defineConfig, HeadConfig } from "vitepress"
2
2
import footnote from "markdown-it-footnote"
3
3
import deflists from "markdown-it-deflist"
4
4
import { faviconHead } from "./favicon"
5
- import subcommand from "../db/commands/[subcommand].paths"
6
5
import { seoTags } from "./seo"
6
+ import { readdirSync } from "node:fs"
7
7
8
8
const ortfodbSidebar = [
9
9
{
@@ -140,16 +140,15 @@ const ortfodbSidebar = [
140
140
collapsed : true ,
141
141
items : [
142
142
{ text : "Global options" , link : "/db/commands/global-options" } ,
143
- ...subcommand
144
- . paths ( )
145
- . filter (
146
- ( { params : { subcommand } } ) =>
147
- ! [ "README" , "global-options" ] . includes ( subcommand )
148
- )
149
- . map ( ( { params : { subcommand } } ) => ( {
150
- text : subcommand . replace ( "-" , " " ) ,
151
- link : `/db/commands/${ subcommand } ` ,
152
- } ) ) ,
143
+ ...readdirSync ( "db/commands" )
144
+ . map ( ( file ) => {
145
+ const name = file . replace ( / \. m d $ / , "" )
146
+ return {
147
+ text : `ortfodb ${ name . replace ( / - / g, " " ) } ` ,
148
+ link : `/db/commands/${ name } ` ,
149
+ }
150
+ } )
151
+ . filter ( ( { link } ) => link !== "/db/commands/global-options" ) ,
153
152
] ,
154
153
} ,
155
154
@@ -188,7 +187,7 @@ export default defineConfig({
188
187
lang : "en-US" ,
189
188
title : "ortfo" ,
190
189
description : "Make & manage your own homemade portfolio easily" ,
191
- srcExclude : [ "**/README.md" , "ortfodb/**/*.md" ] ,
190
+ srcExclude : [ "**/README.md" , "ortfodb/**/*.md" , "ortfodb/docs/" ] ,
192
191
head : [
193
192
[
194
193
"link" ,
@@ -232,7 +231,13 @@ export default defineConfig({
232
231
} ,
233
232
} ,
234
233
editLink : {
235
- pattern : "https://github.com/ortfo/website/edit/main/:path" ,
234
+ pattern : ( { filePath } ) =>
235
+ filePath . startsWith ( "db/" )
236
+ ? `https://github.com/ortfo/db/edit/main/docs/${ filePath . replace (
237
+ / ^ d b \/ / ,
238
+ ""
239
+ ) } `
240
+ : `https://github.com/ortfo/website/edit/main/${ filePath } ` ,
236
241
} ,
237
242
logo : {
238
243
dark : "/logo-dark.svg" ,
0 commit comments