presetter 8.2.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +155 -96
- package/lib/context.d.ts +1 -1
- package/lib/context.d.ts.map +1 -1
- package/lib/debugger.d.ts.map +1 -1
- package/lib/executable/entry.d.ts +20 -1
- package/lib/executable/entry.d.ts.map +1 -1
- package/lib/executable/entry.js +78 -18
- package/lib/index.d.ts +5 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +6 -6
- package/lib/io.d.ts +2 -2
- package/lib/io.d.ts.map +1 -1
- package/lib/io.js +2 -2
- package/lib/parsing.d.ts +92 -0
- package/lib/parsing.d.ts.map +1 -0
- package/lib/parsing.js +209 -0
- package/lib/preset/bootstrap.d.ts.map +1 -1
- package/lib/preset/bootstrap.js +7 -3
- package/lib/preset/config/resolve.d.ts +1 -1
- package/lib/preset/config/resolve.d.ts.map +1 -1
- package/lib/preset/config/resolve.js +1 -1
- package/lib/preset/project.d.ts +2 -2
- package/lib/preset/project.d.ts.map +1 -1
- package/lib/preset/project.js +3 -3
- package/lib/preset/resolution/asset.d.ts +3 -3
- package/lib/preset/resolution/asset.d.ts.map +1 -1
- package/lib/preset/resolution/asset.js +3 -3
- package/lib/preset/resolution/content.d.ts +3 -3
- package/lib/preset/resolution/content.d.ts.map +1 -1
- package/lib/preset/resolution/content.js +3 -3
- package/lib/preset/resolution/debugger.d.ts.map +1 -1
- package/lib/preset/resolution/index.d.ts +1 -0
- package/lib/preset/resolution/index.d.ts.map +1 -1
- package/lib/preset/resolution/index.js +2 -1
- package/lib/preset/resolution/object.d.ts +2 -2
- package/lib/preset/resolution/object.d.ts.map +1 -1
- package/lib/preset/resolution/object.js +1 -1
- package/lib/preset/resolution/preset.d.ts +1 -1
- package/lib/preset/resolution/preset.d.ts.map +1 -1
- package/lib/preset/resolution/roots.d.ts +15 -0
- package/lib/preset/resolution/roots.d.ts.map +1 -0
- package/lib/preset/resolution/roots.js +24 -0
- package/lib/preset/resolution/script.d.ts +5 -2
- package/lib/preset/resolution/script.d.ts.map +1 -1
- package/lib/preset/resolution/script.js +7 -2
- package/lib/preset/resolution/variable.d.ts +1 -1
- package/lib/preset/resolution/variable.d.ts.map +1 -1
- package/lib/preset/scripts.d.ts +6 -2
- package/lib/preset/scripts.d.ts.map +1 -1
- package/lib/preset/scripts.js +5 -6
- package/lib/run.d.ts.map +1 -1
- package/lib/run.js +44 -27
- package/lib/scripts.d.ts +3 -5
- package/lib/scripts.d.ts.map +1 -1
- package/lib/scripts.js +87 -60
- package/lib/serialization.d.ts +1 -1
- package/lib/serialization.d.ts.map +1 -1
- package/lib/task.d.ts +3 -3
- package/lib/task.js +7 -7
- package/lib/template/merge.d.ts +12 -2
- package/lib/template/merge.d.ts.map +1 -1
- package/lib/template/merge.js +161 -1
- package/lib/template/substitute.d.ts +1 -1
- package/lib/template/substitute.d.ts.map +1 -1
- package/lib/utilities/display.js +1 -1
- package/lib/utilities/mapping.d.ts +7 -0
- package/lib/utilities/mapping.d.ts.map +1 -1
- package/lib/utilities/mapping.js +11 -1
- package/package.json +19 -39
- package/types/npmcli__run-script/index.d.ts +1 -0
- package/types/mvdan-sh/index.d.ts +0 -44
package/README.md
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
# 🚀 Presetter
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/alvis/presetter/master/assets/logo.svg" alt="Presetter logo" height="128">
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
7
|
<div align="center">
|
|
6
8
|
|
|
7
9
|
[](https://github.com/alvis/presetter/releases)
|
|
8
|
-
[](https://codeclimate.com/github/alvis/presetter/maintainability)
|
|
10
|
-
[](https://codeclimate.com/github/alvis/presetter/test_coverage)
|
|
11
|
-
[](https://sonarcloud.io/summary/new_code?id=presetter)
|
|
10
|
+
[](https://github.com/alvis/presetter/actions)
|
|
12
11
|
[](https://libraries.io/npm/presetter)
|
|
13
12
|
|
|
14
|
-
Template-driven configuration management
|
|
13
|
+
Template-driven configuration management for TypeScript projects and monorepos ⚡
|
|
15
14
|
|
|
16
15
|
• [Quick Start](#-quick-start) • [CLI Reference](#-cli-reference) • [Presets](#-official-presets) • [Architecture](#-how-it-works) •
|
|
17
16
|
|
|
@@ -19,70 +18,67 @@ Template-driven configuration management — transform 40+ dev dependencies into
|
|
|
19
18
|
|
|
20
19
|
---
|
|
21
20
|
|
|
22
|
-
**Presetter is the configuration management tool that
|
|
21
|
+
**Presetter is the configuration management tool that turns an explicit preset stack into the files and scripts your TypeScript projects need.**
|
|
23
22
|
|
|
24
23
|
## ⚡ The Development Setup Revolution
|
|
25
24
|
|
|
26
25
|
### Still copying configs between projects? 😤
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
Every repo starts clean. Then the same `eslint`, `vitest`, `typescript`, build, and lifecycle settings fork in small ways across apps, packages, services, and CLIs.
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
Presetter moves that intent into `presetter.config.ts`: compose official presets for the shared baseline, keep local overrides visible, and regenerate the config files your toolchain still expects.
|
|
31
30
|
|
|
32
|
-
|
|
31
|
+
<p align="center">
|
|
32
|
+
<video src="https://github.com/user-attachments/assets/03eef833-9c20-4d22-99c7-85f26c620e66" controls playsinline preload="metadata" width="100%" title="Presetter launch video: make configuration maintainable again">
|
|
33
|
+
<a href="https://github.com/user-attachments/assets/03eef833-9c20-4d22-99c7-85f26c620e66">Watch the Presetter launch video</a>
|
|
34
|
+
</video>
|
|
35
|
+
</p>
|
|
36
|
+
|
|
37
|
+
### The config drift loop vs. Presetter
|
|
33
38
|
|
|
34
39
|
```diff
|
|
35
|
-
# Before:
|
|
36
|
-
|
|
37
|
-
├──
|
|
38
|
-
├── .
|
|
39
|
-
├── .
|
|
40
|
-
├── .
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
├──
|
|
47
|
-
|
|
48
|
-
└── ... (dozen more config files) ← Endless configuration maintenance
|
|
49
|
-
|
|
50
|
-
# After: Presetter setup (2 packages, 1 command)
|
|
51
|
-
my-project/
|
|
52
|
-
+├── presetter.config.ts ← Single preset reference
|
|
53
|
-
├── package.json ← 2 devDependencies total!
|
|
54
|
-
└── Perfect configs generated automatically from templates 🎯
|
|
40
|
+
# Before: copied config across repos and packages
|
|
41
|
+
workspace/
|
|
42
|
+
├── apps/web/eslint.config.ts ← React-specific edits
|
|
43
|
+
├── apps/api/eslint.config.ts ← Similar, but not quite the same
|
|
44
|
+
├── packages/ui/vitest.config.ts ← Local test tweaks
|
|
45
|
+
├── packages/core/tsconfig.json ← Shared intent copied by hand
|
|
46
|
+
└── packages/runtime/package.json ← Scripts slowly drift
|
|
47
|
+
|
|
48
|
+
# After: explicit preset stack plus generated outputs
|
|
49
|
+
workspace/
|
|
50
|
+
+├── presetter.config.ts ← Compose the maintained baseline
|
|
51
|
+
├── package.json ← Scripts merge with preset scripts
|
|
52
|
+
└── generated config files ← Output files can stay out of Git
|
|
55
53
|
```
|
|
56
54
|
|
|
57
55
|
---
|
|
58
56
|
|
|
59
|
-
## 🎯
|
|
57
|
+
## 🎯 Compose the Toolchain You Need
|
|
60
58
|
|
|
61
59
|
```bash
|
|
62
|
-
# Choose
|
|
60
|
+
# Choose the preset stack that matches this project:
|
|
63
61
|
|
|
64
62
|
# 🟢 Modern ESM development
|
|
65
|
-
npx presetter use presetter
|
|
63
|
+
npx presetter use @presetter/preset-esm
|
|
66
64
|
|
|
67
65
|
# 🔗 Legacy CommonJS compatibility
|
|
68
|
-
npx presetter use presetter
|
|
66
|
+
npx presetter use @presetter/preset-cjs
|
|
69
67
|
|
|
70
68
|
# 🌐 Dual-module library publishing
|
|
71
|
-
npx presetter use presetter
|
|
69
|
+
npx presetter use @presetter/preset-hybrid
|
|
72
70
|
|
|
73
71
|
# 🎨 Modern web development with TailwindCSS + Storybook
|
|
74
|
-
npx presetter use presetter
|
|
72
|
+
npx presetter use @presetter/preset-esm @presetter/preset-web
|
|
75
73
|
|
|
76
74
|
# ⚛️ React application with optimized toolchain
|
|
77
|
-
npx presetter use presetter
|
|
75
|
+
npx presetter use @presetter/preset-esm @presetter/preset-react
|
|
78
76
|
|
|
79
77
|
# 🏢 Production-grade with security hardening + 100% coverage
|
|
80
|
-
npx presetter use presetter
|
|
78
|
+
npx presetter use @presetter/preset-esm @presetter/preset-strict
|
|
81
79
|
```
|
|
82
80
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-

|
|
81
|
+
TypeScript, ESLint, Vitest, build scripts, git hooks, formatter, linter, bundler — the same maintained baseline can travel across repos while each project keeps the differences that matter.
|
|
86
82
|
|
|
87
83
|
---
|
|
88
84
|
|
|
@@ -95,21 +91,21 @@ Presetter doesn't copy static files. It **generates** configurations using sophi
|
|
|
95
91
|
- **Context-aware**: Presets know about your project structure, dependencies, and requirements
|
|
96
92
|
- **Variable substitution**: Templates use dynamic values (`{source}`, `{target}`, `{output}`)
|
|
97
93
|
- **Smart merging**: Deep merge algorithms handle complex configuration inheritance
|
|
98
|
-
- **Two-pass resolution**: Initial setup + override pass for
|
|
94
|
+
- **Two-pass resolution**: Initial setup + override pass for controlled customization
|
|
99
95
|
|
|
100
96
|
### 🏗️ Composable Preset Architecture
|
|
101
97
|
|
|
102
98
|
Mix and match presets like building blocks:
|
|
103
99
|
|
|
104
100
|
```typescript
|
|
105
|
-
// presetter.config.ts - Build
|
|
101
|
+
// presetter.config.ts - Build the stack this project needs
|
|
106
102
|
import { preset } from 'presetter';
|
|
107
|
-
import essentials from 'presetter
|
|
108
|
-
import web from 'presetter
|
|
109
|
-
import react from 'presetter
|
|
110
|
-
import strict from 'presetter
|
|
103
|
+
import essentials from '@presetter/preset-essentials';
|
|
104
|
+
import web from '@presetter/preset-web';
|
|
105
|
+
import react from '@presetter/preset-react';
|
|
106
|
+
import strict from '@presetter/preset-strict';
|
|
111
107
|
|
|
112
|
-
export default preset('my-
|
|
108
|
+
export default preset('my-app', {
|
|
113
109
|
extends: [essentials, web, react, strict], // 🚀 Ultimate React stack
|
|
114
110
|
override: {
|
|
115
111
|
variables: {
|
|
@@ -121,11 +117,11 @@ export default preset('my-perfect-app', {
|
|
|
121
117
|
|
|
122
118
|
### ⚡ Real Developer Productivity
|
|
123
119
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
|
128
|
-
|
|
|
120
|
+
| Common Setup Pain | With Presetter | Result |
|
|
121
|
+
| ----------------------------------- | -------------------------------------- | ------------------------------- |
|
|
122
|
+
| Rebuilding the same toolchain setup | Compose a preset stack once | Faster project starts |
|
|
123
|
+
| Repeating config updates by hand | Update preset versions and bootstrap | Fewer risky edits |
|
|
124
|
+
| Copy-paste errors across projects | Keep shared intent in one config model | Less drift, clearer differences |
|
|
129
125
|
|
|
130
126
|
---
|
|
131
127
|
|
|
@@ -147,13 +143,13 @@ export default preset('my-perfect-app', {
|
|
|
147
143
|
|
|
148
144
|
## 🚀 Quick Start
|
|
149
145
|
|
|
150
|
-
### 🎬
|
|
146
|
+
### 🎬 Project Setup
|
|
151
147
|
|
|
152
148
|
```bash
|
|
153
|
-
# 1. Choose and adopt a preset
|
|
154
|
-
npx presetter use presetter
|
|
149
|
+
# 1. Choose and adopt a preset stack
|
|
150
|
+
npx presetter use @presetter/preset-esm
|
|
155
151
|
|
|
156
|
-
# 2. Install dependencies
|
|
152
|
+
# 2. Install dependencies and let bootstrap generate tool configs
|
|
157
153
|
npm install
|
|
158
154
|
|
|
159
155
|
# 3. Start developing immediately!
|
|
@@ -169,13 +165,13 @@ npm run watch # ✅ Development mode
|
|
|
169
165
|
# 1. Review current setup (decide what to keep/replace)
|
|
170
166
|
ls -la *.config.* .*rc.* tsconfig*.json
|
|
171
167
|
|
|
172
|
-
# 2. Remove
|
|
173
|
-
|
|
168
|
+
# 2. Remove local config files you want presets to own
|
|
169
|
+
rm eslint.config.ts vitest.config.ts
|
|
174
170
|
|
|
175
171
|
# 3. Adopt presetter
|
|
176
|
-
npx presetter use presetter
|
|
172
|
+
npx presetter use @presetter/preset-esm
|
|
177
173
|
|
|
178
|
-
# 4.
|
|
174
|
+
# 4. Keep only the local overrides that matter
|
|
179
175
|
```
|
|
180
176
|
|
|
181
177
|
---
|
|
@@ -203,15 +199,34 @@ Options:
|
|
|
203
199
|
--version Show version number
|
|
204
200
|
```
|
|
205
201
|
|
|
202
|
+
#### Bootstrap flags
|
|
203
|
+
|
|
204
|
+
| Flag | Alias | Default | Purpose |
|
|
205
|
+
| ------------------- | ----- | ------- | ------------------------------------------------------------------------------------------------- |
|
|
206
|
+
| `--projects <glob>` | `-p` | `.` | Path globs to project directories containing a `package.json` (e.g. `packages/*`, `presets/next`) |
|
|
207
|
+
| `--packages <glob>` | `-P` | _none_ | Package-name globs matching `package.json#name` across the workspace (e.g. `@presetter/preset-*`) |
|
|
208
|
+
| `--only <file>` | | _none_ | Only proceed when the specified file exists |
|
|
209
|
+
|
|
210
|
+
Both `--projects` and `--packages` accept comma-separated values; the wildcard `*` in `--packages` does not cross the npm-scope boundary (so `@presetter/preset-*` will not match `@other/foo`).
|
|
211
|
+
|
|
206
212
|
### 🎯 Common Commands
|
|
207
213
|
|
|
208
214
|
```bash
|
|
209
|
-
# Adopt presets
|
|
210
|
-
presetter use presetter
|
|
215
|
+
# Adopt presets and run bootstrap
|
|
216
|
+
presetter use @presetter/preset-esm @presetter/preset-strict
|
|
211
217
|
|
|
212
218
|
# Manually bootstrap (if needed)
|
|
213
219
|
presetter bootstrap
|
|
214
220
|
|
|
221
|
+
# Bootstrap specific projects by path glob
|
|
222
|
+
presetter bootstrap --projects packages/*
|
|
223
|
+
|
|
224
|
+
# Bootstrap by package name (e.g. every preset package in a monorepo)
|
|
225
|
+
presetter bootstrap --packages "@presetter/preset-*"
|
|
226
|
+
|
|
227
|
+
# Mix path and name globs; both flags accept comma-separated values
|
|
228
|
+
presetter bootstrap --projects .,e2e,packages/* --packages "@presetter/preset-*"
|
|
229
|
+
|
|
215
230
|
# Run development tasks
|
|
216
231
|
run build # Build your project
|
|
217
232
|
run test # Run tests
|
|
@@ -234,21 +249,21 @@ Presetter comes with a comprehensive ecosystem of official presets:
|
|
|
234
249
|
|
|
235
250
|
### Core Development Presets
|
|
236
251
|
|
|
237
|
-
| Preset
|
|
238
|
-
|
|
|
239
|
-
| **[presetter
|
|
240
|
-
| **[presetter
|
|
241
|
-
| **[presetter
|
|
242
|
-
| **[presetter
|
|
252
|
+
| Preset | Purpose | Best For |
|
|
253
|
+
| ----------------------------------------------------------------------------------------------------------- | ------------------------------ | ----------------------------------------- |
|
|
254
|
+
| **[@presetter/preset-essentials](https://github.com/alvis/presetter/blob/main/packages/preset-essentials)** | 🏗️ Complete TypeScript toolkit | Foundation for all TypeScript projects |
|
|
255
|
+
| **[@presetter/preset-esm](https://github.com/alvis/presetter/blob/main/packages/preset-esm)** | 🚀 ESM-first development | Modern Node.js projects, libraries |
|
|
256
|
+
| **[@presetter/preset-cjs](https://github.com/alvis/presetter/blob/main/packages/preset-cjs)** | 🔗 CommonJS compatibility | Legacy environments, enterprise |
|
|
257
|
+
| **[@presetter/preset-hybrid](https://github.com/alvis/presetter/blob/main/packages/preset-hybrid)** | 🌐 Dual-module packages | npm libraries needing broad compatibility |
|
|
243
258
|
|
|
244
259
|
### Specialized Extension Presets
|
|
245
260
|
|
|
246
|
-
| Preset
|
|
247
|
-
|
|
|
248
|
-
| **[presetter
|
|
249
|
-
| **[presetter
|
|
250
|
-
| **[presetter
|
|
251
|
-
| **[presetter
|
|
261
|
+
| Preset | Purpose | Extends |
|
|
262
|
+
| --------------------------------------------------------------------------------------------------- | --------------------------- | --------------- |
|
|
263
|
+
| **[@presetter/preset-strict](https://github.com/alvis/presetter/blob/main/packages/preset-strict)** | 🏢 Production-grade quality | Any base preset |
|
|
264
|
+
| **[@presetter/preset-web](https://github.com/alvis/presetter/blob/main/packages/preset-web)** | 🎨 Modern web development | Any base preset |
|
|
265
|
+
| **[@presetter/preset-react](https://github.com/alvis/presetter/blob/main/packages/preset-react)** | ⚛️ React development | Any base preset |
|
|
266
|
+
| **[@presetter/preset-rollup](https://github.com/alvis/presetter/blob/main/packages/preset-rollup)** | 📦 Library bundling | Any base preset |
|
|
252
267
|
|
|
253
268
|
### 🎯 Preset Combination Examples
|
|
254
269
|
|
|
@@ -299,6 +314,46 @@ Presetter uses a sophisticated **two-pass resolution system** that makes configu
|
|
|
299
314
|
- **Deep Merging**: Sophisticated algorithms handle complex inheritance
|
|
300
315
|
- **Script Composition**: Local scripts merge with preset scripts intelligently
|
|
301
316
|
|
|
317
|
+
### 🔧 Binary Path Resolution
|
|
318
|
+
|
|
319
|
+
When running tasks via `run`, `run-s`, or `run-p`, Presetter prepends binary paths from preset packages to the PATH environment variable. This makes tools in each preset's `node_modules/.bin` directory available without additional configuration.
|
|
320
|
+
|
|
321
|
+
**How it works:**
|
|
322
|
+
|
|
323
|
+
- Direct preset binaries are checked first
|
|
324
|
+
- Extended preset binaries are checked next
|
|
325
|
+
- Finally, the existing PATH is checked
|
|
326
|
+
|
|
327
|
+
**Benefits:**
|
|
328
|
+
|
|
329
|
+
- No need to install shared dev tools at the repository root
|
|
330
|
+
- No need for pnpm's `shamefullyHoist: true` or `public-hoist-pattern` for every tool
|
|
331
|
+
- Preset dependencies are available to templated scripts through the resolved PATH
|
|
332
|
+
|
|
333
|
+
**Limitation - Dynamic Imports:**
|
|
334
|
+
|
|
335
|
+
Libraries loaded via dynamic `import()` may fail because dynamic imports are resolved from the project root, not the preset. This affects libraries that are loaded at runtime rather than through direct imports.
|
|
336
|
+
|
|
337
|
+
**Notable example:** `@vitest/coverage-v8` - required by vitest when using v8 as the coverage engine.
|
|
338
|
+
|
|
339
|
+
**Workarounds:**
|
|
340
|
+
|
|
341
|
+
1. **Install directly:** Add the library to your project's `package.json` (or monorepo root):
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
npm install -D @vitest/coverage-v8
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
2. **Use pnpm hoisting:** Add the library to pnpm's `public-hoist-pattern` in `pnpm-workspace.yaml`:
|
|
348
|
+
|
|
349
|
+
```yaml
|
|
350
|
+
packages:
|
|
351
|
+
- 'packages/*'
|
|
352
|
+
settings:
|
|
353
|
+
public-hoist-pattern:
|
|
354
|
+
- '@vitest/coverage-v8'
|
|
355
|
+
```
|
|
356
|
+
|
|
302
357
|
---
|
|
303
358
|
|
|
304
359
|
## 🛠️ Advanced Usage
|
|
@@ -308,7 +363,7 @@ Presetter uses a sophisticated **two-pass resolution system** that makes configu
|
|
|
308
363
|
```typescript
|
|
309
364
|
// presetter.config.ts
|
|
310
365
|
import { preset } from 'presetter';
|
|
311
|
-
import esm from 'presetter
|
|
366
|
+
import esm from '@presetter/preset-esm';
|
|
312
367
|
|
|
313
368
|
export default preset('my-project', {
|
|
314
369
|
extends: [esm],
|
|
@@ -365,22 +420,22 @@ Combine preset scripts with your local scripts:
|
|
|
365
420
|
|
|
366
421
|
### ✅ Developer Experience
|
|
367
422
|
|
|
368
|
-
- **⚡
|
|
369
|
-
- **🔄 Consistent updates**: Update
|
|
370
|
-
- **🎯
|
|
371
|
-
- **🚀 Composable architecture**: Mix and match presets to
|
|
423
|
+
- **⚡ Repeatable setup**: Adopt a preset stack and generate the expected tool configs
|
|
424
|
+
- **🔄 Consistent updates**: Update projects by updating preset versions
|
|
425
|
+
- **🎯 Recommended baselines**: Configurations follow maintained TypeScript tooling patterns
|
|
426
|
+
- **🚀 Composable architecture**: Mix and match presets to fit each project shape
|
|
372
427
|
|
|
373
428
|
### ✅ Project Management
|
|
374
429
|
|
|
375
|
-
- **📦
|
|
376
|
-
- **🔧 Maintenance simplification**: Single source of truth for configurations
|
|
377
|
-
- **🌐 Team consistency**: Same
|
|
378
|
-
- **📈 Scalability**: Manage configurations across
|
|
430
|
+
- **📦 Config drift reduction**: Keep shared toolchain intent in `presetter.config.ts`
|
|
431
|
+
- **🔧 Maintenance simplification**: Single source of truth for generated configurations
|
|
432
|
+
- **🌐 Team consistency**: Same baseline across team members and projects
|
|
433
|
+
- **📈 Scalability**: Manage configurations across many repos and monorepo packages
|
|
379
434
|
|
|
380
435
|
### ✅ Technical Excellence
|
|
381
436
|
|
|
382
437
|
- **🧠 Intelligent merging**: Sophisticated algorithms handle complex configurations
|
|
383
|
-
- **🔄 Two-pass resolution**: Initial setup + override for
|
|
438
|
+
- **🔄 Two-pass resolution**: Initial setup + override for controlled customization
|
|
384
439
|
- **📝 Template system**: Dynamic, context-aware configuration generation
|
|
385
440
|
- **🎛️ Fine-grained control**: Override anything while maintaining preset benefits
|
|
386
441
|
|
|
@@ -388,11 +443,11 @@ Combine preset scripts with your local scripts:
|
|
|
388
443
|
|
|
389
444
|
## 🆚 Alternatives Comparison
|
|
390
445
|
|
|
391
|
-
| Solution | Setup
|
|
392
|
-
| ------------------- |
|
|
393
|
-
| **Manual Setup** |
|
|
394
|
-
| **Boilerplate/CRA** |
|
|
395
|
-
| **Presetter** |
|
|
446
|
+
| Solution | Setup Model | Maintenance | Consistency | Flexibility |
|
|
447
|
+
| ------------------- | ---------------------------- | ----------------- | ------------------- | ----------- |
|
|
448
|
+
| **Manual Setup** | Hand-copy each config | Repeated by hand | Drifts easily | Full |
|
|
449
|
+
| **Boilerplate/CRA** | Copy a starter project once | Template ages | Medium | Limited |
|
|
450
|
+
| **Presetter** | Compose presets and generate | Versioned presets | Maintained baseline | Full |
|
|
396
451
|
|
|
397
452
|
---
|
|
398
453
|
|
|
@@ -421,7 +476,7 @@ DEBUG=presetter* run build
|
|
|
421
476
|
|
|
422
477
|
### How is this different from boilerplates?
|
|
423
478
|
|
|
424
|
-
Boilerplates copy static files once. Presetter **generates** configurations dynamically and **maintains** them through preset updates. When you update a preset
|
|
479
|
+
Boilerplates copy static files once. Presetter **generates** configurations dynamically and **maintains** them through preset updates. When you update a preset and run `bootstrap`, projects using it can pick up the same improvements.
|
|
425
480
|
|
|
426
481
|
### Can I customize generated configurations?
|
|
427
482
|
|
|
@@ -437,11 +492,15 @@ Simply update the preset package version in your projects. Presetter will regene
|
|
|
437
492
|
|
|
438
493
|
### Can I create my own presets?
|
|
439
494
|
|
|
440
|
-
Absolutely! Presets are just npm packages that export configuration templates. See [presetter
|
|
495
|
+
Absolutely! Presets are just npm packages that export configuration templates. See [@presetter/types](https://github.com/alvis/presetter/blob/main/packages/types) for TypeScript definitions.
|
|
441
496
|
|
|
442
497
|
### Does this work with monorepos?
|
|
443
498
|
|
|
444
|
-
Yes! Presetter supports monorepo setups and can bootstrap multiple projects with glob patterns. Use [presetter
|
|
499
|
+
Yes! Presetter supports monorepo setups and can bootstrap multiple projects with glob patterns. Use [@presetter/preset-monorepo](https://github.com/alvis/presetter/blob/main/packages/preset-monorepo) for monorepo-specific configurations.
|
|
500
|
+
|
|
501
|
+
### Why do some dynamically imported libraries fail to resolve?
|
|
502
|
+
|
|
503
|
+
While Presetter makes preset tools available via PATH, libraries loaded through dynamic `import()` (like `@vitest/coverage-v8`) resolve from your project root, not the preset. Install such libraries directly at your project root or add them to pnpm's `public-hoist-pattern` in `pnpm-workspace.yaml`.
|
|
445
504
|
|
|
446
505
|
---
|
|
447
506
|
|
|
@@ -449,13 +508,13 @@ Yes! Presetter supports monorepo setups and can bootstrap multiple projects with
|
|
|
449
508
|
|
|
450
509
|
We'd love your ideas and contributions!
|
|
451
510
|
Submit issues or suggestions via [GitHub Issues](https://github.com/alvis/presetter/issues).
|
|
452
|
-
See the [Contribution Guide](https://github.com/alvis/presetter/blob/
|
|
511
|
+
See the [Contribution Guide](https://github.com/alvis/presetter/blob/main/CONTRIBUTING.md) for more details.
|
|
453
512
|
|
|
454
513
|
---
|
|
455
514
|
|
|
456
515
|
## 📄 License
|
|
457
516
|
|
|
458
|
-
Released under the [MIT License](https://github.com/alvis/presetter/blob/
|
|
517
|
+
Released under the [MIT License](https://github.com/alvis/presetter/blob/main/LICENSE).
|
|
459
518
|
© 2020, [Alvis Tang](https://github.com/alvis).
|
|
460
519
|
|
|
461
|
-
[](https://github.com/alvis/presetter/blob/
|
|
520
|
+
[](https://github.com/alvis/presetter/blob/main/LICENSE)
|
package/lib/context.d.ts
CHANGED
package/lib/context.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;;GAIG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,cAAc,CAAC,CAgCzB;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B"}
|
package/lib/debugger.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debugger.d.ts","sourceRoot":"","sources":["../src/debugger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC
|
|
1
|
+
{"version":3,"file":"debugger.d.ts","sourceRoot":"","sources":["../src/debugger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC"}
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
+
interface ResolveProjectRootsOptions {
|
|
2
|
+
readonly projects: readonly string[];
|
|
3
|
+
readonly packages: readonly string[];
|
|
4
|
+
}
|
|
1
5
|
/**
|
|
2
6
|
* provide a command line interface
|
|
3
7
|
* @param args command line arguments
|
|
4
|
-
* @returns the command entered together with its options
|
|
5
8
|
*/
|
|
6
9
|
export declare function entry(args: string[]): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* resolve target project roots from path globs and package-name globs
|
|
12
|
+
* @param options resolution inputs
|
|
13
|
+
* @param options.projects path globs (e.g. `presets/next`, `packages/*`)
|
|
14
|
+
* @param options.packages package-name globs (e.g. `@presetter/preset-*`)
|
|
15
|
+
* @returns deduped absolute project root paths
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveProjectRoots(options: ResolveProjectRootsOptions): Promise<string[]>;
|
|
18
|
+
/**
|
|
19
|
+
* expand each entry by splitting on a delimiter and trimming the parts
|
|
20
|
+
* @param values raw flag values, each possibly containing the delimiter
|
|
21
|
+
* @param delimiter delimiter character (defaults to `,`)
|
|
22
|
+
* @returns flattened, trimmed, non-empty values
|
|
23
|
+
*/
|
|
24
|
+
export declare function expandDelimitedValues(values: readonly string[], delimiter?: string): string[];
|
|
25
|
+
export {};
|
|
7
26
|
//# sourceMappingURL=entry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/executable/entry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entry.d.ts","sourceRoot":"","sources":["../../src/executable/entry.ts"],"names":[],"mappings":"AAmBA,UAAU,0BAA0B;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AA8GD;;;GAGG;AACH,wBAAsB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAezD;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,GAClC,OAAO,CAAC,MAAM,EAAE,CAAC,CA+BnB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,SAAS,GAAE,MAA+B,GACzC,MAAM,EAAE,CAOV"}
|