From: Eduardo San Martin Morote Date: Tue, 31 Aug 2021 21:37:04 +0000 (+0200) Subject: docs: fix api build X-Git-Tag: @pinia/nuxt@0.0.2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ea5a98514aa1ffc38961e9dd509047dfdfde1d15;p=thirdparty%2Fvuejs%2Fpinia.git docs: fix api build --- diff --git a/packages/docs/typedoc-markdown.js b/packages/docs/typedoc-markdown.js index 75453e3e..91a3afa0 100644 --- a/packages/docs/typedoc-markdown.js +++ b/packages/docs/typedoc-markdown.js @@ -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 + } +}