Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 2.65 KB

README.md

File metadata and controls

88 lines (57 loc) · 2.65 KB

ProjectAnalyzer

Description

ProjectAnalyzer is a Node.js CLI tool designed to analyze a project directory. It counts the total number of files, folders, and lines of code, providing a detailed summary of the project structure. The tool supports excluding the .git directory and displays the analysis in a user-friendly format for the CLI output.

Features

  • File and Folder Count: Counts the total number of files and folders in the project directory.
  • Lines of Code: Calculates the total number of lines in all files.
  • Git Directory Exclusion: Optionally exclude the .git directory from the analysis.
  • CLI Output: Presents the analysis results with an attractive ASCII art design.
  • Customizable: Easily extendable to include more metrics or modifications.

Installation

To use ProjectAnalyzer, follow these steps:

  1. Ensure you have Node.js installed on your system. You can download it from nodejs.org.
  2. Clone or download the project:
git clone [email protected]:DevT045T/ProjectAnalyzer.git
cd ProjectAnalyzer
  1. Install dependencies via npm:
npm install

Usage

Command Line Options

To analyze a project, you can use the following command format:

node main.js --path=/path/to/project --exclude-git
  • --path=/path/to/project: Specifies the path to the project you want to analyze.
  • --exclude-git: Optionally exclude the .git directory from the analysis.

Example Output

Project Analysis Complete:
-----------------------------------
Total Files:  132
Total Folders:  12
Total Lines of Code:  3,245
-----------------------------------

Methods

  • excludeGit(exclude: boolean): Allows you to exclude the .git directory from the analysis if exclude is set to true. Defaults to false.

  • analyzeProject(): Initiates the project analysis, traverses through all files and directories, and outputs the analysis summary.

  • traverseDirectory(currentPath: string): Recursively traverses the project directory to count files and directories.

  • countLinesInFile(filePath: string): Counts the number of lines in a specific file.

Example

const ProjectAnalyzer = require('./src/ProjectAnalyzer.js');
const analyzer = new ProjectAnalyzer('/path/to/your/project');

// Exclude the .git directory
analyzer.excludeGit(true);

// Analyze the project
analyzer.analyzeProject();

License

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


Contributing

Feel free to fork this project, make improvements, and submit pull requests. Contributions are always welcome!