analyze-project-structure v1.0.1
Analyze Project Structure
A command-line tool to analyze and print the folder structure of a project, extracting details about the project's files, including functions, variables, routes, and imports/exports. It helps in summarizing the project's code organization.
Features
- Prints the folder structure of a project.
- Extracts details about JavaScript/TypeScript files:
- Functions (both normal and arrow functions)
- Variables (including constants)
- Routes (GET, POST, etc.)
- Imports and exports
- Outputs the analysis into a text file. By default, this file is
folder-structure-output.txt
, but you can specify a custom file name.
Installation
Global Installation
To install the tool globally, use the following command:
npm install -g analyze-project-structure
Local Installation
To install the tool locally in your project:
npm install analyze-project-structure --save-dev
Usage
Once installed, you can run the tool using one of the following commands in your terminal:
analyze-project-structure
or
aps
Default Behavior
By default, when you run the tool, it analyzes the folder structure of the current directory and generates a file called folder-structure-output.txt
.
Custom Output File Name
You can also specify a custom output file name as an argument when running the tool. For example:
analyze-project-structure custom-output.txt
or
aps custom-output.txt
This will save the analysis to a file called custom-output.txt
instead of the default folder-structure-output.txt
.
Both commands will analyze the folder structure of the current directory and output the results to the specified file (or the default file if none is provided).
Example Output
When you run the command, the tool will create a file called folder-structure-output.txt
(or the custom file name you provided) that looks like this:
routes
appointment.ts
-- Route: /
-- Method: GET
-- Handler Variables:
-- user
-- Functions in Handler:
-- Anonymous Arrow Function
-- Method: POST
-- Handler Variables:
-- appointment
-- Functions in Handler:
-- Anonymous Arrow Function
imports:
-- express
-- ../../db
exports:
-- appointmentRouter
auth.ts
-- Route: /register
-- Method: POST
imports:
-- express
-- bcryptjs
-- jsonwebtoken
-- express-validator
-- ../../db
exports:
-- authRoutes
server.ts
imports:
-- express
-- helmet
-- ./routes/auth
-- ./routes/appointment
Contributing
Feel free to fork the repository, open issues, or submit pull requests. Contributions are welcome!
License
This project is licensed under the ISC License - see the LICENSE file for details.
Author
Prasad Dhule