-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: correct jsdocs links * chore: update depcheck * chore: code style
- Loading branch information
Showing
8 changed files
with
550 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const { default: axios } = require('axios') | ||
const { Strings } = require('cafe-utility') | ||
const { readdirSync, statSync, readFileSync } = require('fs') | ||
const { join } = require('path') | ||
|
||
main() | ||
|
||
function main() { | ||
walk('src') | ||
} | ||
|
||
function walk(dir) { | ||
const files = readdirSync(dir) | ||
for (const file of files) { | ||
const path = join(dir, file) | ||
if (statSync(path).isDirectory()) { | ||
walk(path) | ||
} else { | ||
check(path) | ||
} | ||
} | ||
} | ||
|
||
function check(path) { | ||
const content = readFileSync(path, 'utf8') | ||
const links = Strings.extractAllBlocks(content, { | ||
opening: '](https://docs.ethswarm.org', | ||
closing: ')', | ||
}) | ||
for (const link of links) { | ||
const cleanLink = link.replaceAll('](', '').replaceAll(')', '') | ||
axios.get(cleanLink).catch(error => { | ||
console.error(path, cleanLink, error.response.status) | ||
}) | ||
} | ||
} |
Oops, something went wrong.