0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-05-12 15:41:58 +00:00
renovatebot_renovate/tools/static-data/utils.mjs

16 lines
412 B
JavaScript

import fs from 'fs-extra';
/**
* Update given file with new provided data.
* @param {string} file Path to a data file
* @param {string|NodeJS.ArrayBufferView} 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);
}
}