-
Notifications
You must be signed in to change notification settings - Fork 16
[HOUSEKEEPING] Finding broken links in md files and fix them #432
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this script file may be un-necessary:
See: https://github.com/tcort/markdown-link-check#check-links-from-a-local-markdown-folder-recursive
You can inline this into a package.json script instead of calling this custom script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 1
are you thinking othewise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bnookala
and what about people using windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok then. We do not support windows runtime.
ts-node tools/brokenLinks.ts
closes microsoft/bedrock#1214