Skip to content

CLI tool to generate project structures from text, JSON templates, file, with boilerplate and git integration

License

Notifications You must be signed in to change notification settings

ayush-git228/treemk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌳 treemk πŸ“¦ - Project Structure Generator

Generate complete project folders in seconds

πŸš€ Quick Start (3 Ways)

1. Inline Text (Easiest!)

npx treemk --text "src/index.js
src/app.js
tests/test.js
README.md" -o ./myapp

2. Inline JSON

npx treemk --json-input '{"src":["index.js","app.js"],"tests":["test.js"]}' -o ./myapp

3. From File

npx treemk -i structure.txt -o ./myapp

πŸ“₯ Installation

# Use directly (recommended)
npx treemk --help

# Or install globally
npm install -g treemk

🎯 Common Use Cases

Create a Node.js API

npx treemk --template node -o ./my-api --boilerplate --install --git-init

Create React App

npx treemk --template react -o ./my-react-app --boilerplate

Save Your Own Template

# Save once
npx treemk --text "src/server.js
src/routes/api.js
tests/test.js" --template-save my-api

# Reuse forever
npx treemk --template-use my-api -o ./new-api

Preview Before Creating

npx treemk -i structure.txt --preview

πŸ“ Input Formats

Plain Text (Simple)

src/index.js
src/components/App.jsx
tests/test.js
package.json

Tree Format (Visual)

my-app/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.js
β”‚   └── components/
β”‚       └── App.jsx
└── package.json

JSON Format

{
  "src": {
    "components": ["App.jsx"],
    "index.js": null
  },
  "package.json": null
}

🎨 Smart Boilerplate (--boilerplate)

Automatically generates working code for:

  • server.js β†’ Express server ready to run
  • route.js β†’ RESTful API routes
  • model.js β†’ Database models
  • test.js β†’ Jest test setup
  • .env β†’ Environment variables template
  • .gitignore β†’ Comprehensive ignore rules
  • Dockerfile β†’ Docker configuration
  • And more!

πŸ“‹ All Commands

Basic

-i, --input <file>      # File path (works from anywhere!)
-o, --output <path>     # Where to create (default: ./output)
-b, --boilerplate       # Add smart code templates
-h, --help              # Show help

Templates

--template <name>           # Use: react, node, python
--template-save <name>      # Save for reuse
--template-use <name>       # Load saved template
--template-list             # Show all templates
--template-remove <name>    # Delete template

Inline Input (No files!)

--text "<structure>"        # Pass structure directly
--json-input '<json>'       # Pass JSON directly

Git

-g, --git-init         # Initialize git
--git-commit           # Make first commit
--git-push             # Push to GitHub (needs gh CLI)

Advanced

--install              # Auto npm/pip install
--preview              # Show tree preview
-u, --from-url <url>   # Fetch from URL
-d, --dry-run          # Preview without creating

πŸ’‘ Real Examples

Example 1: Quick Microservice

npx treemk --text "src/server.js
src/routes/users.js
src/routes/products.js
src/models/User.js
tests/api.test.js
.env
.gitignore
package.json" -o ./my-service -b --install -g

Example 2: Python Project

npx treemk --template python -o ./my-python-app -b --install --git-init

Example 3: From Anywhere

# File in Downloads folder? No problem!
npx treemk -i structure.txt -o ./app

# File on Desktop? Works!
npx treemk -i ~/Desktop/project.txt -o ./app

Example 4: Full Automation

npx treemk --template node \
  -o ./api \
  --boilerplate \
  --install \
  --git-init \
  --git-commit

βš™οΈ Config File (Optional)

Create treemk.config.json in your project folder:

{
  "output": "./app",
  "boilerplate": true,
  "gitInit": true,
  "install": true
}

Then just run:

npx treemk --template node

πŸ“‚ Where Templates Are Saved

~/.treemk/templates/ - Your saved templates live here

πŸ” Troubleshooting

"Cannot find file"

  • Try absolute path: /home/user/structure.txt
  • Or just filename if in Downloads/Documents/Desktop
  • Use --text to avoid files entirely!

"No input provided"

# Use one of these:
npx treemk --text "src/index.js"
npx treemk -i file.txt
npx treemk --template node
cat file.txt | npx treemk -o ./app

πŸ“¦ Requirements

  • Node.js 16+ (check: node --version)
  • npm comes with Node.js
  • Optional: gh CLI for GitHub push

πŸŽ“ Complete Tutorial

See [QuickStart.md] for step-by-step guide.

πŸ“„ License

MIT License - Free to use for everyone!

⭐ Quick Reference Card

# Fastest ways to create projects:
npx treemk --template node -o ./app -b         # Node.js
npx treemk --template react -o ./app -b        # React
npx treemk --template python -o ./app -b       # Python

# No file needed:
npx treemk --text "src/index.js..." -o ./app

# Save template once, use forever:
npx treemk -i my-structure.txt --template-save my-template
npx treemk --template-use my-template -o ./new-project

Made for developers who value speed! ⚑

About

CLI tool to generate project structures from text, JSON templates, file, with boilerplate and git integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published