Easily generate README.md
files for your projects by analyzing your codebase using the Gemini API.
Run the following command in your terminal:
npm install gorav-readme-generator
Alternatively, you can install it globally:
npm install -g gorav-readme-generator
- Set Up Your Project Create a new .js file in your project directory:
touch filename.js
- Import and Use the Generator Add the following code to your .js file:
import { generateReadme } from "gorav-readme-generator";
generateReadme();
- Configure the API Key Create a .env file in your project directory and add your Gemini API key:
GEMINI_API_KEY="your-gemini-api-key"
- Run the Generator Run the .js file you created, and the package will generate a README.md file for your project.
Check out a sample README.md file here:
https://github.com/Gorav22/Readme-generator-package/blob/main/SampleREADME.md
- Collects Project Information: Prompts the user for project name and GitHub URL.
- Code Analysis: Scans the project directory for .js, .ts, .jsx, .tsx, and .py files (excluding node_modules, dist, and build directories). Concatenates the content of these files.
- Gemini API Integration: Sends the combined code content to the Gemini API to analyze the project and generate README content.
- README Generation: Uses the analysis from the Gemini API to create a structured README.md file, including sections like Introduction, Installation, Features, and more. If the structured generation fails, it writes the raw Gemini output to README.md.
- glob: For file pattern matching.
- fs: For file system operations.
- inquirer: For interactive command-line prompts.
- @google/generative-ai: For interacting with the Gemini API.
- dotenv: For loading environment variables.