This commit is contained in:
2022-05-29 11:31:18 +02:00
parent 9500bcf68c
commit a47d5974e4
4 changed files with 27 additions and 6 deletions

View File

@@ -2,9 +2,10 @@ import { config, StorageType } from '../dist/src/config.js'
const schema = config._def
function stringAsMarkdownCode(string) {
return '`' + string + '`'
}
const asInlineCode = (s) => '`' + s + '`'
const formatInline = (s, empty = '') => (s === undefined ? empty : asInlineCode(s))
const formatEnv = (s) => formatInline(s, 'not supported')
const formatDefault = (s) => formatInline(s, '')
for (const storage of Object.values(StorageType)) {
const storageType = schema[storage]
@@ -13,7 +14,21 @@ for (const storage of Object.values(StorageType)) {
| ---------------- | ------------------ | ------- | ------------------------ |
`
for (const [key, value] of Object.entries(storageType)) {
table += `| \`${storage}.${key}\` | \`${value.env}\` | ${value.default} | ${value.doc} |\n`
table += `| \`${storage}.${key}\` | ${formatEnv(value.env)} | ${formatDefault(value.default)} | ${value.doc} |\n`
}
console.log(table)
}
{
let table = `
| Config | Environment | Default | Description |
| ------- | ----------- | ------- | ------------ |
`
for (const [key, value] of Object.entries(schema)) {
if (Object.values(StorageType).includes(key)) continue
table += `| ${asInlineCode(key)} | ${formatEnv(value.env)} | ${formatDefault(value.default)} | ${value.doc} |\n`
}
console.log(table)