Files
renovate/tools/static-data/utils.mjs
T
Michael Kriese 59dc8f64ba build: add node schedule updater (#17181)
* build: add node schedule updater

* ci: update generation job
2022-08-15 12:18:51 +02:00

18 lines
412 B
JavaScript

import fs from 'fs-extra';
import shell from 'shelljs';
/**
* 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 {
shell.echo(`Updating ${file}`);
await fs.writeFile(file, newData);
} catch (e) {
shell.echo(e.toString());
shell.exit(1);
}
}