All files / packages/design-system/scripts/release-notes helpers.js

0% Statements 0/14
0% Branches 0/2
0% Functions 0/2
0% Lines 0/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49                                                                                                 
const COMMENT_BEST_PRACTICES = `<!-- Release notes authoring guidelines: http://keepachangelog.com/ -->
<!-- !!! THIS FILE IS AUTO-GENERATED !!! DO NOT EDIT THIS FILE MANUALLY !!! -->`;
const NEW_LINE = '\n';
const NEW_LINE_DOUBLE = NEW_LINE + NEW_LINE;
const RELEASE_NOTES_FILENAME = 'RELEASENOTES.md';
 
/**
 * arrayOfLines
 * @param {string} lines
 * @returns {array}
 */
function arrayOfLines(lines) {
  return lines.match(/[^\r\n]+/g) || [];
}
 
/**
 * getReleaseDate - returns a human-readable date string
 * @returns {string} - date string in MM DD, YYYY format
 */
function getReleaseDate() {
  const date = new Date();
  const month = date.toLocaleString('en-US', { month: 'long' });
  const day = date.getDate();
  const year = date.getFullYear();
 
  return `${month} ${day}, ${year}`;
}
 
/**
 * logStatus - logs a formatted message
 * @returns null
 */
const logStatus = message =>
  console.log('\n', '\u{26A1}', '\x1b[32m', message, '\x1b[0m', '\n');
 
const logWarning = message =>
  console.log('\n', '\x1b[35m', '\u{1F640}', message, '\u{1F640}', '\n');
 
module.exports = {
  arrayOfLines,
  getReleaseDate,
  logStatus,
  logWarning,
  COMMENT_BEST_PRACTICES,
  NEW_LINE,
  NEW_LINE_DOUBLE,
  RELEASE_NOTES_FILENAME
};