folder-generator 1.3.4 → 1.3.6

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 (3) hide show
  1. package/README.md +137 -152
  2. package/bin/cli.js +1 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,152 +1,137 @@
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
+ ### From File
42
+ ```bash
43
+ foldgen --file structure.txt
44
+ ```
45
+
46
+ ### From STDIN (Piping)
47
+ ```bash
48
+ echo "config/
49
+ ā”œā”€ā”€ default.json
50
+ └── production.json" | foldgen
51
+ ```
52
+
53
+ ### Specify Output Directory
54
+ ```bash
55
+ foldgen --file structure.txt --output ./my-project
56
+ ```
57
+
58
+ ## šŸ“ Syntax Guide
59
+
60
+ The generator understands standard tree diagram notation:
61
+
62
+ ```
63
+ project/
64
+ ā”œā”€ā”€ README.md
65
+ ā”œā”€ā”€ src/
66
+ │ ā”œā”€ā”€ index.js
67
+ │ └── utils/
68
+ │ └── helpers.js
69
+ └── tests/
70
+ └── index.test.js
71
+ ```
72
+
73
+ **Special Characters:**
74
+
75
+ - `ā”œā”€ā”€` for intermediate items
76
+ - `└──` for the last item in a level
77
+ - `│` for vertical connections
78
+ - Spaces for indentation (4 spaces per level)
79
+
80
+ ## šŸ› ļø Programmatic API
81
+
82
+ ```javascript
83
+ const { parseStructure, createFiles } = require('folder-structure-generator');
84
+
85
+ const structure = parseStructure(`src/index.js`);
86
+ createFiles(structure, './output');
87
+ ```
88
+
89
+ ## šŸ“‚ Example Structure Files
90
+
91
+ **React Project (react-structure.txt):**
92
+ ```
93
+ src/
94
+ ā”œā”€ā”€ App.jsx
95
+ ā”œā”€ā”€ index.js
96
+ ā”œā”€ā”€ components/
97
+ │ ā”œā”€ā”€ Button/
98
+ │ │ ā”œā”€ā”€ index.jsx
99
+ │ │ └── styles.module.css
100
+ │ └── Header.jsx
101
+ ā”œā”€ā”€ pages/
102
+ │ └── Home.jsx
103
+ └── utils/
104
+ └── api.js
105
+ ```
106
+
107
+ **Node.js API (node-structure.txt):**
108
+ ```
109
+ app/
110
+ ā”œā”€ā”€ config/
111
+ │ └── database.js
112
+ ā”œā”€ā”€ controllers/
113
+ │ └── userController.js
114
+ ā”œā”€ā”€ models/
115
+ │ └── User.js
116
+ ā”œā”€ā”€ routes/
117
+ │ └── api.js
118
+ ā”œā”€ā”€ app.js
119
+ └── package.json
120
+ ```
121
+
122
+ ## šŸ¤ Contributing
123
+
124
+ - Fork the repository
125
+ - Create your feature branch (`git checkout -b feature/amazing-feature`)
126
+ - Commit your changes (`git commit -m 'Add some amazing feature'`)
127
+ - Push to the branch (`git push origin feature/amazing-feature`)
128
+ - Open a Pull Request
129
+
130
+ ## šŸ“œ License
131
+
132
+ MIT Ā© [Your Name]
133
+
134
+ ## šŸ™ Acknowledgments
135
+
136
+ - Inspired by the need for quick project scaffolding
137
+ - Built with Node.js and love
package/bin/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const chalk = require('chalk');
5
- const { parseStructure, createFiles } = require('./generator');
5
+ const { parseStructure, createFiles } = require('../lib/generator');
6
6
  const yargs = require('yargs/yargs');
7
7
  const { hideBin } = require('yargs/helpers');
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "folder-generator",
3
- "version": "1.3.4",
3
+ "version": "1.3.6",
4
4
  "description": "CLI tool to generate folder structures from text input",
5
5
  "bin": {
6
6
  "foldgen": "./bin/cli.js"