Skip to content

Commit

Permalink
diff-npm-package: polish reports dir creation (graphql#3624)
Browse files Browse the repository at this point in the history
graphql#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.
  • Loading branch information
yaacovCR authored Jun 2, 2022
1 parent baf9e4f commit 540bb38
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions resources/diff-npm-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 540bb38

Please sign in to comment.