npm package: @polymer-labs/gel-molds
Description: Collection of project templates and molds for Gel package manager
Author: Polymer Labs
Latest version: 1.0.0

# @polymer-labs/gel-molds

Collection of project templates and molds for Gel package manager.

## Installation

```bash
npm install @polymer-labs/gel-molds
```

## Usage with Gel CLI

```bash
# 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-app
```

## Programmatic Usage

```javascript
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.json` with common scripts
- `.gitignore`
- `README.md`
- Basic `index.js` entry 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:

```javascript
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:**

```javascript
[
  {
    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 use
- `targetDir` (string) - Destination directory
- `options` (Object)
  - `projectName` (string) - Project name
  - `description` (string) - Project description
  - `author` (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`:

```json
{
  "name": "{{PROJECT_NAME}}",
  "description": "{{PROJECT_DESCRIPTION}}",
  "author": "{{AUTHOR}}"
}
```

## Contributing Templates

To contribute a new template:

1. Create directory in `templates/`
2. Add all necessary files
3. Use variable placeholders
4. Update `TEMPLATES` in `src/index.js`
5. Submit PR

## License

MIT © Polymer Labs