linkcheckup
v1.0.1
Published
A simple tool to check if links work or not in any type of file and it reports both broken and valid links.
Downloads
13
Maintainers
Readme
# URLValidator
**URLValidator** is a simple command-line tool that scans files for URLs and checks their validity. It reports both valid and broken links, highlighting broken links with the HTTP status code if available.
## Features
- Scans multiple file types such as `.json`, `.md`, `.yml`, `.ts`, `.tsx`, `.js`, `.jsx`, `.html`, `.txt`, `.py` for URLs.
- Skips certain directories (`node_modules`, `.next`, `dist`, `build`, `.cache`) and excluded files like `package.json`, `package-lock.json`.
- Reports broken links with error codes and highlights them.
- Counts the number of broken and valid links.
## Installation
To install this tool globally, you can use `npm`:
```bash
npm install -g urlvalidator
Usage
Once installed globally, you can run the tool from the command line in any project directory.
linkchecker
The tool will automatically scan all supported files in the current directory and subdirectories, then display results for both valid and broken links.
Example
Navigate to your project folder:
cd /path/to/your/project
Run the
linkchecker
command:linkchecker
You'll see an output like:
Starting LinkChecker... valid: https://example.com in /path/to/file.js broken: https://broken-link.com in /path/to/another-file.md (Status: 404) ... Link Checking Complete. Total broken links: 2 - https://broken-link.com - https://another-broken-link.com
File Types Supported
By default, the following file extensions are scanned:
.json
.md
.yml
.ts
.tsx
.js
.jsx
.html
.txt
.py
Configuration
You can modify the tool by editing the following configurations:
- Excluded Directories: Currently, it skips directories like
node_modules
,.next
,dist
,build
,.cache
. If you need to include or exclude specific directories, modify thegetFilesFromDirectory()
function insrc/index.js
. - Excluded Files: Files like
package.json
andpackage-lock.json
are excluded. You can modify this list insrc/index.js
.
License
This project is licensed under the MIT License.
Author
Created by Gowreesh Simhadri