function replaceFileContents(filepath, pattern, replacement) {
  const contents = fs.readFileSync(filepath, 'utf-8');
  const newContents = contents.replace(pattern, replacement);
  fs.writeFileSync(filepath, newContents, 'utf-8');
}
Synchronously replace all substrings matched by `pattern` with
`replacement` in the contents of file at `filepath`

@param {string} filepath - Path to file
@param {RegExp|string} pattern - Search pattern
@param {string} replacement - Replacement