Skip to content
Abhishek Verma edited this page Sep 7, 2024 · 1 revision

NPM Profiler ℹ

npm Profiler : A Comprehensive Analysis Command-Line Analysis Tool for Projects.

Installation 💻

Windows

npm install npm-profiler

Mac

npm install -g npm-profiler

Features 🚀

1. Count Analysis

Designed to analyze files within a directory and provide insights such as the total number of files, lines of code, React components, React routers, and configuration files.

┌───────────┬────────────┬────────────┐
│ Extension │ TotalFiles │ TotalLines │
├───────────┼────────────┼────────────┤
│ .js       │ 2          │ 11         │
├───────────┼────────────┼────────────┤
│ .jsx      │ 3          │ 152        │
└───────────┴────────────┴────────────┘

It can provide you with:

  • Total Lines of Code: 5087
  • Total React Components: 14
  • Total React Routers: 3
  • Total Configuration Files: 1
  • Total Commented Lines: 11

Usage

Replace [options] with any combination of the following options:

  • -g: Indicates that the analysis should include all files within the directory.
  • -n: Include the node_modules, Dist etc directory to the analysis.
  • -w: Include whitespace lines in the line count.
  • -d: Download the analysis results as a CSV file named Project-count.csv.
  • -c: Count the total number of commented lines.

Note: -g is mandatory rest optional.

ayu-count -g 

2. API Analysis

Designed to analyze API calls within files in a directory. It provides insights such as the total number of API calls, the number of GET and POST calls for both Fetch and Axios.

┌───────┬─────────────┬───────────┬────────────┐
│ API   │ Total Calls │ GET Calls │ POST Calls │
├───────┼─────────────┼───────────┼────────────┤
│ Fetch │ 5           │ 4         │ 1          │
├───────┼─────────────┼───────────┼────────────┤
│ Axios │ 4           │ 2         │ 2          │
└───────┴─────────────┴───────────┴────────────┘

Usage

Replace [options] with any combination of the following options:

  • -g: Indicates that the analysis should include all files within the directory.
  • -d: Download the analysis results as a CSV file named Api-calls.csv.

Note: -g is mandatory rest optional.

ayu-api -g

3. Unused Analysis

Designed to analyze JavaScript files in a directory and provide insights such as the number of active console.log statements, commented console.log statements, total console.log statements, uncalled functions, and unused packages.

┌──────────────────────────────┬────────────────────┐
│ Package                      │ Version            │
├──────────────────────────────┼────────────────────┤
│ framer-motion                │ ^11.0.24           │
├──────────────────────────────┼────────────────────┤
│ ora                          │ ^8.0.1             │
├──────────────────────────────┼────────────────────┤
│ react-beautiful-dnd          │ ^13.1.1            │
└──────────────────────────────┴────────────────────┘

It can provide you with:

  • Total Active console.log Statements: 15
  • Total Commented console.log Statements: 2
  • Total Console.log Statements: 17
  • Total Uncalled Functions: 3
  • Total Commented Lines: 11
  • Total Unused Packages: 3

Usage

Replace [options] with any combination of the following options:

  • -g: Indicates that the analysis should include all JavaScript files within the directory.
  • -d: Download the analysis results as a CSV file named Unused.csv.

Note: -g is mandatory rest optional.

ayu-free -g

4. Console Analysis

Designed to manipulations on JavaScript, TypeScript, JSX, and TSX files within a specified directory. It offers options to comment out, remove, or uncomment console.log statements in these files. It's designed to aid in code maintenance tasks, such as cleaning up debug statements before deployment or preparing code for production.

Usage

To use ayu-console, run the following command:

ayu-console [option]

options:

  • gc: Comment out all console.log statements.
  • gr: Remove all console.log statements.
  • gar: Remove all active console.log statements.
  • gcr: Remove all inactive/commented console.log statements.
  • guc: Uncomment all console.log statements.
  • help: Display this help message.

Note Uncommented console.log statements will only work if they were commented out by this tool.

5. Size Analysis

Designed to calculate and display the sizes of directories and subdirectories within a specified root directory. It provides insights into the disk space consumption of various folders, excluding certain predefined folders like node_modules, dist etc.

┌────────────┬──────────┐
│ Folder     │ Size     │
├────────────┼──────────┤
│ public     │ 1.88 KB  │
├────────────┼──────────┤
│ src        │ 10.17 KB │
├────────────┼──────────┤
│ src\assets │ 4.03 KB  │
└────────────┴──────────┘

It can provide you with:

  • Total size of the (/) without folders: 329.31 KB
  • Size of 'dist': 147.38 KB
  • Size of 'node_modules': 64.14 MB

Usage

Replace [options] with any combination of the following options:

  • -g: Indicates that the analysis should include all directories and subdirectories within the root directory.
  • -d: Download the analysis results as a CSV file named Folder-sizes.csv.

Note: -g is mandatory rest optional.

ayu-size -g

Contributor

Abhishek Verma

Github email abhishekayu

Important: For any Queries, Suggestions, or Improvements

If you have any questions, feedback, or ideas for improvement, please don't hesitate to raise an issue or submit a pull request on GitHub. Your input is highly valued and helps to enhance this project for everyone. Thank you for your contribution!

Contribute

Contributions are always welcome! Please read the contribution guidelines first.

License

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