folder-generator 1.3.5 → 1.3.7

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.
Files changed (2) hide show
  1. package/README.md +143 -152
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,152 +1,143 @@
1
- šŸ“‚ Folder Structure Generator CLI
2
- A powerful command-line tool to generate complete folder structures from a simple text diagram. Perfect for quickly scaffolding projects, boilerplates, or standardized directory layouts.
3
-
4
- 🌟 Features
5
- Generate nested folders and files with a single command
6
-
7
- Supports both direct input and file input
8
-
9
- Clear visual feedback with color-coded output
10
-
11
- Flexible output directory specification
12
-
13
- Lightweight with zero dependencies (except for development)
14
-
15
- Cross-platform (Windows, macOS, Linux)
16
-
17
- šŸ“¦ Installation
18
- Global Installation (Recommended)
19
- bash
20
- npm install -g folder-structure-generator
21
- (This allows running the tool from anywhere using foldgen)
22
-
23
- Local Installation
24
- bash
25
- npm install folder-structure-generator --save-dev
26
- (Useful when you want it as part of your project's dev tools)
27
-
28
- šŸš€ Basic Usage
29
- 1. Direct Input
30
- bash
31
- foldgen --input "src/
32
- ā”œā”€ā”€ App.js
33
- ā”œā”€ā”€ index.js
34
- └── components/
35
- ā”œā”€ā”€ Button.js
36
- └── Header.js"
37
- 2. From a File
38
- bash
39
- foldgen --file structure.txt
40
- 3. From STDIN (Piping)
41
- bash
42
- echo "config/
43
- ā”œā”€ā”€ default.json
44
- └── production.json" | foldgen
45
- šŸ”§ Advanced Usage
46
- Specify Output Directory
47
- bash
48
- foldgen --input "lib/utils.js" --output ./my-project
49
- Combine with Other Tools
50
- bash
51
- curl https://example.com/structure.txt | foldgen --output ./src
52
- Generate in Current Directory
53
- bash
54
- foldgen --input "README.md" # Creates in current folder
55
- šŸ“ Syntax Guide
56
- The generator understands standard tree diagram notation:
57
-
58
- text
59
- root/
60
- ā”œā”€ā”€ file.ext
61
- └── folder/
62
- ā”œā”€ā”€ nested_file.ext
63
- └── empty_folder/
64
- Special Characters:
65
-
66
- ā”œā”€ā”€ for intermediate items
67
-
68
- └── for the last item in a level
69
-
70
- │ for vertical connections
71
-
72
- (spaces) for indentation (4 spaces per level)
73
-
74
- šŸ› ļø API Reference (for programmatic use)
75
- javascript
76
- const { parseStructure, createFiles } = require('folder-structure-generator');
77
-
78
- // Parse text to structure object
79
- const structure = parseStructure(`src/index.js`);
80
-
81
- // Generate files
82
- createFiles(structure, './output-path');
83
- 🧩 Integration with Other Tools
84
- With curl:
85
- bash
86
- curl -s https://raw.githubusercontent.com/your/repo/base-structure.txt | foldgen
87
- In package.json scripts:
88
- json
89
- {
90
- "scripts": {
91
- "setup": "foldgen --file project-structure.txt --output ./src",
92
- "create:components": "foldgen --input 'src/components/\nā”œā”€ā”€ Button.js\n└── Modal.js'"
93
- }
94
- }
95
- šŸ—ļø Example Structures
96
- React Project
97
- text
98
- src/
99
- ā”œā”€ā”€ App.js
100
- ā”œā”€ā”€ index.js
101
- ā”œā”€ā”€ components/
102
- │ ā”œā”€ā”€ Button/
103
- │ │ ā”œā”€ā”€ index.js
104
- │ │ ā”œā”€ā”€ styles.css
105
- │ │ └── tests.js
106
- │ └── Header.js
107
- ā”œā”€ā”€ pages/
108
- │ └── Home.js
109
- └── utils/
110
- └── api.js
111
- Node.js API
112
- text
113
- app/
114
- ā”œā”€ā”€ config/
115
- │ └── database.js
116
- ā”œā”€ā”€ controllers/
117
- │ └── userController.js
118
- ā”œā”€ā”€ models/
119
- │ └── User.js
120
- ā”œā”€ā”€ routes/
121
- │ └── index.js
122
- ā”œā”€ā”€ app.js
123
- └── package.json
124
- ā“ FAQ
125
- Q: Can I add content to the generated files?
126
- A: Currently the tool creates empty files. We're working on template support in the next version!
127
-
128
- Q: How do I handle spaces in file names?
129
- A: Just include them normally in your input: "My Document.docx"
130
-
131
- Q: What if I make a mistake in the syntax?
132
- A: The tool will show you an error with the problematic line number.
133
-
134
- šŸ› Troubleshooting
135
- Error: EACCES permission denied
136
- Solution: Run with sudo or fix your npm permissions:
137
-
138
- bash
139
- sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
140
- Error: Missing input
141
- Solution: Either provide --input, --file, or pipe content to the command
142
-
143
- šŸ¤ Contributing
144
- Fork the repository
145
-
146
- Create a feature branch (git checkout -b feature/awesome-feature)
147
-
148
- Commit your changes (git commit -am 'Add awesome feature')
149
-
150
- Push to the branch (git push origin feature/awesome-feature)
151
-
152
- Open a Pull Request
1
+ # šŸ“ Folder Structure Generator CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/folder-structure-generator)](https://www.npmjs.com/package/folder-structure-generator)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ A powerful CLI tool that generates complete folder structures from simple text diagrams. Perfect for quickly scaffolding projects, boilerplates, or standardized directory layouts.
7
+
8
+ ## ✨ Features
9
+
10
+ - Generate nested folders and files with a single command
11
+ - Supports both direct input and file input
12
+ - Cross-platform (Windows, macOS, Linux)
13
+ - Clear visual feedback with color-coded output
14
+ - Flexible output directory specification
15
+ - Lightweight with minimal dependencies
16
+
17
+ ## šŸ“¦ Installation
18
+
19
+ ### Global Installation (Recommended)
20
+ ```bash
21
+ npm install -g folder-structure-generator
22
+ ```
23
+
24
+ ### Local Installation
25
+ ```bash
26
+ npm install folder-structure-generator --save-dev
27
+ ```
28
+
29
+ ## šŸš€ Usage
30
+
31
+ ### From Direct Input
32
+ ```bash
33
+ foldgen --input "src/
34
+ ā”œā”€ā”€ App.js
35
+ ā”œā”€ā”€ index.js
36
+ └── components/
37
+ ā”œā”€ā”€ Button.js
38
+ └── Header.js"
39
+ ```
40
+
41
+ ### Using npx
42
+ ```bash
43
+ npx folder-generator --file structure.txt
44
+ ```
45
+
46
+ ### From File
47
+ ```bash
48
+ foldgen --file structure.txt
49
+ ```
50
+
51
+ ### From STDIN (Piping)
52
+ ```bash
53
+ echo "config/
54
+ ā”œā”€ā”€ default.json
55
+ └── production.json" | foldgen
56
+ ```
57
+
58
+
59
+ ### Specify Output Directory
60
+ ```bash
61
+ foldgen --file structure.txt --output ./my-project
62
+ ```
63
+
64
+ ## šŸ“ Syntax Guide
65
+
66
+ The generator understands standard tree diagram notation:
67
+
68
+ ```
69
+ project/
70
+ ā”œā”€ā”€ README.md
71
+ ā”œā”€ā”€ src/
72
+ │ ā”œā”€ā”€ index.js
73
+ │ └── utils/
74
+ │ └── helpers.js
75
+ └── tests/
76
+ └── index.test.js
77
+ ```
78
+
79
+ **Special Characters:**
80
+
81
+ - `ā”œā”€ā”€` for intermediate items
82
+ - `└──` for the last item in a level
83
+ - `│` for vertical connections
84
+ - Spaces for indentation (4 spaces per level)
85
+
86
+ ## šŸ› ļø Programmatic API
87
+
88
+ ```javascript
89
+ const { parseStructure, createFiles } = require('folder-structure-generator');
90
+
91
+ const structure = parseStructure(`src/index.js`);
92
+ createFiles(structure, './output');
93
+ ```
94
+
95
+ ## šŸ“‚ Example Structure Files
96
+
97
+ **React Project (react-structure.txt):**
98
+ ```
99
+ src/
100
+ ā”œā”€ā”€ App.jsx
101
+ ā”œā”€ā”€ index.js
102
+ ā”œā”€ā”€ components/
103
+ │ ā”œā”€ā”€ Button/
104
+ │ │ ā”œā”€ā”€ index.jsx
105
+ │ │ └── styles.module.css
106
+ │ └── Header.jsx
107
+ ā”œā”€ā”€ pages/
108
+ │ └── Home.jsx
109
+ └── utils/
110
+ └── api.js
111
+ ```
112
+
113
+ **Node.js API (node-structure.txt):**
114
+ ```
115
+ app/
116
+ ā”œā”€ā”€ config/
117
+ │ └── database.js
118
+ ā”œā”€ā”€ controllers/
119
+ │ └── userController.js
120
+ ā”œā”€ā”€ models/
121
+ │ └── User.js
122
+ ā”œā”€ā”€ routes/
123
+ │ └── api.js
124
+ ā”œā”€ā”€ app.js
125
+ └── package.json
126
+ ```
127
+
128
+ ## šŸ¤ Contributing
129
+
130
+ - Fork the repository
131
+ - Create your feature branch (`git checkout -b feature/amazing-feature`)
132
+ - Commit your changes (`git commit -m 'Add some amazing feature'`)
133
+ - Push to the branch (`git push origin feature/amazing-feature`)
134
+ - Open a Pull Request
135
+
136
+ ## šŸ“œ License
137
+
138
+ MIT Ā© Shreyash Ghanekar
139
+
140
+ ## šŸ™ Acknowledgments
141
+
142
+ - Inspired by the need for quick project scaffolding
143
+ - Built with Node.js and love
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "folder-generator",
3
- "version": "1.3.5",
3
+ "version": "1.3.7",
4
4
  "description": "CLI tool to generate folder structures from text input",
5
5
  "bin": {
6
6
  "foldgen": "./bin/cli.js"