From ae542865a85c8d20ff1da5ce1994209835984244 Mon Sep 17 00:00:00 2001 From: Yaacov Rydzinski Date: Wed, 1 Jun 2022 21:13:07 +0300 Subject: [PATCH] diff-npm-package: polish reports dir creation #3623 creates the reports folder via the report path, rather than the reports folder path. This did not trigger an error, because no changes were found. --- resources/diff-npm-package.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/diff-npm-package.ts b/resources/diff-npm-package.ts index dabf2cb2b7..47ec08a883 100644 --- a/resources/diff-npm-package.ts +++ b/resources/diff-npm-package.ts @@ -32,10 +32,11 @@ const diff = execOutput(`npm diff --diff=${fromPackage} --diff=${toPackage}`); if (diff === '') { console.log('No changes found!'); } else { - const reportPath = localRepoPath('reports', 'npm-dist-diff.html'); - if (!fs.existsSync(reportPath)) { - fs.mkdirSync(reportPath); + const reportsDir = localRepoPath('reports'); + if (!fs.existsSync(reportsDir)) { + fs.mkdirSync(reportsDir); } + const reportPath = path.join(reportsDir, 'npm-dist-diff.html'); fs.writeFileSync(reportPath, generateReport(diff)); console.log('Report saved to: ', reportPath); }