@jmlweb/tsconfig-node 1.0.4 → 1.0.6
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 +16 -0
- package/README.md +28 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @jmlweb/tsconfig-node
|
|
2
2
|
|
|
3
|
+
## 1.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 30f8ffb: Add "Why Use This?" sections to package READMEs explaining configuration philosophy and design decisions
|
|
8
|
+
- Updated dependencies [30f8ffb]
|
|
9
|
+
- @jmlweb/tsconfig-base@1.0.5
|
|
10
|
+
|
|
11
|
+
## 1.0.5
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 4a9ece1: Update documentation to use pnpm commands instead of npm
|
|
16
|
+
- Updated dependencies [4a9ece1]
|
|
17
|
+
- @jmlweb/tsconfig-base@1.0.4
|
|
18
|
+
|
|
3
19
|
## 1.0.4
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
## 📦 Installation
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
|
|
21
|
+
pnpm add -D @jmlweb/tsconfig-node typescript @jmlweb/tsconfig-base
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
@@ -103,6 +103,32 @@ Create a `tsconfig.json` file in your project root:
|
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
+
## 🤔 Why Use This?
|
|
107
|
+
|
|
108
|
+
> **Philosophy**: Node.js projects should use only Node.js and ES types, avoiding browser APIs that don't exist in the runtime.
|
|
109
|
+
|
|
110
|
+
This package provides a TypeScript configuration specifically for Node.js server-side development and CLI tools. It extends the strict base configuration while carefully excluding browser/DOM types that would allow you to accidentally use APIs that don't exist in Node.js.
|
|
111
|
+
|
|
112
|
+
### Design Decisions
|
|
113
|
+
|
|
114
|
+
**ES-Only Library Types (`lib: ["ES2022"]`)**: Excludes DOM and browser APIs
|
|
115
|
+
|
|
116
|
+
- **Why**: Node.js doesn't have browser APIs like `window`, `document`, or DOM event types. Including DOM types in a Node.js project allows you to accidentally write code that compiles but crashes at runtime. This config prevents that entire class of bugs
|
|
117
|
+
- **Trade-off**: Must install `@types/node` separately for Node.js-specific types. But you need that anyway for Node.js development
|
|
118
|
+
- **When to override**: If building a universal library that runs in both Node.js and browsers (but consider having separate tsconfigs for each environment)
|
|
119
|
+
|
|
120
|
+
**NodeNext Module Resolution (`moduleResolution: "NodeNext"`)**: Matches Node.js module behavior
|
|
121
|
+
|
|
122
|
+
- **Why**: Node.js has specific module resolution rules, especially with ESM. `NodeNext` resolution matches exactly how Node.js resolves modules, preventing mismatches between TypeScript compilation and runtime behavior
|
|
123
|
+
- **Trade-off**: Requires following Node.js ESM rules (explicit file extensions, package.json exports). But these are Node.js requirements anyway
|
|
124
|
+
- **When to override**: For legacy CommonJS-only projects, you might use `node` resolution, but `NodeNext` works for both CommonJS and ESM
|
|
125
|
+
|
|
126
|
+
**Dual Module Support**: Works with both CommonJS and ESM
|
|
127
|
+
|
|
128
|
+
- **Why**: Node.js supports both module systems through package.json `type` field and file extensions. This config respects those conventions, making it work seamlessly whether you're using CommonJS, ESM, or gradually migrating
|
|
129
|
+
- **Trade-off**: Must be deliberate about module format choices in your package.json
|
|
130
|
+
- **When to override**: Never - this flexibility is essential for modern Node.js development
|
|
131
|
+
|
|
106
132
|
## 📋 Configuration Details
|
|
107
133
|
|
|
108
134
|
### What's Included
|
|
@@ -228,7 +254,7 @@ This package requires the following peer dependencies:
|
|
|
228
254
|
For Node.js projects, you should also install:
|
|
229
255
|
|
|
230
256
|
```bash
|
|
231
|
-
|
|
257
|
+
pnpm add -D @types/node
|
|
232
258
|
```
|
|
233
259
|
|
|
234
260
|
This provides Node.js-specific type definitions like `Buffer`, `process`, `fs`, etc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/tsconfig-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "TypeScript configuration for Node.js and CLI projects. Extends @jmlweb/tsconfig-base with Node.js-specific settings excluding DOM types.",
|
|
5
5
|
"main": "tsconfig.json",
|
|
6
6
|
"exports": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"typescript": ">=5.0.0",
|
|
40
|
-
"@jmlweb/tsconfig-base": "1.0.
|
|
40
|
+
"@jmlweb/tsconfig-base": "1.0.5"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {}
|
|
43
43
|
}
|