Prerequisites
Before you begin, make sure you have the following prerequisites installed on your system:Node.js
This project requires Node.js, a JavaScript runtime, to build and run. You can download and install Node.js from the official website: Node.js Download. To check if Node.js is installed, open your terminal and run:v18.0.0 or higher).
Linkspector requires Node.js version 14 or higher. We recommend using the latest LTS (Long Term Support) version.
Git
You’ll need Git to clone the repository and manage version control. Most systems have Git pre-installed, but you can download it from git-scm.com if needed. To verify Git is installed:Installation
After ensuring you have the prerequisites installed, follow these steps to set up your development environment:Fork and clone the repository
First, fork the repository on GitHub, then clone it to your local machine:Replace
YOUR_USERNAME with your GitHub username.Install dependencies
Use This command will download and install all the required packages specified in the
npm to install all project dependencies:package.json file.Running Linkspector Locally
Once you’ve completed the setup, you can run Linkspector locally for testing and development.Basic Usage
To run Linkspector on the project itself:Using a Custom Configuration
To test with a custom configuration file:JSON Output
To see the JSON output format (useful for testing integrations):The JSON output follows the rdjson format used by reviewdog.
Running Tests
Linkspector uses Vitest as its test framework. To run the test suite:Run All Tests
Watch Mode
For continuous testing during development:Code Formatting
To check code formatting:Project Structure
Understanding the project structure will help you navigate the codebase and make meaningful contributions:Key Files
index.js: The CLI entry point that handles command-line arguments using the Commander librarylinkspector.js: Contains the main application logic for link checkinglib/: Directory containing modular functionality:- Link extraction for different formats (Markdown, AsciiDoc)
- Link validation and checking
- Configuration validation
- Reference validation
When adding new features, consider whether they belong in an existing module or require a new module in the
lib/ directory.Development Workflow
Here’s a typical development workflow:Commit your changes
Commit with a clear message following the commit message guidelines:
Using Docker for Development
You can also develop and test Linkspector using Docker:Troubleshooting
Common Issues
Dependencies not installing- Try deleting
node_modulesandpackage-lock.json, then runnpm installagain - Ensure you’re using a compatible Node.js version (14+)
- Make sure all dependencies are installed:
npm install - Check if there are any environment-specific issues
- Review the test output for specific error messages
- Linkspector uses Puppeteer for link checking. On some systems, you may need to install additional dependencies
- See the Puppeteer troubleshooting guide for system-specific requirements
If you encounter issues not covered here, please open an issue on GitHub.
Next Steps
Now that you have your development environment set up:- Review the Contributing Guidelines to understand the contribution process
- Check out open issues to find something to work on
- Read through the codebase to familiarize yourself with the architecture
- Join the discussions to connect with other contributors