@@ -5,6 +5,7 @@ import ejs from "#core/ejs";
5
5
import env from "#core/env" ;
6
6
import File from "#core/file" ;
7
7
import FileTree from "#core/file-tree" ;
8
+ import { exists } from "#core/fs" ;
8
9
import glob from "#core/glob" ;
9
10
import Markdown from "#core/markdown" ;
10
11
import ansi from "#core/text/ansi" ;
@@ -166,7 +167,7 @@ export default class Docs {
166
167
const fileTree = new FileTree ( ) ;
167
168
168
169
// generate README.md
169
- if ( ! fs . existsSync ( this . locationPath + "/README.md" ) ) {
170
+ if ( ! ( await exists ( this . locationPath + "/README.md" ) ) ) {
170
171
const readmeTmpl = utils . resolve ( "#resources/templates/docs/README-default.md" , import . meta. url ) ;
171
172
172
173
if ( this . location !== "/" ) {
@@ -180,7 +181,7 @@ export default class Docs {
180
181
else {
181
182
182
183
// copy root readme
183
- if ( fs . existsSync ( this . #package. root + "/README.md" ) ) {
184
+ if ( await exists ( this . #package. root + "/README.md" ) ) {
184
185
fileTree . add ( {
185
186
"path" : "README.md" ,
186
187
"buffer" : fs . readFileSync ( this . #package. root + "/README.md" ) ,
@@ -198,7 +199,7 @@ export default class Docs {
198
199
}
199
200
200
201
// generate default sidebar
201
- if ( ! fs . existsSync ( this . locationPath + "/_sidebar.md" ) ) {
202
+ if ( ! ( await exists ( this . locationPath + "/_sidebar.md" ) ) ) {
202
203
fileTree . add ( {
203
204
"path" : "_sidebar.md" ,
204
205
"buffer" : await ejs . renderFile ( utils . resolve ( "#resources/templates/docs/_sidebar.md" , import . meta. url ) , options ) ,
@@ -288,7 +289,7 @@ export default class Docs {
288
289
async #buildReadme ( options ) {
289
290
const readmePath = this . locationPath + "/README.md" ;
290
291
291
- if ( this . location === "/" || options . generateReadme === false || ! fs . existsSync ( readmePath ) ) return ;
292
+ if ( this . location === "/" || options . generateReadme === false || ! ( await exists ( readmePath ) ) ) return ;
292
293
293
294
const template = utils . resolve ( "#resources/templates/docs/README-wrapper.md.ejs" , import . meta. url ) ,
294
295
fileTree = new FileTree ( ) ;
0 commit comments