npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

repo-to-one-file

v1.0.2

Published

Convert a repository to a single Markdown file

Downloads

28

Readme

repo-to-one-file

npm version npm downloads License: MIT

repo-to-one-file is a Node.js tool that consolidates repository files into a single Markdown file. It's designed to create a comprehensive overview of a codebase, which can be particularly useful for documentation or as context for large language models.

Check out the code here, please star <3

Features

  • Generates a directory structure of the repository
  • Consolidates content of specified file types (.py, .js, .ts, .json, etc.) into a single Markdown file
  • Ignores common non-source files and directories (node_modules, .git, etc.)
  • Configurable maximum line count per file
  • Option to include normally ignored files
  • Prioritizes important files like README, package.json, requirements.txt, etc.

Installation

You can install repo-to-one-file globally using npm:

npm install -g repo-to-one-file

Usage

After installation, you can use repo-to-one-file from the command line:

repo-to-one-file

This will create a combined_repo.md file in the current directory.

Options

  • --max-lines: Set the maximum number of lines per file (default: 1000)
  • --include-ignored: Include files that would normally be ignored

Example:

repo-to-one-file --max-lines 2000 --include-ignored

Output Format

The generated Markdown file will have the following structure:

  1. Directory structure of the repository
  2. Content of priority files (README, package.json, requirements.txt, pyproject.toml)
  3. Content of other included files (.py, .js, .ts, .json, etc.)

Each file's content is presented under a header with its relative path and enclosed in a code block with the appropriate language tag.

Ignored Patterns

By default, the tool ignores many common non-source files and directories, including:

  • Version control directories (.git, .svn)
  • Package manager directories and files (node_modules, package-lock.json)
  • Build directories and files (dist, build)
  • Cache directories
  • Log files
  • Environment files
  • OS-generated files

For a full list, please refer to the ignoredPatterns array in the convertRepo.js file.

Development

To set up the development environment:

  1. Clone the repository
  2. Install dependencies: npm install

Contributing

Contributions are welcome! Here are some ways you can contribute:

  1. Implement test cases
  2. Improve error handling and logging
  3. Add support for more file types
  4. Optimize performance for large repositories
  5. Improve documentation and examples

Please feel free to submit issues and pull requests.

License

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

Acknowledgements

  • This project was inspired by the need to provide concise codebase overviews for large language models.
  • Thanks to all contributors and users of this tool.