File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111npm run dev
1212```
1313
14+ ## Link Checking
15+
16+ To check for broken links in the documentation:
17+
18+ ```
19+ npm run check-links
20+ ```
21+
22+ This command will:
23+ 1 . Kill any existing server on port 3000
24+ 2 . Start a new dev server
25+ 3 . Check all internal links
26+ 4 . Kill the server when done
27+
28+ The link checker is also integrated into the build process (` npm run build ` ), ensuring no broken links make it to production.
29+
1430These docs were created using [ Fumadocs] ( https://fumadocs.vercel.app/docs/ui ) .
1531
1632## Updating the theme
@@ -48,13 +64,13 @@ import {Layers, Microscope } from 'lucide-react';
4864 icon={<Layers />}
4965 href="/about"
5066 title="About"
51- description="Learn about Layer "
67+ description="Learn about WAVS "
5268 />
5369 <Card
5470 icon={<Microscope />}
5571 href="/how-it-works"
5672 title="How it works"
57- description="Discover how Layer works"
73+ description="Discover how WAVS works"
5874 />
5975</Cards>
6076
Original file line number Diff line number Diff line change 33 "version" : " 0.0.0" ,
44 "private" : true ,
55 "scripts" : {
6- "build" : " next build" ,
6+ "build" : " rm -rf dsource-wavs-foundry-template || true; next build" ,
77 "postbuild" : " next-sitemap" ,
88 "dev" : " next dev" ,
9+ "check-links" : " lsof -ti:3000 | xargs kill -9 || true; next dev -p 3000 & sleep 5 && node scripts/check-links.js && kill $!" ,
910 "start" : " next start"
1011 },
1112 "dependencies" : {
3334 "@types/react" : " ^18.3.3" ,
3435 "@types/react-dom" : " ^18.3.0" ,
3536 "autoprefixer" : " ^10.4.19" ,
37+ "broken-link-checker" : " ^0.7.8" ,
38+ "chalk" : " ^4.1.2" ,
3639 "postcss" : " ^8.4.38" ,
3740 "tailwindcss" : " ^3.4.4" ,
3841 "typescript" : " ^5.4.5"
Original file line number Diff line number Diff line change 1+ const { SiteChecker } = require ( 'broken-link-checker' ) ;
2+ const chalk = require ( 'chalk' ) ;
3+
4+ let hasBrokenLinks = false ;
5+
6+ const siteChecker = new SiteChecker (
7+ {
8+ excludeExternalLinks : true ,
9+ excludeInternalLinks : false ,
10+ excludeLinksToSamePage : true ,
11+ filterLevel : 0 ,
12+ acceptedSchemes : [ 'http' , 'https' ] ,
13+ maxSockets : 1 ,
14+ maxSocketsPerHost : 1 ,
15+ rateLimit : 100 ,
16+ userAgent : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36' ,
17+ } ,
18+ {
19+ link : ( result ) => {
20+ if ( result . broken ) {
21+ hasBrokenLinks = true ;
22+ console . error (
23+ chalk . red ( `❌ BROKEN LINK: ${ result . url . original } ` ) ,
24+ chalk . yellow ( `\n Found in: ${ result . base . original } ` ) ,
25+ chalk . gray ( `\n Status: ${ result . http . response ? result . http . response . statusCode : 'No response' } ` )
26+ ) ;
27+ }
28+ } ,
29+ end : ( ) => {
30+ if ( hasBrokenLinks ) {
31+ console . error ( chalk . red ( '\n❌ Broken links found! Please fix them before continuing.' ) ) ;
32+ process . exit ( 1 ) ;
33+ } else {
34+ console . log ( chalk . green ( '\n✅ No broken links found!' ) ) ;
35+ }
36+ }
37+ }
38+ ) ;
39+
40+ const baseUrl = process . env . NEXT_PUBLIC_BASE_URL || 'http://localhost:3000' ;
41+ console . log ( chalk . blue ( `\n🔍 Checking links on ${ baseUrl } ...\n` ) ) ;
42+ siteChecker . enqueue ( baseUrl ) ;
You can’t perform that action at this time.
0 commit comments