-
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.
Merge remote-tracking branch 'origin/master' into feat/act
- Loading branch information
Showing
10 changed files
with
576 additions
and
489 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
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
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.