0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-11 05:39:10 +00:00
renovatebot_renovate/tools/static-data/utils.mjs
2023-04-28 12:17:48 +00:00

16 lines
389 B
JavaScript

import fs from 'fs-extra';
/**
* Update given file with new provided data.
* @param {string} file Path to a data file
* @param {string} newData New data to be written
*/
export async function updateJsonFile(file, newData) {
try {
console.log(`Updating ${file}`);
await fs.writeFile(file, newData);
} catch (e) {
console.error(e.toString());
process.exit(1);
}
}