@jmlweb/tsup-config-base 1.1.2 → 1.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @jmlweb/tsup-config-base
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 4a9ece1: Update documentation to use pnpm commands instead of npm
8
+
3
9
  ## 1.1.2
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  ## 📦 Installation
21
21
 
22
22
  ```bash
23
- npm install --save-dev @jmlweb/tsup-config-base tsup
23
+ pnpm add -D @jmlweb/tsup-config-base tsup
24
24
  ```
25
25
 
26
26
  > 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
@@ -170,6 +170,38 @@ export default createTsupCliConfig({
170
170
  });
171
171
  ```
172
172
 
173
+ ## 🤔 Why Use This?
174
+
175
+ > **Philosophy**: TypeScript libraries should publish both CommonJS and ESM formats with type declarations for maximum compatibility across all consuming projects.
176
+
177
+ This package provides a tsup configuration optimized for building TypeScript libraries with dual-format output. It handles the complexity of generating both CommonJS and ESM builds while maintaining proper type definitions and ensuring external dependencies aren't bundled.
178
+
179
+ ### Design Decisions
180
+
181
+ **Dual Format Output (`format: ['cjs', 'esm']`)**: Support both module systems
182
+
183
+ - **Why**: The JavaScript ecosystem is in transition from CommonJS to ESM. Publishing both formats ensures your library works in all environments - legacy Node.js projects using require(), modern ESM projects using import, and bundlers that optimize based on format. This maximizes compatibility
184
+ - **Trade-off**: Slightly larger published package size (two builds). But consumers only use one format, and the compatibility benefit is essential
185
+ - **When to override**: For internal packages consumed only by ESM projects, you can use `['esm']` only. But dual publishing is safer for public libraries
186
+
187
+ **Type Declaration Generation (`dts: true`)**: Automatic .d.ts files
188
+
189
+ - **Why**: TypeScript consumers need type definitions for intellisense, type checking, and developer experience. Generating declarations automatically ensures your library provides first-class TypeScript support without manual maintenance
190
+ - **Trade-off**: Slightly slower builds due to declaration generation. But type safety for consumers is non-negotiable
191
+ - **When to override**: Never for libraries meant to be consumed - types are essential for modern JavaScript development
192
+
193
+ **External Dependencies (`external` array)**: Control bundling
194
+
195
+ - **Why**: Libraries shouldn't bundle their dependencies - this leads to duplicate code, version conflicts, and bloated packages. The `external` parameter lets you specify which dependencies should remain as imports, letting consumers manage versions
196
+ - **Trade-off**: Must carefully specify which dependencies are external (typically all dependencies and peerDependencies)
197
+ - **When to override**: For standalone CLI tools, you might bundle all dependencies. But for libraries, externals are crucial
198
+
199
+ **Clean Builds (`clean: true`)**: Fresh output on every build
200
+
201
+ - **Why**: Cleaning the output directory prevents stale files from previous builds causing issues. Ensures deterministic builds and prevents shipping renamed or deleted files
202
+ - **Trade-off**: Very slightly slower builds (must delete files first). But the reliability is worth it
203
+ - **When to override**: Rarely - clean builds prevent an entire class of mysterious bugs
204
+
173
205
  ## 📋 Configuration Details
174
206
 
175
207
  ### Default Settings
@@ -322,8 +354,8 @@ Add build scripts to your `package.json`:
322
354
  Then run:
323
355
 
324
356
  ```bash
325
- npm run build # Build the package
326
- npm run clean # Clean build output
357
+ pnpm build # Build the package
358
+ pnpm clean # Clean build output
327
359
  ```
328
360
 
329
361
  ## 📋 Requirements
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmlweb/tsup-config-base",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Base tsup configuration for jmlweb projects with sensible defaults",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",