@polymer-labs/gel-molds
v1.0.0
Published
Collection of project templates and molds for Gel package manager
Maintainers
Readme
@polymer-labs/gel-molds
Collection of project templates and molds for Gel package manager.
Installation
npm install @polymer-labs/gel-moldsUsage with Gel CLI
# List available templates
gel mold --list
# Create project from template
gel mold react my-react-app
gel mold express my-api
gel mold nextjs my-nextjs-appProgrammatic Usage
const { listTemplates, scaffoldTemplate } = require('@polymer-labs/gel-molds');
// List all templates
const templates = listTemplates();
console.log(templates);
// Scaffold a template
await scaffoldTemplate('react', './my-app', {
projectName: 'My React App',
description: 'An awesome React application',
author: 'Your Name',
});Available Templates
Node.js Basic (node)
Basic Node.js project with CommonJS module system.
Includes:
package.jsonwith common scripts.gitignoreREADME.md- Basic
index.jsentry point
React App (react)
Modern React application with Vite.
Includes:
- React 18+ setup
- Vite build configuration
- Hot module replacement
- ESLint & Prettier
- Sample components
Express Server (express)
Express.js REST API server template.
Includes:
- Express 4+ setup
- Middleware configuration
- Route structure
- Error handling
- Environment variables support
TypeScript (typescript)
TypeScript project with proper configuration.
Includes:
tsconfig.json- Type definitions
- Build scripts
- Source maps
Next.js (nextjs)
Next.js full-stack application.
Includes:
- App Router (Next.js 13+)
- TypeScript support
- Tailwind CSS
- API routes
- Server components
Vue.js (vue)
Vue.js 3 application with Composition API.
Includes:
- Vue 3 setup
- Vite configuration
- Composition API examples
- Vue Router
- Pinia state management
Template Structure
Each template follows this structure:
templates/<template-name>/
├── package.json
├── README.md
├── .gitignore
├── src/
│ └── ...
└── public/
└── ...Custom Templates
You can create custom templates by following the structure:
const { scaffoldTemplate } = require('@polymer-labs/gel-molds');
// Register custom template
const customTemplates = {
mytemplate: {
name: 'My Custom Template',
description: 'My awesome template',
path: '/path/to/template',
},
};API
listTemplates()
Returns array of available templates.
Returns:
[
{
id: 'react',
name: 'React App',
description: 'React application with modern tooling',
path: 'templates/react',
},
// ...
];getTemplate(templateId)
Get template details by ID.
Parameters:
templateId(string) - Template identifier
Returns: Template object or undefined
scaffoldTemplate(templateId, targetDir, options)
Create project from template.
Parameters:
templateId(string) - Template to usetargetDir(string) - Destination directoryoptions(Object)projectName(string) - Project namedescription(string) - Project descriptionauthor(string) - Author name
Returns: Promise<{ template, path }>
Variables
Templates support variable replacement:
{{PROJECT_NAME}}- Project name{{PROJECT_DESCRIPTION}}- Project description{{AUTHOR}}- Author name
Example in package.json:
{
"name": "{{PROJECT_NAME}}",
"description": "{{PROJECT_DESCRIPTION}}",
"author": "{{AUTHOR}}"
}Contributing Templates
To contribute a new template:
- Create directory in
templates/ - Add all necessary files
- Use variable placeholders
- Update
TEMPLATESinsrc/index.js - Submit PR
License
MIT © Polymer Labs
