Skip to content

Commit 90e4a14

Browse files
committed
fix(git-node): simplify vulnerabilities.json creation, add missing EOL
1 parent 5034b4f commit 90e4a14

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

lib/prepare_security.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,19 @@ export default class PrepareSecurityRelease extends SecurityRelease {
203203
}
204204

205205
async createVulnerabilitiesJSON(reports, dependencies, releaseDate) {
206-
this.cli.separator('Creating vulnerabilities.json...');
207-
const file = JSON.stringify({
206+
this.cli.startSpinner('Creating vulnerabilities.json...');
207+
const fileContent = JSON.stringify({
208208
releaseDate,
209209
reports,
210210
dependencies
211-
}, null, 2);
211+
}, null, 2) + '\n';
212212

213-
const folderPath = path.join(process.cwd(), NEXT_SECURITY_RELEASE_FOLDER);
214-
try {
215-
fs.accessSync(folderPath);
216-
} catch (error) {
217-
fs.mkdirSync(folderPath, { recursive: true });
218-
}
213+
const folderPath = path.resolve(NEXT_SECURITY_RELEASE_FOLDER);
214+
await fs.promises.mkdir(folderPath, { recursive: true });
219215

220216
const fullPath = path.join(folderPath, 'vulnerabilities.json');
221-
fs.writeFileSync(fullPath, file);
222-
this.cli.ok(`Created ${fullPath} `);
217+
await fs.promises.writeFile(fullPath, fileContent);
218+
this.cli.stopSpinner(`Created ${fullPath}`);
223219

224220
return fullPath;
225221
}

0 commit comments

Comments
 (0)