{"id":13457646,"url":"https://github.com/alvis/presetter","last_synced_at":"2026-06-28T01:01:49.025Z","repository":{"id":40556646,"uuid":"280081905","full_name":"alvis/presetter","owner":"alvis","description":"🛹 Reuse and manage build scripts, devDependencies and config files from your favourite presets, instead of copy and paste!","archived":false,"fork":false,"pushed_at":"2025-06-20T09:34:09.000Z","size":11839,"stargazers_count":68,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-20T09:37:18.643Z","etag":null,"topics":["build-tool","dependency","eslint","life-cycle-script","project-management"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alvis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-07-16T07:14:17.000Z","updated_at":"2025-06-20T09:34:13.000Z","dependencies_parsed_at":"2024-10-02T11:10:43.893Z","dependency_job_id":"62138624-5f19-4996-97e6-1020d534933f","html_url":"https://github.com/alvis/presetter","commit_stats":{"total_commits":439,"total_committers":1,"mean_commits":439.0,"dds":0.0,"last_synced_commit":"5c92019101821d17aff5ce43175bfa70856c89d7"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/alvis/presetter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvis%2Fpresetter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvis%2Fpresetter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvis%2Fpresetter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvis%2Fpresetter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alvis","download_url":"https://codeload.github.com/alvis/presetter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alvis%2Fpresetter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260923904,"owners_count":23083498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","dependency","eslint","life-cycle-script","project-management"],"created_at":"2024-07-31T09:00:32.833Z","updated_at":"2026-06-28T01:01:44.003Z","avatar_url":"https://github.com/alvis.png","language":"TypeScript","funding_links":[],"categories":["HTML","TypeScript","project-management"],"sub_categories":[],"readme":"# ![Logo](assets/logo.svg)\n\n\u003cdiv align=\"center\"\u003e\n\n[![npm](https://img.shields.io/npm/v/presetter?style=flat-square)](https://github.com/alvis/presetter/releases)\n[![build](https://img.shields.io/github/actions/workflow/status/alvis/presetter/test.yaml?branch=master\u0026style=flat-square)](https://github.com/alvis/presetter/actions)\n[![maintainability](https://img.shields.io/codeclimate/maintainability/alvis/presetter?style=flat-square)](https://codeclimate.com/github/alvis/presetter/maintainability)\n[![coverage](https://img.shields.io/codeclimate/coverage/alvis/presetter?style=flat-square)](https://codeclimate.com/github/alvis/presetter/test_coverage)\n[![dependencies](https://img.shields.io/librariesio/release/npm/presetter?style=flat-square)](https://libraries.io/npm/presetter)\n[![license](https://img.shields.io/github/license/alvis/presetter.svg?style=flat-square)](https://github.com/alvis/presetter/blob/master/LICENSE)\n\n_Transform 40+ dev dependencies into 2 packages — template-driven configuration management for modern TypeScript development_\n\n• [Quick Start](#-quick-start) • [Monorepo Structure](#-monorepo-structure) • [Official Presets](#-official-presets) • [Usage](#-usage) •\n\n\u003c/div\u003e\n\n**Presetter** is a configuration management tool that eliminates the pain of setting up and maintaining build configurations across TypeScript projects. Instead of copying dozens of config files and managing 40+ dev dependencies, you install 2 packages and get a perfectly configured development environment.\n\nThis monorepo contains the **Presetter engine** and a comprehensive ecosystem of **official presets** for every TypeScript development scenario.\n\n![Before and After](assets/before-and-after.jpg)\n\n---\n\n## 🚀 Quick Start\n\n### 🎯 Choose Your Development Style\n\n```bash\n# 🟢 Modern ESM development\nnpx presetter use presetter-preset-esm\n\n# 🔗 Legacy CommonJS compatibility\nnpx presetter use presetter-preset-cjs\n\n# 🌐 Dual-module library publishing\nnpx presetter use presetter-preset-hybrid\n\n# 🎨 Modern web development (TailwindCSS + Storybook)\nnpx presetter use presetter-preset-esm presetter-preset-web\n\n# ⚛️ React application with optimized toolchain\nnpx presetter use presetter-preset-esm presetter-preset-react\n\n# 🏢 Production-grade (security + 100% coverage)\nnpx presetter use presetter-preset-esm presetter-preset-strict\n```\n\n### 🔧 Or Set It Up Manually\n\n1. **Add Presetter and preset to your project:**\n\n```json\n{\n  \"scripts\": {\n    \"bootstrap\": \"presetter bootstrap\"\n  },\n  \"devDependencies\": {\n    \"presetter\": \"latest\",\n    \"presetter-preset-esm\": \"latest\"\n  }\n}\n```\n\n2. **Create preset configuration:**\n\n```typescript\n// presetter.config.ts\nexport { default } from 'presetter-preset-esm';\n```\n\n3. **Install and start developing:**\n\n```bash\nnpm install  # Configurations generated automatically\nnpm run test # Everything just works! ✨\n```\n\n![Demo](assets/demo.gif)\n\n---\n\n## 🏗️ Monorepo Structure\n\nThis repository is organized as a TypeScript monorepo containing the core Presetter engine and all official presets:\n\n```\npresetter/\n├── packages/\n│   ├── presetter/              🎛️ Core configuration management engine\n│   ├── types/                  📋 TypeScript definitions for preset development\n│   │\n│   ├── preset-essentials/      🏗️ Foundation toolkit (TypeScript, ESLint, Vitest)\n│   ├── preset-monorepo/        📦 Monorepo project management\n│   │\n│   ├── preset-esm/             🚀 ESM-first development\n│   ├── preset-cjs/             🔗 CommonJS compatibility\n│   ├── preset-hybrid/          🌐 Dual CommonJS/ESM packages\n│   │\n│   ├── preset-strict/          🏢 Production-grade quality enforcement\n│   ├── preset-web/             🎨 Modern web development stack\n│   ├── preset-react/           ⚛️ React development excellence\n│   └── preset-rollup/          📦 Professional library bundling\n│\n├── assets/                     🎨 Logos, demos, and documentation assets\n├── .rules/                     📜 Shared repository rules and configs\n└── website/                    🌐 Documentation website\n```\n\n### 🎯 Package Categories\n\n| **Category**       | **Packages**                                                   | **Purpose**                              |\n| ------------------ | -------------------------------------------------------------- | ---------------------------------------- |\n| **Core Engine**    | `presetter`, `types`                                           | Configuration management infrastructure  |\n| **Foundation**     | `preset-essentials`, `preset-monorepo`                         | Base TypeScript development toolkit      |\n| **Module Systems** | `preset-esm`, `preset-cjs`, `preset-hybrid`                    | JavaScript module format specializations |\n| **Extensions**     | `preset-strict`, `preset-web`, `preset-react`, `preset-rollup` | Specialized development environments     |\n\n---\n\n## 📦 Official Presets\n\n### 🏗️ Foundation Presets\n\n| Preset                                                        | Purpose                                 | Dependencies                                | Best For                               |\n| ------------------------------------------------------------- | --------------------------------------- | ------------------------------------------- | -------------------------------------- |\n| **[presetter-preset-essentials](packages/preset-essentials)** | Complete TypeScript development toolkit | TypeScript, ESLint, Vitest, Prettier, Husky | Foundation for all TypeScript projects |\n| **[presetter-preset-monorepo](packages/preset-monorepo)**     | Monorepo project management             | Workspace tools, cross-package scripts      | Multi-package repositories             |\n\n### 🚀 Module System Presets\n\n| Preset                                                | Purpose                    | Extends    | Best For                                  |\n| ----------------------------------------------------- | -------------------------- | ---------- | ----------------------------------------- |\n| **[presetter-preset-esm](packages/preset-esm)**       | ESM-first development      | essentials | Modern Node.js projects, libraries        |\n| **[presetter-preset-cjs](packages/preset-cjs)**       | CommonJS compatibility     | essentials | Legacy environments, enterprise           |\n| **[presetter-preset-hybrid](packages/preset-hybrid)** | Dual CommonJS/ESM packages | essentials | npm libraries needing broad compatibility |\n\n### 🎨 Specialized Extension Presets\n\n| Preset                                                | Purpose                              | Extends         | Best For                                  |\n| ----------------------------------------------------- | ------------------------------------ | --------------- | ----------------------------------------- |\n| **[presetter-preset-strict](packages/preset-strict)** | Production-grade quality enforcement | Any base preset | Enterprise applications, critical systems |\n| **[presetter-preset-web](packages/preset-web)**       | Modern web development stack         | Any base preset | Web applications, SPAs                    |\n| **[presetter-preset-react](packages/preset-react)**   | React development excellence         | Any base preset | React applications, component libraries   |\n| **[presetter-preset-rollup](packages/preset-rollup)** | Professional library bundling        | Any base preset | npm packages, open-source libraries       |\n\n### 🎯 Common Preset Combinations\n\n```typescript\n// Modern web application\nextends: [essentials, esm, web, strict]\n\n// React component library\nextends: [essentials, hybrid, react, rollup]\n\n// Enterprise Node.js service\nextends: [essentials, cjs, strict]\n\n// Full-stack TypeScript monorepo\nextends: [monorepo, essentials, web, react]\n```\n\n---\n\n## 🔍 How Presetter Works\n\n**Presetter** transforms configuration management through intelligent template processing:\n\n### 🎛️ The Core Engine ([packages/presetter](packages/presetter))\n\nPresetter handles two main responsibilities:\n\n1. **🏗️ Environment Setup:**\n\n   - Installs development dependencies defined by presets\n   - Generates configuration files using sophisticated templates\n   - Manages complex dependency trees and version conflicts\n\n2. **⚡ Script Management:**\n   - Merges preset scripts with local `package.json` scripts\n   - Provides intelligent script composition and execution\n   - Enables `run`, `run-s`, and `run-p` commands for enhanced workflows\n\n### 📋 Preset Architecture\n\nEach preset is a reusable configuration bundle containing:\n\n- **Dependencies**: Defined as `peerDependencies` and installed automatically\n- **Configuration Templates**: Dynamic files that adapt to your project structure\n- **Scripts**: Lifecycle commands that integrate with your local workflows\n- **Variables**: Customizable parameters for flexible configuration\n\n### 🧠 Two-Pass Resolution System\n\nPresetter uses a sophisticated resolution process:\n\n1. **📋 Dependency Resolution**: Build preset inheritance tree and merge configurations\n2. **🎯 Asset Generation**: Process templates with context-aware variable substitution\n3. **⚡ Override Application**: Apply customizations while preserving preset benefits\n\n---\n\n## 🛠️ Usage\n\n### 📝 Basic Configuration\n\n```typescript\n// presetter.config.ts - Use a preset as-is\nexport { default } from 'presetter-preset-esm';\n```\n\n### 🎨 Advanced Customization\n\n```typescript\n// presetter.config.ts - Customize and extend presets\nimport { preset } from 'presetter';\nimport esm from 'presetter-preset-esm';\nimport strict from 'presetter-preset-strict';\n\nexport default preset('my-project', {\n  extends: [esm, strict],\n  override: {\n    variables: {\n      target: 'ES2023', // Modern compilation target\n      source: 'source', // Custom source directory\n    },\n    assets: {\n      'tsconfig.json': {\n        compilerOptions: {\n          allowImportingTsExtensions: true,\n        },\n      },\n    },\n  },\n});\n```\n\n### ⚡ CLI Commands\n\n```bash\n# Preset management\npresetter use \u003cpreset\u003e         # Adopt preset(s) to project\npresetter bootstrap           # Apply configurations\npresetter unset              # Remove all preset artifacts\n\n# Development workflows\nrun build                    # Build your project\nrun test                     # Run tests with coverage\nrun lint                     # Lint and fix code\nrun watch                    # Development mode\n\n# Advanced execution\nrun-s clean build test       # Sequential execution\nrun-p lint test              # Parallel execution\n```\n\n---\n\n## 🏢 Monorepo Development\n\n### 🔧 Development Setup\n\nThis monorepo uses **Presetter itself** for development! Each package has its own preset configuration:\n\n```bash\n# Install dependencies\nnpm install\n\n# Bootstrap all packages\nnpm run bootstrap\n\n# Run tests across all packages\nnpm run test\n\n# Build all packages\nnpm run build\n```\n\n### 📊 Package Dependencies\n\n```mermaid\ngraph TD\n    A[presetter] --\u003e B[types]\n    C[preset-essentials] --\u003e B\n    D[preset-esm] --\u003e C\n    E[preset-cjs] --\u003e C\n    F[preset-hybrid] --\u003e C\n    G[preset-strict] --\u003e B\n    H[preset-web] --\u003e B\n    I[preset-react] --\u003e B\n    J[preset-rollup] --\u003e B\n    K[preset-monorepo] --\u003e C\n```\n\n### 🎯 Workspace Scripts\n\nThe monorepo provides convenient workspace-wide commands:\n\n| Command             | Purpose                                |\n| ------------------- | -------------------------------------- |\n| `npm run build`     | Build all packages in dependency order |\n| `npm run test`      | Run tests across all packages          |\n| `npm run lint`      | Lint all packages with auto-fix        |\n| `npm run clean`     | Clean build artifacts                  |\n| `npm run bootstrap` | Bootstrap all preset configurations    |\n\n---\n\n## 📖 Documentation\n\n### 📚 Package Documentation\n\nEach package contains comprehensive documentation:\n\n- **[Core Engine Documentation](packages/presetter)** - CLI usage, configuration, advanced features\n- **[Preset Development Guide](packages/types)** - TypeScript definitions and preset creation\n- **Individual Preset Guides** - Detailed feature explanations and usage examples\n\n### 🎓 Learning Resources\n\n| Topic               | Resource                                                  |\n| ------------------- | --------------------------------------------------------- |\n| **Getting Started** | [Core Engine Quick Start](packages/presetter#quick-start) |\n| **Preset Creation** | [Types Package Guide](packages/types)                     |\n| **Advanced Usage**  | [Configuration Customization](#-advanced-customization)   |\n| **Monorepo Setup**  | [Monorepo Preset Guide](packages/preset-monorepo)         |\n\n---\n\n## 🤝 Contributing\n\nWe welcome contributions to improve Presetter and its ecosystem!\n\n### 🚀 Development Workflow\n\n1. **Fork and clone** this repository\n2. **Install dependencies**: `npm install`\n3. **Bootstrap packages**: `npm run bootstrap`\n4. **Make your changes** in the appropriate package\n5. **Test thoroughly**: `npm run test`\n6. **Submit a pull request** with a clear description\n\n### 📋 Contribution Guidelines\n\n- **Follow existing patterns** - Study current presets before creating new ones\n- **Test thoroughly** - Ensure your changes work across different scenarios\n- **Document clearly** - Update README files and include usage examples\n- **Maintain compatibility** - Avoid breaking changes without major version bumps\n\nSee our [Contributing Guide](CONTRIBUTING.md) for detailed information.\n\n---\n\n## ❓ FAQ\n\n### How do I create a custom preset?\n\nCreate a TypeScript file that exports a preset configuration:\n\n```typescript\nimport { preset } from 'presetter';\n\nexport default preset('my-preset', {\n  variables: {\n    source: 'src',\n    output: 'dist',\n  },\n  scripts: {\n    build: 'tsc',\n    test: 'vitest',\n  },\n  assets: {\n    'tsconfig.json': {\n      compilerOptions: {\n        target: 'ES2022',\n        module: 'ESNext',\n      },\n    },\n  },\n});\n```\n\n### How do I customize an existing preset?\n\nUse the `override` field to modify preset configurations:\n\n```typescript\nimport { preset } from 'presetter';\nimport esm from 'presetter-preset-esm';\n\nexport default preset('custom', {\n  extends: [esm],\n  override: {\n    assets: {\n      'tsconfig.json': {\n        compilerOptions: {\n          strict: false, // Relax TypeScript strictness\n        },\n      },\n    },\n  },\n});\n```\n\n### Can I combine multiple presets?\n\nYes! Presets are designed to be composable:\n\n```typescript\nimport { preset } from 'presetter';\nimport essentials from 'presetter-preset-essentials';\nimport web from 'presetter-preset-web';\nimport react from 'presetter-preset-react';\nimport strict from 'presetter-preset-strict';\n\nexport default preset('ultimate-react', {\n  extends: [essentials, web, react, strict],\n});\n```\n\n### How do I ignore files from a preset?\n\nOverride the asset with `null`:\n\n```typescript\nexport default preset('custom', {\n  extends: [somePreset],\n  override: {\n    assets: {\n      '.gitignore': null, // Don't generate .gitignore\n    },\n  },\n});\n```\n\n---\n\n## 🌟 Philosophy\n\nPresetter was born from the frustration of maintaining identical configurations across multiple TypeScript projects. The core principles:\n\n- **🎯 Simplicity**: One command should set up a complete development environment\n- **🔄 Maintainability**: Updates should propagate automatically across all projects\n- **🧩 Composability**: Presets should work together seamlessly\n- **⚡ Flexibility**: Local customizations should always be respected\n- **📈 Scalability**: Should work for individual projects and large monorepos\n\n---\n\n## 📄 License\n\nReleased under the [MIT License](LICENSE).\n© 2020, [Alvis Tang](https://github.com/alvis).\n\n[![License](https://img.shields.io/github/license/alvis/presetter.svg?style=flat-square)](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvis%2Fpresetter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falvis%2Fpresetter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falvis%2Fpresetter/lists"}