Files
base-configs/packages/config-checker/helpers/generate-md-table.js
2024-05-05 15:27:18 +03:00

20 lines
615 B
JavaScript

'use strict'
const configurationPaths = require('../lib/configuration-paths')
const configItems = configurationPaths('`[module name]`')
const longestLine = configItems.reduce((a, b) => (a.length > b.length ? a : b), 0).length
const mdTable = configItems.map(file => {
const diff = longestLine - file.length
return `| ${file}${' '.repeat(diff)} |`
})
console.log('# Configuration files\n')
const header = 'Searched configuration files'
console.log('| ' + header + ' '.repeat(longestLine - header.length) + ' |')
console.log('| ' + '-'.repeat(longestLine) + ' |')
mdTable.forEach(line => console.log(line))