@ipget/tree-gen
v0.5.2
Published
Generate folder structure from ASCII tree
Downloads
7
Maintainers
Readme
tree-gen
Generate folder and file structures from ASCII tree diagrams. Perfect for quickly scaffolding project structures from documentation or planning notes.
Installation
Install globally via npm:
npm install -g @ipget/tree-genUsage
From a file
tree-gen structure.txtInteractive mode (paste directly)
tree-gen -i
# Paste your tree structure, then press Ctrl+D (Unix/Mac) or Ctrl+Z (Windows)Dry run (preview without creating)
tree-gen -d structure.txt
tree-gen -i -dHelp
tree-gen --helpTree Format
tree-gen supports standard ASCII tree format with box-drawing characters:
- Folders: End with a trailing slash
/ - Files: Have an extension or no extension
- Box characters:
├──,│,└──(automatically parsed)
Example Tree
project/
├── src/
│ ├── components/
│ │ ├── Header.js
│ │ └── Footer.js
│ ├── utils/
│ │ └── helpers.js
│ └── index.js
├── public/
│ └── index.html
├── package.json
└── README.mdCreating this structure
Save the tree to a file structure.txt and run:
tree-gen structure.txtOr use interactive mode:
tree-gen -i
# Paste the tree above, press Ctrl+DOutput
✓ Created folder: project/
✓ Created folder: project/src/
✓ Created folder: project/src/components/
✓ Created file: project/src/components/Header.js
✓ Created file: project/src/components/Footer.js
✓ Created folder: project/src/utils/
✓ Created file: project/src/utils/helpers.js
✓ Created file: project/src/index.js
✓ Created folder: project/public/
✓ Created file: project/public/index.html
✓ Created file: project/package.json
✓ Created file: project/README.md
Summary:
Folders: 5
Files: 7Options
| Option | Description |
|--------|-------------|
| -i, --interactive | Enter interactive mode to paste tree structure |
| -d, --dry-run | Preview the structure without creating files/folders |
| --help | Show help message |
Features
- ✅ Zero dependencies (only Node.js built-ins)
- ✅ Works with standard ASCII tree format
- ✅ Automatically detects folders (trailing
/) and files - ✅ Creates nested directory structures
- ✅ Skips existing files/folders
- ✅ Dry-run mode for safe previewing
- ✅ Interactive mode for pasting trees directly
- ✅ Cross-platform (Windows, Mac, Linux)
Tips
Copy from documentation: Many projects display their structure as ASCII trees - copy and paste directly!
Generate from tree command: On Unix systems, you can use the
treecommand output:
tree -F > structure.txt
tree-gen structure.txtMix files and folders: Files can have extensions, no extensions, or be explicitly marked
Flexible formatting: Works with various indentation styles and box characters
Examples
Simple project structure
app/
├── src/
│ └── main.js
└── tests/
└── test.jsFrontend project
my-app/
├── public/
│ ├── favicon.ico
│ └── index.html
├── src/
│ ├── App.js
│ ├── index.js
│ └── styles.css
├── package.json
└── README.mdAPI project
api/
├── controllers/
│ ├── userController.js
│ └── authController.js
├── models/
│ └── User.js
├── routes/
│ └── api.js
├── config/
│ └── database.js
├── server.js
└── .envRequirements
- Node.js >= 14.0.0
License
MIT
Contributing
Contributions welcome! Please open an issue or submit a pull request on GitHub.
Author
Of the North
Support
If you encounter any issues or have questions, please open an issue.
## **Publishing to npm**
### 1. Update package.json
Replace `yourusername` with your actual GitHub username and update the author field.
### 2. Create .gitignorenode_modules/ .DS_Store *.log
