[HOUSEKEEPING] Finding broken links in md files and fix them#432
[HOUSEKEEPING] Finding broken links in md files and fix them#432dennisseah merged 11 commits intomasterfrom
Conversation
andrebriggs
left a comment
There was a problem hiding this comment.
Thank you @dennisseah for doing this
|
I did a bit of searching and found a few existing packages/tools that do similar tasks - I would err on the side of using them. https://github.com/tcort/markdown-link-check - this one integrates with github actions, so can be run in CI as well: https://github.com/marketplace/actions/markdown-link-check There's also this plugin for remark: https://github.com/remarkjs/remark-validate-links |
bnookala
left a comment
There was a problem hiding this comment.
let's try to use this tool instead, since it's being actively maintained and might fit our use cases: https://github.com/tcort/markdown-link-check
ok. I will remove my tool. thanks |
tools/mdLint.ts
Outdated
| } | ||
| }; | ||
|
|
||
| (async (): Promise<void> => { |
There was a problem hiding this comment.
I think this script file may be un-necessary:
You can inline this into a package.json script instead of calling this custom script
There was a problem hiding this comment.
i cannot because i need a status code 1 to stop the script. :-)
the inline approach always return 0
There was a problem hiding this comment.
Sorry Dennis, not quite sure I understand what you're saying. Npm scripts will exit with 1 if if any of the commands fail:
"scripts": {
"i-will-fail": "false && true"
},npm run i-will-fail # will exit with code 1are you thinking othewise?
There was a problem hiding this comment.
maybe you can try it yourself and let me know what you get
add this to your package.json
"md-lint": "find guides -name \\*.md -exec markdown-link-check {} \\",
or just ran (at the root of spk repo)
find guides -name \*.md -exec markdown-link-check {} \;
then
echo $?
there are errors reported by the tool and it is returning 0 status code.
There was a problem hiding this comment.
@dennisseah try the suggestion here: tcort/markdown-link-check#57 (comment)
find guides -name \*.md | xargs -n 1 markdown-link-check
There was a problem hiding this comment.
@bnookala
and what about people using windows?
There was a problem hiding this comment.
@dennisseah this isn't a run-time requirement - just a development requirement. I expect that developers who are running windows who also want to contribute to spk development should do their work in a WSL environment.
There was a problem hiding this comment.
ok then. We do not support windows runtime.
ts-node tools/brokenLinks.tscloses microsoft/bedrock#1214