@cabdi_waaxid/tree-gen
v1.0.0
Published
Generate folders and files from ASCII tree structure or path lists
Maintainers
Readme
tree-gen
Generate entire file and folder structures from ASCII tree diagrams or path lists.
Installation
npm install -g @cabdi_waaxid/tree-genUsage
From a tree file
Create a structure.txt file:
my-project/
├── src/
│ ├── index.js
│ ├── utils.js
│ └── components/
│ └── App.js
├── public/
│ └── index.html
├── package.json
└── README.mdRun:
tree-gen structure.txtForce overwrite existing files
tree-gen --force structure.txt
# or
tree-gen -f structure.txtFrom a tree string directly
tree-gen "my-app/├── src/│ ├── index.js│ └── style.css└── README.md"From a list of paths
tree-gen backend/src/server.js backend/src/routes/api.js backend/package.json backend/.envWith trailing slashes for directories
tree-gen logs/ temp/ output/file.txtOptions
| Flag | Description |
|------|-------------|
| --force, -f | Overwrite existing files if they already exist |
Tree Syntax
├──- Branch item└──- Last branch item│- Vertical line connecting nested items─- Horizontal line (ignored)- Trailing
/- Creates a directory instead of a file
Examples
React component structure
src/
├── components/
│ ├── Header.jsx
│ ├── Footer.jsx
│ └── Button.jsx
├── pages/
│ ├── Home.jsx
│ └── About.jsx
├── styles/
│ └── main.css
└── index.jsAPI structure
api/
├── controllers/
│ ├── userController.js
│ └── productController.js
├── models/
│ ├── User.js
│ └── Product.js
├── routes/
│ └── apiRoutes.js
├── middleware/
│ └── auth.js
└── server.jsNotes
- All created files are empty (you'll fill them with content later)
- Existing files are not overwritten by default (use
--forceto overwrite) - The tool automatically creates parent directories as needed
- Tree lines without
├or└are treated as the root directory
License
MIT
