]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
docs: fix api build
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 31 Aug 2021 21:37:04 +0000 (23:37 +0200)
committerEduardo San Martin Morote <posva@users.noreply.github.com>
Tue, 31 Aug 2021 21:40:26 +0000 (23:40 +0200)
packages/docs/typedoc-markdown.js

index 75453e3e5dbb791f74ca399c3c29ab409a9a8924..91a3afa063a783f7147328f8451f4cb17b17c735 100644 (file)
@@ -58,7 +58,10 @@ exports.createTypeDocApp = function createTypeDocApp(config = {}) {
   }
 
   async function build() {
-    if ((await fs.stat(options.out)).isDirectory()) {
+    if (
+      (await exists(options.out)) &&
+      (await fs.stat(options.out)).isDirectory()
+    ) {
       await fs.rm(options.out, { recursive: true })
     }
     app.bootstrap(options)
@@ -96,3 +99,12 @@ exports.createTypeDocApp = function createTypeDocApp(config = {}) {
     },
   }
 }
+
+async function exists(path) {
+  try {
+    await fs.access(path)
+    return true
+  } catch {
+    return false
+  }
+}