function replaceNewlines(text) {
  text = text.replace(/\r\n?|\n/g, os.EOL)
  if (!endsWith(text, os.EOL)) {
    text += os.EOL
  }