make-folder-txt 1.0.0
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/LICENSE +21 -0
- package/README.md +89 -0
- package/make-folder-txt.js +128 -0
- package/package.json +26 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Muhammad Saad Amin @SENODROOM
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# make-folder-txt
|
|
2
|
+
|
|
3
|
+
Generate a single `.txt` file containing the **full folder structure** and **contents of every file** in your project — perfect for sharing codebases with AI tools or teammates.
|
|
4
|
+
|
|
5
|
+
Automatically ignores `node_modules`, `.git`, `dist`, `build`, and binary files.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g make-folder-txt
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
make-folder-txt <folder-path> [output-file.txt]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Examples
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Basic — output saved as <folder-name>.txt in current directory
|
|
27
|
+
make-folder-txt "C:\Web Development\my-project"
|
|
28
|
+
|
|
29
|
+
# Custom output file name
|
|
30
|
+
make-folder-txt "C:\Web Development\my-project" my-output.txt
|
|
31
|
+
|
|
32
|
+
# On Mac/Linux
|
|
33
|
+
make-folder-txt /home/user/my-project
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Output Format
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
================================================================================
|
|
42
|
+
START OF FOLDER: my-project
|
|
43
|
+
================================================================================
|
|
44
|
+
|
|
45
|
+
================================================================================
|
|
46
|
+
PROJECT STRUCTURE
|
|
47
|
+
================================================================================
|
|
48
|
+
Root: C:\Web Development\my-project
|
|
49
|
+
|
|
50
|
+
my-project/
|
|
51
|
+
├── src/
|
|
52
|
+
│ ├── index.js
|
|
53
|
+
│ └── utils.js
|
|
54
|
+
├── node_modules/ [skipped]
|
|
55
|
+
├── package.json
|
|
56
|
+
└── README.md
|
|
57
|
+
|
|
58
|
+
Total files: 4
|
|
59
|
+
|
|
60
|
+
================================================================================
|
|
61
|
+
FILE CONTENTS
|
|
62
|
+
================================================================================
|
|
63
|
+
|
|
64
|
+
--------------------------------------------------------------------------------
|
|
65
|
+
FILE: /src/index.js
|
|
66
|
+
--------------------------------------------------------------------------------
|
|
67
|
+
... file content here ...
|
|
68
|
+
|
|
69
|
+
================================================================================
|
|
70
|
+
END OF FOLDER: my-project
|
|
71
|
+
================================================================================
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## What Gets Skipped
|
|
77
|
+
|
|
78
|
+
| Type | Details |
|
|
79
|
+
|------|---------|
|
|
80
|
+
| Folders | `node_modules`, `.git`, `.next`, `dist`, `build`, `.cache` |
|
|
81
|
+
| Binary files | Images, fonts, zips, executables, media |
|
|
82
|
+
| Large files | Any file over 500 KB |
|
|
83
|
+
| System files | `.DS_Store`, `Thumbs.db`, `desktop.ini` |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## License
|
|
88
|
+
|
|
89
|
+
MIT
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
// ── config ────────────────────────────────────────────────────────────────────
|
|
7
|
+
const IGNORE_DIRS = new Set(["node_modules", ".git", ".next", "dist", "build", ".cache"]);
|
|
8
|
+
const IGNORE_FILES = new Set([".DS_Store", "Thumbs.db", "desktop.ini"]);
|
|
9
|
+
|
|
10
|
+
const BINARY_EXTS = new Set([
|
|
11
|
+
".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".svg", ".webp",
|
|
12
|
+
".pdf", ".zip", ".tar", ".gz", ".rar", ".7z",
|
|
13
|
+
".exe", ".dll", ".so", ".dylib", ".bin",
|
|
14
|
+
".mp3", ".mp4", ".wav", ".avi", ".mov",
|
|
15
|
+
".woff", ".woff2", ".ttf", ".eot", ".otf",
|
|
16
|
+
".lock",
|
|
17
|
+
]);
|
|
18
|
+
|
|
19
|
+
// ── helpers ───────────────────────────────────────────────────────────────────
|
|
20
|
+
|
|
21
|
+
function collectFiles(dir, rootDir, indent = "", lines = [], filePaths = []) {
|
|
22
|
+
let entries;
|
|
23
|
+
try {
|
|
24
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
25
|
+
} catch {
|
|
26
|
+
return { lines, filePaths };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
entries.sort((a, b) => {
|
|
30
|
+
if (a.isDirectory() === b.isDirectory()) return a.name.localeCompare(b.name);
|
|
31
|
+
return a.isDirectory() ? -1 : 1;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
entries.forEach((entry, idx) => {
|
|
35
|
+
const isLast = idx === entries.length - 1;
|
|
36
|
+
const connector = isLast ? "└── " : "├── ";
|
|
37
|
+
const childIndent = indent + (isLast ? " " : "│ ");
|
|
38
|
+
|
|
39
|
+
if (entry.isDirectory()) {
|
|
40
|
+
if (IGNORE_DIRS.has(entry.name)) {
|
|
41
|
+
lines.push(`${indent}${connector}${entry.name}/ [skipped]`);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
lines.push(`${indent}${connector}${entry.name}/`);
|
|
45
|
+
collectFiles(path.join(dir, entry.name), rootDir, childIndent, lines, filePaths);
|
|
46
|
+
} else {
|
|
47
|
+
if (IGNORE_FILES.has(entry.name)) return;
|
|
48
|
+
lines.push(`${indent}${connector}${entry.name}`);
|
|
49
|
+
const relPath = "/" + path.relative(rootDir, path.join(dir, entry.name)).split(path.sep).join("/");
|
|
50
|
+
filePaths.push({ abs: path.join(dir, entry.name), rel: relPath });
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return { lines, filePaths };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function readContent(absPath) {
|
|
58
|
+
const ext = path.extname(absPath).toLowerCase();
|
|
59
|
+
if (BINARY_EXTS.has(ext)) return "[binary / skipped]";
|
|
60
|
+
try {
|
|
61
|
+
const stat = fs.statSync(absPath);
|
|
62
|
+
if (stat.size > 500 * 1024) {
|
|
63
|
+
return `[file too large: ${(stat.size / 1024).toFixed(1)} KB – skipped]`;
|
|
64
|
+
}
|
|
65
|
+
return fs.readFileSync(absPath, "utf8");
|
|
66
|
+
} catch (err) {
|
|
67
|
+
return `[could not read file: ${err.message}]`;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// ── main ──────────────────────────────────────────────────────────────────────
|
|
72
|
+
|
|
73
|
+
const folderPath = process.cwd();
|
|
74
|
+
|
|
75
|
+
const rootName = path.basename(folderPath);
|
|
76
|
+
|
|
77
|
+
const outputFile = process.argv[3]
|
|
78
|
+
? path.resolve(process.argv[3])
|
|
79
|
+
: path.join(process.cwd(), `${rootName}.txt`);
|
|
80
|
+
|
|
81
|
+
console.log(`\n📂 Scanning: ${folderPath}`);
|
|
82
|
+
|
|
83
|
+
const { lines: treeLines, filePaths } = collectFiles(folderPath, folderPath);
|
|
84
|
+
|
|
85
|
+
// ── build output ──────────────────────────────────────────────────────────────
|
|
86
|
+
const out = [];
|
|
87
|
+
const divider = "=".repeat(80);
|
|
88
|
+
const subDivider = "-".repeat(80);
|
|
89
|
+
|
|
90
|
+
out.push(divider);
|
|
91
|
+
out.push(`START OF FOLDER: ${rootName}`);
|
|
92
|
+
out.push(divider);
|
|
93
|
+
out.push("");
|
|
94
|
+
|
|
95
|
+
out.push(divider);
|
|
96
|
+
out.push("PROJECT STRUCTURE");
|
|
97
|
+
out.push(divider);
|
|
98
|
+
out.push(`Root: ${folderPath}\n`);
|
|
99
|
+
out.push(`${rootName}/`);
|
|
100
|
+
treeLines.forEach(l => out.push(l));
|
|
101
|
+
out.push("");
|
|
102
|
+
out.push(`Total files: ${filePaths.length}`);
|
|
103
|
+
out.push("");
|
|
104
|
+
|
|
105
|
+
out.push(divider);
|
|
106
|
+
out.push("FILE CONTENTS");
|
|
107
|
+
out.push(divider);
|
|
108
|
+
|
|
109
|
+
filePaths.forEach(({ abs, rel }) => {
|
|
110
|
+
out.push("");
|
|
111
|
+
out.push(subDivider);
|
|
112
|
+
out.push(`FILE: ${rel}`);
|
|
113
|
+
out.push(subDivider);
|
|
114
|
+
out.push(readContent(abs));
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
out.push("");
|
|
118
|
+
out.push(divider);
|
|
119
|
+
out.push(`END OF FOLDER: ${rootName}`);
|
|
120
|
+
out.push(divider);
|
|
121
|
+
|
|
122
|
+
fs.writeFileSync(outputFile, out.join("\n"), "utf8");
|
|
123
|
+
|
|
124
|
+
const sizeKB = (fs.statSync(outputFile).size / 1024).toFixed(1);
|
|
125
|
+
console.log(`✅ Done!`);
|
|
126
|
+
console.log(`📄 Output : ${outputFile}`);
|
|
127
|
+
console.log(`📊 Size : ${sizeKB} KB`);
|
|
128
|
+
console.log(`🗂️ Files : ${filePaths.length}\n`);
|
package/package.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "make-folder-txt",
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
+
"main": "bin/make-folder-txt.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"make-folder-txt": "bin/make-folder-txt.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"No tests yet\" && exit 0"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"folder",
|
|
14
|
+
"dump",
|
|
15
|
+
"project",
|
|
16
|
+
"structure",
|
|
17
|
+
"txt",
|
|
18
|
+
"cli",
|
|
19
|
+
"export"
|
|
20
|
+
],
|
|
21
|
+
"author": "AnnonymousThinker",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=14.0.0"
|
|
25
|
+
}
|
|
26
|
+
}
|