From 7d5cce33ee6947718719fe103a5487eb2bda287d Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Tue, 27 Jul 2021 13:06:41 -0700 Subject: [PATCH 1/2] build: ensure distDir is present before emptying it --- build/build-dt-report-resources.js | 3 ++- build/gh-pages-app.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build/build-dt-report-resources.js b/build/build-dt-report-resources.js index 9f1e9d853119..bef2caf0f403 100644 --- a/build/build-dt-report-resources.js +++ b/build/build-dt-report-resources.js @@ -26,8 +26,9 @@ function writeFile(name, content) { fs.writeFileSync(`${distDir}/${name}`, content); } +fs.mkdirSync(distDir, {recursive: true}); // Ensure dist is present, else rmdir will throw fs.rmdirSync(distDir, {recursive: true}); -fs.mkdirSync(distDir); +fs.mkdirSync(distDir, {recursive: true}); writeFile('report.js', htmlReportAssets.REPORT_JAVASCRIPT); writeFile('report.css', htmlReportAssets.REPORT_CSS); diff --git a/build/gh-pages-app.js b/build/gh-pages-app.js index e9c5931a634f..ad297942a37b 100644 --- a/build/gh-pages-app.js +++ b/build/gh-pages-app.js @@ -80,6 +80,7 @@ class GhPagesApp { } async build() { + fs.mkdirSync(this.distDir, {recursive: true}); // Ensure dist is present, else rmdir will throw fs.rmdirSync(this.distDir, {recursive: true}); const html = this._compileHtml(); From 1c9b538e83c610b18678fe63314c4081fa7b3281 Mon Sep 17 00:00:00 2001 From: Paul Irish Date: Tue, 27 Jul 2021 13:47:33 -0700 Subject: [PATCH 2/2] compat comment about fs.rm --- build/build-dt-report-resources.js | 2 +- build/gh-pages-app.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/build-dt-report-resources.js b/build/build-dt-report-resources.js index bef2caf0f403..2ece8729a5ba 100644 --- a/build/build-dt-report-resources.js +++ b/build/build-dt-report-resources.js @@ -26,7 +26,7 @@ function writeFile(name, content) { fs.writeFileSync(`${distDir}/${name}`, content); } -fs.mkdirSync(distDir, {recursive: true}); // Ensure dist is present, else rmdir will throw +fs.mkdirSync(distDir, {recursive: true}); // Ensure dist is present, else rmdir will throw. COMPAT: when dropping Node 12, replace with fs.rm(p, {force: true}) fs.rmdirSync(distDir, {recursive: true}); fs.mkdirSync(distDir, {recursive: true}); diff --git a/build/gh-pages-app.js b/build/gh-pages-app.js index ad297942a37b..06268cc5a54a 100644 --- a/build/gh-pages-app.js +++ b/build/gh-pages-app.js @@ -80,7 +80,7 @@ class GhPagesApp { } async build() { - fs.mkdirSync(this.distDir, {recursive: true}); // Ensure dist is present, else rmdir will throw + fs.mkdirSync(this.distDir, {recursive: true}); // Ensure dist is present, else rmdir will throw. COMPAT: when dropping Node 12, replace with fs.rm(p, {force: true}) fs.rmdirSync(this.distDir, {recursive: true}); const html = this._compileHtml();