mirror of
https://github.com/cupcakearmy/morphus.git
synced 2024-12-22 16:16:27 +00:00
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
import { config, StorageType } from '../dist/src/config.js'
|
|
|
|
const schema = config._def
|
|
|
|
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]
|
|
let table = `
|
|
| Config | Environment | Default | Description |
|
|
| ---------------- | ------------------ | ------- | ------------------------ |
|
|
`
|
|
for (const [key, value] of Object.entries(storageType)) {
|
|
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)
|
|
}
|