File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -22,5 +22,6 @@ docs/.vitepress/dist
2222docs /.vitepress /cache
2323
2424/docs /api
25+ /docs /_config.json
2526
2627vite.config.ts.timestamp- *
Original file line number Diff line number Diff line change @@ -102,12 +102,12 @@ async function* traverseDirectory(
102102
103103export const buildEnd = async ( ) => {
104104 if ( ! useMirror ) return ;
105- const baseDir = posixPath ( process . cwd ( ) + '/.vitepress/dist' ) ;
105+ const distDir = posixPath ( process . cwd ( ) + '/.vitepress/dist' ) ;
106106 const relativePath = ( v : string ) => {
107- return v . substring ( baseDir . length ) ;
107+ return v . substring ( distDir . length ) ;
108108 } ;
109109 const htmlUrlMap : Record < string , string > = { } ;
110- for await ( const filePathName of traverseDirectory ( baseDir ) ) {
110+ for await ( const filePathName of traverseDirectory ( distDir ) ) {
111111 if ( filePathName . endsWith ( '.html' ) ) {
112112 const textFileName = filePathName . replace ( / \. h t m l $ / , '_.md' ) ;
113113 await fs . copyFile ( filePathName , textFileName ) ;
@@ -121,16 +121,16 @@ export const buildEnd = async () => {
121121 htmlUrlMap [ k . replace ( / \. h t m l $ / , '' ) ] = htmlUrlMap [ k ] ;
122122 }
123123 } ) ;
124- await fs . writeFile (
125- baseDir + '/_config.json' ,
126- JSON . stringify (
127- {
128- htmlUrlMap,
129- } ,
130- undefined ,
131- 2 ,
132- ) ,
124+ const configFileRelativePath = '/_config.json' ;
125+ const configText = JSON . stringify (
126+ {
127+ htmlUrlMap,
128+ } ,
129+ undefined ,
130+ 2 ,
133131 ) ;
132+ await fs . writeFile ( distDir + configFileRelativePath , configText ) ;
133+ await fs . writeFile ( process . cwd ( ) + configFileRelativePath , configText ) ;
134134} ;
135135
136136const Parser =
You can’t perform that action at this time.
0 commit comments