mirror of
https://github.com/ivuorinen/config-checker.git
synced 2026-01-26 03:13:59 +00:00
feat: initial import from base-configs
This commit is contained in:
19
helpers/generate-md-table.js
Normal file
19
helpers/generate-md-table.js
Normal file
@@ -0,0 +1,19 @@
|
||||
/* eslint no-console: "off" -- This is a cli app that generates cli output */
|
||||
|
||||
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))
|
||||
Reference in New Issue
Block a user