make-folder-txt 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.txtignore +2 -0
- package/bin/make-folder-txt.js +10 -4
- package/make-folder-txt.txt +278 -0
- package/package.json +1 -1
package/.txtignore
ADDED
package/bin/make-folder-txt.js
CHANGED
|
@@ -81,8 +81,11 @@ function collectFiles(
|
|
|
81
81
|
return;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
//
|
|
85
|
-
|
|
84
|
+
// Get relative path for .txtignore pattern matching
|
|
85
|
+
const relPathForIgnore = path.relative(rootDir, path.join(dir, entry.name)).split(path.sep).join("/");
|
|
86
|
+
|
|
87
|
+
// Check against .txtignore patterns (both dirname and relative path)
|
|
88
|
+
if (txtIgnore.has(entry.name) || txtIgnore.has(`${entry.name}/`) || txtIgnore.has(relPathForIgnore) || txtIgnore.has(`${relPathForIgnore}/`) || txtIgnore.has(`/${relPathForIgnore}/`)) {
|
|
86
89
|
if (!hasOnlyFilters) {
|
|
87
90
|
lines.push(`${indent}${connector}${entry.name}/ [skipped]`);
|
|
88
91
|
}
|
|
@@ -122,8 +125,11 @@ function collectFiles(
|
|
|
122
125
|
} else {
|
|
123
126
|
if (ignoreFiles.has(entry.name)) return;
|
|
124
127
|
|
|
125
|
-
//
|
|
126
|
-
|
|
128
|
+
// Get relative path for .txtignore pattern matching
|
|
129
|
+
const relPathForIgnore = path.relative(rootDir, path.join(dir, entry.name)).split(path.sep).join("/");
|
|
130
|
+
|
|
131
|
+
// Check against .txtignore patterns (both filename and relative path)
|
|
132
|
+
if (txtIgnore.has(entry.name) || txtIgnore.has(relPathForIgnore) || txtIgnore.has(`/${relPathForIgnore}`)) {
|
|
127
133
|
return;
|
|
128
134
|
}
|
|
129
135
|
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
================================================================================
|
|
2
|
+
START OF FOLDER: make-folder-txt
|
|
3
|
+
================================================================================
|
|
4
|
+
|
|
5
|
+
================================================================================
|
|
6
|
+
PROJECT STRUCTURE
|
|
7
|
+
================================================================================
|
|
8
|
+
Root: C:\Programming\make-folder-txt
|
|
9
|
+
|
|
10
|
+
make-folder-txt/
|
|
11
|
+
├── .git/ [skipped]
|
|
12
|
+
├── bin/
|
|
13
|
+
├── package.json
|
|
14
|
+
└── README.md
|
|
15
|
+
|
|
16
|
+
Total files: 2
|
|
17
|
+
|
|
18
|
+
================================================================================
|
|
19
|
+
FILE CONTENTS
|
|
20
|
+
================================================================================
|
|
21
|
+
|
|
22
|
+
--------------------------------------------------------------------------------
|
|
23
|
+
FILE: /package.json
|
|
24
|
+
--------------------------------------------------------------------------------
|
|
25
|
+
{
|
|
26
|
+
"name": "make-folder-txt",
|
|
27
|
+
"version": "1.3.1",
|
|
28
|
+
"description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
|
|
29
|
+
"main": "bin/make-folder-txt.js",
|
|
30
|
+
"bin": {
|
|
31
|
+
"make-folder-txt": "bin/make-folder-txt.js"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "echo \"No tests yet\" && exit 0"
|
|
35
|
+
},
|
|
36
|
+
"keywords": [
|
|
37
|
+
"folder",
|
|
38
|
+
"dump",
|
|
39
|
+
"project",
|
|
40
|
+
"structure",
|
|
41
|
+
"txt",
|
|
42
|
+
"cli",
|
|
43
|
+
"export"
|
|
44
|
+
],
|
|
45
|
+
"author": "Muhammad Saad Amin",
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=14.0.0"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
--------------------------------------------------------------------------------
|
|
54
|
+
FILE: /README.md
|
|
55
|
+
--------------------------------------------------------------------------------
|
|
56
|
+
<div align="center">
|
|
57
|
+
|
|
58
|
+
# 📁 make-folder-txt
|
|
59
|
+
|
|
60
|
+
**Instantly dump your entire project into a single, readable `.txt` file.**
|
|
61
|
+
|
|
62
|
+
[](https://www.npmjs.com/package/make-folder-txt)
|
|
63
|
+
[](https://www.npmjs.com/package/make-folder-txt)
|
|
64
|
+
[](./LICENSE)
|
|
65
|
+
[](https://nodejs.org)
|
|
66
|
+
|
|
67
|
+
Perfect for sharing your codebase with **AI tools**, **teammates**, or **code reviewers** — without zipping files or giving repo access.
|
|
68
|
+
|
|
69
|
+
[Installation](#-installation) · [Usage](#-usage) · [Output Format](#-output-format) · [What Gets Skipped](#-what-gets-skipped) · [Contributing](#-contributing)
|
|
70
|
+
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## ✨ Why make-folder-txt?
|
|
76
|
+
|
|
77
|
+
Ever needed to share your entire project with ChatGPT, Claude, or a teammate — but copy-pasting every file one by one is painful? **make-folder-txt** solves that in one command.
|
|
78
|
+
|
|
79
|
+
- ✅ Run it from any project directory — no arguments needed
|
|
80
|
+
- ✅ Generates a clean folder tree + every file's content
|
|
81
|
+
- ✅ Automatically skips `node_modules`, binaries, and junk files
|
|
82
|
+
- ✅ Zero dependencies — pure Node.js
|
|
83
|
+
- ✅ Works on Windows, macOS, and Linux
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 📦 Installation
|
|
88
|
+
|
|
89
|
+
Install globally once, use anywhere:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm install -g make-folder-txt
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 🚀 Usage
|
|
98
|
+
|
|
99
|
+
Navigate into your project folder and run:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cd my-project
|
|
103
|
+
make-folder-txt
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
That's it. A `my-project.txt` file will be created in the same directory.
|
|
107
|
+
|
|
108
|
+
Ignore specific folders/files by name:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
make-folder-txt --ignore-folder examples extensions docs
|
|
112
|
+
make-folder-txt --ignore-folder examples extensions "docs and explaination"
|
|
113
|
+
make-folder-txt --ignore-folder examples extensions docs --ignore-file LICENSE
|
|
114
|
+
make-folder-txt --ignore-file .env .env.local secrets.txt
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Use a `.txtignore` file (works like `.gitignore`):
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Create a .txtignore file in your project root
|
|
121
|
+
echo "node_modules/" > .txtignore
|
|
122
|
+
echo "*.log" >> .txtignore
|
|
123
|
+
echo ".env" >> .txtignore
|
|
124
|
+
echo "coverage/" >> .txtignore
|
|
125
|
+
|
|
126
|
+
# The tool will automatically read and respect .txtignore patterns
|
|
127
|
+
make-folder-txt
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The `.txtignore` file supports:
|
|
131
|
+
- File and folder names (one per line)
|
|
132
|
+
- Wildcard patterns (`*.log`, `temp-*`)
|
|
133
|
+
- Comments (lines starting with `#`)
|
|
134
|
+
- Folder patterns with trailing slash (`docs/`)
|
|
135
|
+
|
|
136
|
+
Include only specific folders/files by name (everything else is ignored):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
make-folder-txt --only-folder src docs
|
|
140
|
+
make-folder-txt --only-file package.json README.md
|
|
141
|
+
make-folder-txt --only-folder src --only-file package.json
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 🎯 Real World Examples
|
|
147
|
+
|
|
148
|
+
**Sharing with an AI tool (ChatGPT, Claude, etc.):**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cd "C:\Web Development\my-app\backend"
|
|
152
|
+
make-folder-txt
|
|
153
|
+
# → backend.txt created, ready to paste into any AI chat
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**On macOS / Linux:**
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
cd /home/user/projects/my-app
|
|
160
|
+
make-folder-txt
|
|
161
|
+
# → my-app.txt created
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📄 Output Format
|
|
167
|
+
|
|
168
|
+
The generated `.txt` file is structured in two clear sections:
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
================================================================================
|
|
172
|
+
START OF FOLDER: my-project
|
|
173
|
+
================================================================================
|
|
174
|
+
|
|
175
|
+
================================================================================
|
|
176
|
+
PROJECT STRUCTURE
|
|
177
|
+
================================================================================
|
|
178
|
+
Root: C:\Web Development\my-project
|
|
179
|
+
|
|
180
|
+
my-project/
|
|
181
|
+
├── src/
|
|
182
|
+
│ ├── controllers/
|
|
183
|
+
│ │ └── userController.js
|
|
184
|
+
│ ├── models/
|
|
185
|
+
│ │ └── User.js
|
|
186
|
+
│ └── index.js
|
|
187
|
+
├── node_modules/ [skipped]
|
|
188
|
+
├── package.json
|
|
189
|
+
└── README.md
|
|
190
|
+
|
|
191
|
+
Total files: 5
|
|
192
|
+
|
|
193
|
+
================================================================================
|
|
194
|
+
FILE CONTENTS
|
|
195
|
+
================================================================================
|
|
196
|
+
|
|
197
|
+
--------------------------------------------------------------------------------
|
|
198
|
+
FILE: /src/index.js
|
|
199
|
+
--------------------------------------------------------------------------------
|
|
200
|
+
const express = require('express');
|
|
201
|
+
...
|
|
202
|
+
|
|
203
|
+
--------------------------------------------------------------------------------
|
|
204
|
+
FILE: /package.json
|
|
205
|
+
--------------------------------------------------------------------------------
|
|
206
|
+
{
|
|
207
|
+
"name": "my-project",
|
|
208
|
+
...
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
================================================================================
|
|
212
|
+
END OF FOLDER: my-project
|
|
213
|
+
================================================================================
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## 🚫 What Gets Skipped
|
|
219
|
+
|
|
220
|
+
The tool is smart about what it ignores so your output stays clean and readable.
|
|
221
|
+
|
|
222
|
+
| Category | Details |
|
|
223
|
+
| --------------- | -------------------------------------------------------------- |
|
|
224
|
+
| 📁 Folders | `node_modules`, `.git`, `.next`, `dist`, `build`, `.cache` |
|
|
225
|
+
| 🖼️ Binary files | Images (`.png`, `.jpg`, `.gif`...), fonts, videos, executables |
|
|
226
|
+
| 📦 Archives | `.zip`, `.tar`, `.gz`, `.rar`, `.7z` |
|
|
227
|
+
| 🔤 Font files | `.woff`, `.woff2`, `.ttf`, `.eot`, `.otf` |
|
|
228
|
+
| 📋 Lock files | `package-lock.json`, `yarn.lock` |
|
|
229
|
+
| 📏 Large files | Any file over **500 KB** |
|
|
230
|
+
| 🗑️ System files | `.DS_Store`, `Thumbs.db`, `desktop.ini` |
|
|
231
|
+
| 📄 Output file | The generated `foldername.txt` file (to avoid infinite loops) |
|
|
232
|
+
| 📝 .txtignore | Any files/folders specified in `.txtignore` file |
|
|
233
|
+
|
|
234
|
+
Binary and skipped files are noted in the output as `[binary / skipped]` so you always know what was omitted.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 🛠️ Requirements
|
|
239
|
+
|
|
240
|
+
- **Node.js** v14.0.0 or higher
|
|
241
|
+
- No other dependencies
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 🤝 Contributing
|
|
246
|
+
|
|
247
|
+
Contributions, issues, and feature requests are welcome!
|
|
248
|
+
|
|
249
|
+
1. Fork the repository
|
|
250
|
+
2. Create your feature branch: `git checkout -b feature/my-feature`
|
|
251
|
+
3. Commit your changes: `git commit -m 'Add my feature'`
|
|
252
|
+
4. Push to the branch: `git push origin feature/my-feature`
|
|
253
|
+
5. Open a Pull Request
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 👤 Author
|
|
258
|
+
|
|
259
|
+
**Muhammad Saad Amin**
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 📝 License
|
|
264
|
+
|
|
265
|
+
This project is licensed under the **MIT License** — feel free to use it in personal and commercial projects.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
<div align="center">
|
|
270
|
+
|
|
271
|
+
If this tool saved you time, consider giving it a ⭐ on npm!
|
|
272
|
+
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
================================================================================
|
|
277
|
+
END OF FOLDER: make-folder-txt
|
|
278
|
+
================================================================================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "make-folder-txt",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
|
|
5
5
|
"main": "bin/make-folder-txt.js",
|
|
6
6
|
"bin": {
|