Skip to content

Skjesper/path-validator-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

104 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Path Validator CLI Tool

A command-line tool that ensures your project paths work not just locally, but also in production deployments.

What Does It Do?

This tool helps developers avoid common path-related issues that can break projects when moving from a local environment to production. It scans your project for path inconsistencies and suggests (or automatically applies) fixes to ensure smooth deployment.

Features

  • Scans and validates paths across HTML, CSS, PHP, and JavaScript projects
  • Automatically adjusts paths that work locally but would break in deployment
  • Detects and fixes issues like:
    • Incorrect relative paths (../, ./, /)
    • Paths that work locally but break when deployed
    • Absolute paths that need to be relative
    • Missing files or incorrect references
  • Automatically applies fixes (when not using --check-only)
  • Generates a clear report of all detected issues and suggested corrections
  • Fast, lightweight & easy to use

Installation

npm install -g path-validator-cli

Usage

There are two main ways to use the path validator:

1. Check and Fix Mode (Default)

path-validator

This will:

  • Scan your current directory
  • Report any path issues found
  • Automatically fix the issues by renaming files/directories

2. Check-Only Mode

path-validator --check-only

This will:

  • Scan your current directory
  • Report any path issues found
  • Not make any changes to your files

Examples

# Check and fix paths in the current directory
path-validator

# Only check paths without making changes
path-validator --check-only

Dependencies

  • chalk: Colors and styles text output in the terminal
  • commander: Creates and manages command-line interfaces (CLI) and parses arguments
  • fast-glob: Quickly finds files and directories using pattern matching
  • figlet: Converts text into ASCII art banners
  • inquirer: Creates interactive command-line prompts and forms
  • ora: Displays elegant loading spinners in the terminal

Output

The tool provides detailed feedback about invalid paths found in your codebase:

Path Validator Output Example 1
Path Validator Output Example 2

Each issue shows:

  • The invalid path that was found
  • In the file where the path is referenced, you can Ctrl-click (PC) or Command-click (Mac) to open the referenced file.
  • The exact line number where the reference occurs
  • A helpful suggestion for fixing the issue
  • ..and a passive aggressive reality check based on how many issues there are.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.

Roadmap

  • Add support for validating/correcting edge cases
  • Support for other programming languages and frameworks like C#, React and more
  • A path-validator --undo command

Authors

About

A CLI tool and future VS Code extension for detecting and fixing broken file paths in HTML, CSS, PHP, and JavaScript projects. Prevent deployment issues by validating and correcting paths directly in your codebase.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%