gen-from
v0.0.8
Published
CLI tool to generate projects from GitHub template repositories
Maintainers
Readme
gen-from
CLI tool to generate projects from GitHub template repositories using tiged.
Installation
npm install -g gen-fromOr use directly with npx:
npx gen-fromUsage
Interactive mode (recommended)
npx gen-fromShows a list of available templates to choose from.
Direct template selection
npx gen-from npm-utils-templateGenerate in current directory
npx gen-from npm-utils-template --hereHow it works
- Template Selection: Choose from configured templates or specify directly
- Validation: Checks if the template repository exists on GitHub
- Information Collection: Prompts for project details (name, author, description, etc.)
- Download: Uses tiged to download the latest template files (fast, no git history)
- Processing: Replaces placeholders with your provided information
- Ready: Your project is ready to use!
Template Placeholders
The following placeholders are automatically replaced in template files:
{{PROJECT_NAME}}- Project directory name{{PACKAGE_NAME}}- NPM package name{{USERNAME}}- GitHub username{{AUTHOR_NAME}}- Author full name{{DESCRIPTION}}- Package description{{KEYWORDS}}- Keywords (comma-separated){{LICENSE}}- License type
Configuration
Templates are configured in templates.json. You can add your own templates by:
- Adding entries to the
templatesarray - Specifying the GitHub repository path
- Templates should use the placeholder format above
Example template entry:
{
"name": "my-template",
"description": "My awesome template",
"repo": "username/my-template-repo"
}Creating Templates
- Create a GitHub repository with your template files
- Use placeholders like
{{PACKAGE_NAME}}in your template files - Add your template to the configuration
- The template will be available in the CLI
Examples
# Interactive template selection
npx gen-from
# Generate from specific template
npx gen-from npm-utils-template
# Generate in current directory
npx gen-from react-component-template --hereRequirements
- Node.js >= 16
- Git (for tiged to work)
License
MIT © phucbm
