@sprouted/create-vibes
Version:
Create a new Vibes monorepo
111 lines (85 loc) • 2.59 kB
Markdown
This directory contains templates used by the Vibes CLI to generate projects and features.
```
templates/
├── base/
├── features/
├── apps/
└── typescript/
```
As of v0.8.0, Vibes is transitioning from Bash-based templates to a TypeScript template engine. This provides:
- **Type Safety**: Full TypeScript support with compile-time checks
- **Testability**: Unit tests for template generation logic
- **Better DX**: Actual template files instead of heredocs
- **Extensibility**: Easy to add new templates and transformations
Located in `base/tools/` and use heredocs:
```bash
cat > file.ts << 'EOF'
content
EOF
```
Located in `typescript/` and use Handlebars:
1. Create a `template.config.json`:
```json
{
"name": "feature",
"type": "feature",
"variables": [
{
"name": "featureName",
"type": "string",
"required": true
}
],
"files": [
{
"source": "index.ts.hbs",
"destination": "index.ts"
}
]
}
```
2. Create template files with `.hbs` extension:
```handlebars
// {{featureName}}/index.ts
export const {{pascalCase featureName}} = {
// implementation
};
```
The template engine provides these Handlebars helpers:
- `{{camelCase str}}`: Convert to camelCase
- `{{pascalCase str}}`: Convert to PascalCase
- `{{kebabCase str}}`: Convert to kebab-case
- `{{
- `{{
The new template system uses structured feature definitions:
```typescript
export const expoRouterFeature: Feature = {
id: 'expo-router',
name: 'Expo Router',
dependencies: ['expo-router'],
postInstall: async (context) => {
// Post-install configuration
}
};
```
- ✅ Template engine core implemented
- ✅ Feature definitions created
- ✅ Tests added
- 🚧 Bash template migration in progress
- 🚧 CLI integration pending
When adding new templates:
1. Use TypeScript templates for new features
2. Follow the existing structure
3. Add tests for complex logic
4. Document any special requirements
For more details, see the [Template Engine Improvements Proposal](/docs/template-engine-improvements-proposal.md).