From 140a118dda67cbf9d9ce62ba0eac1ad0efd13154 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Mon, 27 Nov 2023 14:53:43 -0500 Subject: [PATCH] chore: correctly clean relative to version path --- scripts/website.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/website.js b/scripts/website.js index eaabea581bc..50cfaf4d767 100644 --- a/scripts/website.js +++ b/scripts/website.js @@ -79,22 +79,24 @@ const tests = [ function deleteAllHtmlFiles() { try { - fs.unlinkSync('./index.html'); + console.log('Delete', path.join(versionObj.versionedPath, 'index.html')); + fs.unlinkSync(path.join(versionObj.versionedPath, 'index.html')); } catch (err) { if (err.code !== 'ENOENT') { throw err; } } const foldersToClean = [ - './docs', - './docs/tutorials', - './docs/typescript', - './docs/api', - './docs/source/_docs', + path.join('.', versionObj.versionedPath, 'docs'), + path.join('.', versionObj.versionedPath, 'docs', 'tutorials'), + path.join('.', versionObj.versionedPath, 'docs', 'typescript'), + path.join('.', versionObj.versionedPath, 'docs', 'api'), + path.join('.', versionObj.versionedPath, 'docs', 'source', '_docs'), './tmp' ]; for (const folder of foldersToClean) { let files = []; + try { files = fs.readdirSync(folder); } catch (err) { @@ -104,7 +106,8 @@ function deleteAllHtmlFiles() { } for (const file of files) { if (file.endsWith('.html')) { - fs.unlinkSync(`${folder}/${file}`); + console.log('Delete', path.join(folder, file)); + fs.unlinkSync(path.join(folder, file)); } } }