https://github.com/phucbm/gen-from
CLI tool to generate projects from GitHub template repositories
https://github.com/phucbm/gen-from
Last synced: 12 months ago
JSON representation
CLI tool to generate projects from GitHub template repositories
- Host: GitHub
- URL: https://github.com/phucbm/gen-from
- Owner: phucbm
- License: mit
- Created: 2025-07-01T04:18:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-31T01:53:38.000Z (12 months ago)
- Last Synced: 2025-07-31T04:26:20.301Z (12 months ago)
- Language: JavaScript
- Size: 93.8 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# gen-from
[](https://github.com/phucbm/gen-from/actions/workflows/publish.yml)
[](https://www.npmjs.com/package/gen-from)
[](https://www.npmjs.com/package/gen-from)
[](https://www.npmjs.com/package/gen-from)
[](https://github.com/phucbm/gen-from/)
[](https://github.com/phucbm/gen-from/blob/main/LICENSE)
[](https://webuild.community)
CLI tool to generate projects from GitHub template repositories using tiged.
## Installation
```bash
npm install -g gen-from
```
Or use directly with npx:
```bash
npx gen-from
```
## Usage
### Interactive mode (recommended)
```bash
npx gen-from
```
Shows a list of available templates to choose from.
### Direct template selection
```bash
npx gen-from npm-utils-template
```
### Generate in current directory
```bash
npx gen-from npm-utils-template --here
```
## How it works
1. **Template Selection**: Choose from configured templates or specify directly
2. **Validation**: Checks if the template repository exists on GitHub
3. **Information Collection**: Prompts for project details (name, author, description, etc.)
4. **Download**: Uses tiged to download the latest template files (fast, no git history)
5. **Processing**: Replaces placeholders with your provided information
6. **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:
1. Adding entries to the `templates` array
2. Specifying the GitHub repository path
3. Templates should use the placeholder format above
Example template entry:
```json
{
"name": "my-template",
"description": "My awesome template",
"repo": "username/my-template-repo"
}
```
## Creating Templates
1. Create a GitHub repository with your template files
2. Use placeholders like `{{PACKAGE_NAME}}` in your template files
3. Add your template to the configuration
4. The template will be available in the CLI
## Examples
```bash
# 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 --here
```
## Requirements
- Node.js >= 16
- Git (for tiged to work)
## License
MIT © [phucbm](https://github.com/phucbm)