Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions lib/prepare_security.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,23 +203,19 @@ export default class PrepareSecurityRelease extends SecurityRelease {
}

async createVulnerabilitiesJSON(reports, dependencies, releaseDate) {
this.cli.separator('Creating vulnerabilities.json...');
const file = JSON.stringify({
this.cli.startSpinner('Creating vulnerabilities.json...');
const fileContent = JSON.stringify({
releaseDate,
reports,
dependencies
}, null, 2);
}, null, 2) + '\n';

const folderPath = path.join(process.cwd(), NEXT_SECURITY_RELEASE_FOLDER);
try {
fs.accessSync(folderPath);
} catch (error) {
fs.mkdirSync(folderPath, { recursive: true });
}
const folderPath = path.resolve(NEXT_SECURITY_RELEASE_FOLDER);
await fs.promises.mkdir(folderPath, { recursive: true });

const fullPath = path.join(folderPath, 'vulnerabilities.json');
fs.writeFileSync(fullPath, file);
this.cli.ok(`Created ${fullPath} `);
await fs.promises.writeFile(fullPath, fileContent);
this.cli.stopSpinner(`Created ${fullPath}`);

return fullPath;
}
Expand Down
Loading