@@ -5,10 +5,10 @@ import { readdir } from "node:fs/promises";
5
5
6
6
// Export the commands
7
7
try {
8
- await $ `anyquery tool generate-doc Commands` ;
8
+ await $ `anyquery tool generate-doc Commands` ;
9
9
} catch ( error ) {
10
- // In case it's a build machine, anyquery might not be installed
11
- await $ `../../../../../../main.out tool generate-doc Commands` ;
10
+ // In case it's a build machine, anyquery might not be installed
11
+ await $ `../../../../../../main.out tool generate-doc Commands` ;
12
12
}
13
13
14
14
// For each file, take the lop level h2 header, and add the frontmatter
@@ -17,28 +17,28 @@ try {
17
17
const files = await readdir ( "Commands" ) ;
18
18
19
19
for ( const file of files ) {
20
- const fileContent = Bun . file ( `Commands/${ file } ` ) ;
21
- let text = await fileContent . text ( ) ;
20
+ const fileContent = Bun . file ( `Commands/${ file } ` ) ;
21
+ let text = await fileContent . text ( ) ;
22
22
23
- const title = text . match ( / # # ( .* ) / ) [ 1 ] ;
24
- // Strip the title from the markdown
25
- text = text . replace ( `## ${ title } \n\n` , "" ) ;
23
+ const title = text . match ( / # # ( .* ) / ) [ 1 ] ;
24
+ // Strip the title from the markdown
25
+ text = text . replace ( `## ${ title } \n\n` , "" ) ;
26
26
27
- // Strip the last two lines
28
- text = text . split ( "\n" ) . slice ( 0 , - 2 ) . join ( "\n" ) ;
27
+ // Strip the last two lines
28
+ text = text . split ( "\n" ) . slice ( 0 , - 2 ) . join ( "\n" ) ;
29
29
30
- // Rewrite the links that ends with .md
31
- text = text . replace ( / \( ( [ ^ ) ] + ) .m d \) / g, "(../$1)" ) ;
30
+ // Rewrite the links that ends with .md
31
+ text = text . replace ( / \( ( [ ^ ) ] + ) .m d \) / g, "(../$1)" ) ;
32
32
33
- // Change the code blocks to be in the right language
34
- text = text . replace ( / ` ` ` \n (? ! \s * $ ) / gm, "```bash\n" ) ;
33
+ // Change the code blocks to be in the right language
34
+ text = text . replace ( / ` ` ` \n (? ! \s * $ ) / gm, "```bash\n" ) ;
35
35
36
- const frontmatter = `---
36
+ const frontmatter = `---
37
37
title: ${ title }
38
- description: Learn how to use the ${ title } command in AnyQuery .
38
+ description: Learn how to use the ${ title } command in Anyquery .
39
39
---
40
40
41
41
` ;
42
- console . log ( `Writing ${ title } to ${ file } ` ) ;
43
- await Bun . write ( `Commands/${ file } ` , frontmatter + text ) ;
42
+ console . log ( `Writing ${ title } to ${ file } ` ) ;
43
+ await Bun . write ( `Commands/${ file } ` , frontmatter + text ) ;
44
44
}
0 commit comments