mirror of
https://github.com/grafana/grafana.git
synced 2024-11-25 18:30:41 -06:00
234ccb886f
* Test removing the icon component * Use different component * Replace \n with <br> * Fix formatting * Empty commit * Improve formatting * Fix breaking lines format * Remove output * Remove breaking change
30 lines
800 B
JavaScript
30 lines
800 B
JavaScript
const fs = require('fs');
|
|
|
|
const data = JSON.parse(fs.readFileSync('data.json', 'utf8'));
|
|
|
|
const stripAnsi = (string) => string.replace(/\u001b\[.*?m/g, '');
|
|
|
|
const printSection = (title, items) => {
|
|
let output = `<h4>${title}</h4>`;
|
|
items.forEach((item) => {
|
|
const language = item.declaration ? 'typescript' : 'diff';
|
|
const code = item.declaration ? item.declaration : stripAnsi(item.diff);
|
|
|
|
output += `<b>${item.name}</b><br>`;
|
|
output += `<sub>${item.location}</sub><br>`;
|
|
output += `<pre lang="${language}">${code}</pre><br>`;
|
|
});
|
|
return output;
|
|
};
|
|
|
|
let markdown = '';
|
|
|
|
if (data.removals.length > 0) {
|
|
markdown += printSection('Removals', data.removals);
|
|
}
|
|
if (data.changes.length > 0) {
|
|
markdown += printSection('Changes', data.changes);
|
|
}
|
|
|
|
console.log(markdown);
|