New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

generate-code-context

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

generate-code-context

This npm package reads all files in a directory (excluding specified ones) and writes their contents to a `.txt` file.

latest
npmnpm
Version
1.0.19
Version published
Maintainers
0
Created
Source

Generate Code Context of your Project

This npm package reads all files in a directory (excluding specified ones) and writes their contents to a .txt file.

Installation

npm i generate-code-context

Usuage

Create a file named generate.js in your project directory.

Add the following code to generate.js:



const { run } = require('generate-code-context');
const path = require('path');
const startDir = __dirname; // Root directory
const excludeDirs = ['node_modules', 'dist', 'build'];
const excludeFiles = ['package.json', 'package-lock.json', 'yarn.lock', 'pnpm-lock.yaml'];
const outputFilePath = path.join(__dirname, 'code_context.txt'); // Save in root directory
run(startDir, excludeDirs, excludeFiles, outputFilePath);

Get Gemini API Key from https://aistudio.google.com and paste it in .env file


API_KEY=your_google_api_key_here

RUN

node generate.js

Keywords

code

FAQs

Package last updated on 07 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts