scripts: fix generate-config-doc, handle usage errors #4807
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When trying to update the docs for #1344 I noticed that the
generate-config-doc
script was broken because it was no longer correctly importingserver/log
, my guess is it just got missed during TS conversion. I fixed the default import in this PR.This PR also fixes the types in
generate-config-doc.js
, which are checked becausecheckJs
is enabled intsconfig.json
. I did not convert the file to TypeScript because it is not part of the eslint TS config and I was unsure about making changes to the lint setup. The only type change required was markingacc
asstring[]
instead ofnever[]
.Since
generate-config-doc
requires TS imports, the comments suggesting to usenode ./scripts/...
to execute it are wrong. I switched the comments to use anpm
script which runsts-node
for the user.Additionally, I added a check that the DOC_ROOT_PATH is supplied, so the script exits with a nice error instead of a less useful uncaught exception from
writeFileSync
.Running this revealed that some of the existing config docs are out-of-date, so I opened a PR to sync up: thelounge/thelounge.github.io#275