npm-installable wrapper for @filiph's linkcheck.
A lot of inspiration (and some code) came from @jakejarvis' hugo-extended.
Installation
npm install linkcheck-bin --save-dev
yarn add linkcheck-bin --dev
This package's version numbers align with linkcheck's — linkcheck-bin@2.0.20
installs linkcheck 2.0.20, for example.
Usage
CLI / package.json script
// package.json:
{
// ...
"scripts": {
"linkcheck": "linkcheck --external --check-anchors https://tylerbutler.com"
},
"devDependencies": {
"linkcheck-bin": "^2.0.20"
}
// ...
}
$ npm run linkcheck
Done crawling.
https://tylerbutler.com
- (233:225) '1' => https://tylerbutler.com
https://tylerbutler.com/
- (233:225) '1' => https://tylerbutler.com/
https://tylerbutler.com/2004/11/tyler-a-novelist/
- (189:55) 'on this ..' => https://tylerbutler.com/tag/nanowrimo (HTTP 404)
...
Errors. Checked 8309 links, 317 destination URLs (483 ignored), 11 have errors, 20 have warnings.
via JS API:
import linkcheck from "linkcheck-bin";
import { execFile } from "child_process";
execFile(linkcheck, ["--version"], (error, stdout) => {
console.log(stdout);
});
$ node version.js
linkcheck version 2.0.20
License
This project is distributed under the MIT License. linkcheck is also distributed under the MIT License.