project-structure-cli
Version:
It is a lightweight app to create project structure so that it can be used optimally with LLMs or in creating README
154 lines (125 loc) • 3.13 kB
Markdown
# 📂 project-structure-cli
A simple CLI tool to generate a **project structure tree** and save it to `project-structure.txt`. It automatically updates the structure every time you run it and supports **ignoring specific files and directories**.
## ✨ Features
✅ Generate a project structure tree
✅ Save the structure in `project-structure.txt` in the root directory
✅ Supports **ignoring specific files and directories**
✅ Automatically excludes node_modules and folders/files starting with dot(.) eg: .next .git directory by default
✅ use --include to exclusively include folders which are ignored by default
✅ Works with any project setup
## 🚀 Installation
### **Use without installing**
Run directly using `npx`:
```sh
npx project-structure-cli
```
### **Install globally (optional)**
```sh
npm install -g project-structure-cli
```
Then, you can run:
```sh
proj-structure
```
## 📌 Usage
### **Basic Usage (Full Structure)**
To generate `project-structure.txt` in the root of your project:
```sh
npx project-structure-cli
```
or
```sh
proj-structure
```
### **Make your own customised project structure**
To generate `project-structure.txt` along with the folders which are excluded by default
```sh
npx project-structure-cli --include .next
```
### **Exclude Files/Folders from Structure**
You can **exclude files and directories** by passing them as arguments:
```sh
npx project-structure-cli --exclude api .env
```
or
```sh
proj-structure --exclude api .env
```
## 📝 Example Output
If your project structure is:
```
my-project
│── src
│ │── components
│ │ │── Header.tsx
│ │ │── Footer.tsx
│ │── pages
│ │ │── index.tsx
│ │ │── about.tsx
│── public
│ │── favicon.ico
│── package.json
│── tsconfig.json
│── README.md
│── .git
│── node_modules
```
Running
```sh
npx project-structure-cli --exclude public
```
or
```sh
npx project-structure-cli
```
will generate `project-structure.txt` as:
```
my-project
├── src
│ ├── components
│ │ ├── Header.tsx
│ │ ├── Footer.tsx
│ ├── pages
│ │ ├── index.tsx
│ │ ├── about.tsx
├── package.json
├── tsconfig.json
└── README.md
```
(`.git` and `node_modules` are **excluded**)
## 🛠 Development
1. Clone the repo:
```sh
git clone https://github.com/anups1ngh/project-structure-generator.git
cd project-structure-generator
```
2. Install dependencies:
```sh
npm install
```
3. Test locally:
```sh
node index.js
```
4. Link the package globally for local testing:
```sh
npm link
proj-structure
```
## 📦 Publishing to npm
To publish the package:
```sh
npm login
npm publish
```
## 🔗 License
This project is licensed under the **MIT License** (soon will be open Source).
## Reach out to developer
Anup Kumar Singh
[anupsingh.work@gmail.com](mailto:anupsingh.work@gmail.com)