1.0.2 ⢠Published 7 months ago
react-loc-analyzer v1.0.2
react-loc-analyzer
A powerful and flexible Lines of Code (LOC) analyzer specifically designed for React projects. Get detailed insights about your codebase with beautiful formatted tables and comprehensive statistics.
Features
- š Detailed code statistics with formatted tables
- šØ Colored output for better readability
- ā” Fast asynchronous file processing
- š Smart code detection (distinguishes between code, comments, and empty lines)
- šÆ React-focused file type analysis
- š Easy to use with npx
- āļø Configurable file extensions and ignore patterns
Installation
You can use it directly with npx (no installation required):
npx react-loc-analyzer
Or install it globally:
npm install -g react-loc-analyzer
Usage
Basic Usage
Analyze the current directory:
npx react-loc-analyzer
Analyze a specific directory:
npx react-loc-analyzer /path/to/your/react/project
Options
npx react-loc-analyzer [directory] [options]
Options:
-V, --version output version number
-e, --exclude <patterns> additional patterns to exclude (comma-separated)
-i, --include <extensions> additional file extensions to include (comma-separated)
--no-color disable colored output
-h, --help display help for command
Examples
Analyze with additional exclude patterns:
npx react-loc-analyzer --exclude .cache,public,static
Include additional file extensions:
npx react-loc-analyzer --include .vue,.svelte
Output
The analyzer provides two main tables:
1. Project Summary
Shows overall statistics including:
- Total Files
- Total Lines
- Code Lines
- Comment Lines
- Empty Lines
2. Files by Type
Detailed breakdown for each file extension:
- Number of files
- Total lines
- Code lines
- Comment lines
- Empty lines
- Percentage of codebase
Example output:
Project Summary:
āāāāāāāāāāāāāāāāā¬āāāāāāāāāāāāā
ā Metric ā Value ā
āāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāā¤
ā Total Files ā 156 ā
ā Total Lines ā 15,234 ā
ā Code Lines ā 12,845 ā
ā Comment Lines ā 1,523 ā
ā Empty Lines ā 866 ā
āāāāāāāāāāāāāāāāā“āāāāāāāāāāāāā
Files by Type:
āāāāāāāāāāāāāā¬āāāāāāāā¬āāāāāāāāāāāāāā¬āāāāāāāāāāāāā¬āāāāāāāāāāāāāāāā
ā Extension ā Files ā Total Lines ā Code Lines ā % of Codebase ā
āāāāāāāāāāāāāā¼āāāāāāāā¼āāāāāāāāāāāāāā¼āāāāāāāāāāāāā¼āāāāāāāāāāāāāāāā¤
ā .tsx ā 87 ā 8,456 ā 7,234 ā 56.3% ā
ā .scss ā 34 ā 3,234 ā 2,845 ā 22.1% ā
ā .jsx ā 23 ā 2,456 ā 1,923 ā 15.0% ā
āāāāāāāāāāāāāā“āāāāāāāā“āāāāāāāāāāāāāā“āāāāāāāāāāāāā“āāāāāāāāāāāāāāāā
Default Configuration
Included File Extensions
.js
,.jsx
,.ts
,.tsx
.css
,.scss
,.sass
.html
,.json
Default Ignore Patterns
node_modules
build
dist
.git
coverage
.next
out
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
MIT License - see the LICENSE file for details