create-bunspace
v0.3.1
Published
Multi-template project scaffolder for Bun
Downloads
717
Readme
create-bunspace
Multi-template project scaffolder for Bun with git submodule templates
CLI scaffolder to create new projects from templates. Supports multiple templates via git submodules with automatic synchronization.
Quick Start
# Create a new project (default: monorepo)
bun create bunspace my-project
# Create with specific template
bun create bunspace my-bot --template telegram-bot
# Create with all options
bun create bunspace my-app --template monorepo --yes --no-gitAvailable Templates
| Template | Description | |----------|-------------| | monorepo | Bun monorepo for npm packages with workspaces | | telegram-bot | Production-ready Telegram bot with Telegraf and TypeScript |
Usage
Basic Usage
# Interactive mode (prompts for template and config)
bun create bunspace my-project
# Skip prompts with defaults
bun create bunspace my-project --yes
# Specific template
bun create bunspace my-project --template telegram-botOptions
| Option | Alias | Description |
|--------|-------|-------------|
| --template <name> | -t | Template to use (monorepo, telegram-bot) |
| --scope <scope> | -s | npm scope (e.g., @my-org) |
| --description <text> | -d | Project description |
| --author <name> | -a | Author name |
| --dir <path> | | Target directory |
| --yes | -y | Skip prompts, use defaults |
| --no-git | | Don't initialize git |
| --no-install | | Don't run bun install |
| --help | -h | Show help |
Examples
# Monorepo with defaults
bun create bunspace my-lib
# Telegram bot with prompts
bun create bunspace my-bot --template telegram-bot
# Skip all prompts
bun create bunspace my-app -t monorepo -y
# Custom scope and description
bun create bunspace my-app --scope @mycompany --description "My app"Template Management
The scaffolder uses git submodules for templates, allowing easy updates:
# List templates and their git status
bun run templates:list
# Sync all templates to latest
bun run templates:sync
# Sync specific template
bun run templates:sync monorepoDevelopment
# Clone repository
git clone https://github.com/MKS2508/mks-scaffolder.git
cd mks-scaffolder
# Install dependencies
bun install
# Run CLI directly
bun run dev my-project --template monorepo
# Build
bun run build
# Type check
bun run typecheckHow It Works
- Template Resolution: Checks git submodules first (
templates/), falls back to embedded templates (dist/templates/) - Placeholder Replacement: Replaces
{{PLACEHOLDER}}patterns in template files - Project Generation: Copies files, replaces placeholders, and optionally runs
bun install
Template System
Adding a New Template
Add as git submodule:
git submodule add <repo-url> templates/<name>Update
scripts/embed-templates.jsto include the new templateAdd template choice to
src/prompts.ts:selectTemplate()Add placeholder generation to
src/generator.ts:generatePlaceholders()
Placeholder Syntax
Templates use {{PLACEHOLDER}} syntax for variable substitution:
Monorepo Template:
{{NAME}}- Project name{{SCOPE}}- npm scope (without @){{DESCRIPTION}}- Project description{{AUTHOR}}- Author name{{YEAR}}- Current year
Telegram Bot Template:
{{BOT_NAME}}- Bot name{{BOT_SCOPE}}- npm scope (without @){{BOT_DESCRIPTION}}- Bot description{{TG_BOT_TOKEN}}- Bot token{{AUTHOR}}- Author name{{YEAR}}- Current year
Architecture
mks-scaffolder/
├── bin.ts # Executable entry point
├── src/
│ ├── cli.ts # Main CLI orchestration
│ ├── generator.ts # Project generation
│ ├── template-manager.ts # Git submodule management
│ ├── prompts.ts # Interactive prompts
│ ├── types.ts # TypeScript definitions
│ └── utils.ts # Utilities
├── scripts/
│ └── embed-templates.js # Copies templates to dist/
├── templates/
│ ├── monorepo/ # Submodule: mks-bun-monorepo
│ └── telegram-bot/ # Submodule: mks-telegram-bot
└── dist/
└── bin.js # Built CLI (for npm publishing)Documentation
- CLAUDE.md - Developer documentation and architecture guide
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT © MKS2508
