@jmlweb/tsconfig-node 1.0.3 → 1.0.5
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 +56 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @jmlweb/tsconfig-node
|
|
2
2
|
|
|
3
|
+
## 1.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4a9ece1: Update documentation to use pnpm commands instead of npm
|
|
8
|
+
- Updated dependencies [4a9ece1]
|
|
9
|
+
- @jmlweb/tsconfig-base@1.0.4
|
|
10
|
+
|
|
11
|
+
## 1.0.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 6b73301: Add changelog section with link to CHANGELOG.md in package READMEs
|
|
16
|
+
- Updated dependencies [6b73301]
|
|
17
|
+
- @jmlweb/tsconfig-base@1.0.3
|
|
18
|
+
|
|
3
19
|
## 1.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -18,9 +18,11 @@
|
|
|
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
|
+
> 💡 **Upgrading from a previous version?** See the [Migration Guide](#-migration-guide) for breaking changes and upgrade instructions.
|
|
25
|
+
|
|
24
26
|
## 🚀 Quick Start
|
|
25
27
|
|
|
26
28
|
Create a `tsconfig.json` file in your project root:
|
|
@@ -101,6 +103,32 @@ Create a `tsconfig.json` file in your project root:
|
|
|
101
103
|
}
|
|
102
104
|
```
|
|
103
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
|
+
|
|
104
132
|
## 📋 Configuration Details
|
|
105
133
|
|
|
106
134
|
### What's Included
|
|
@@ -226,7 +254,7 @@ This package requires the following peer dependencies:
|
|
|
226
254
|
For Node.js projects, you should also install:
|
|
227
255
|
|
|
228
256
|
```bash
|
|
229
|
-
|
|
257
|
+
pnpm add -D @types/node
|
|
230
258
|
```
|
|
231
259
|
|
|
232
260
|
This provides Node.js-specific type definitions like `Buffer`, `process`, `fs`, etc.
|
|
@@ -239,10 +267,35 @@ See real-world usage examples:
|
|
|
239
267
|
|
|
240
268
|
## 🔗 Related Packages
|
|
241
269
|
|
|
270
|
+
### Internal Packages
|
|
271
|
+
|
|
242
272
|
- [`@jmlweb/tsconfig-base`](../tsconfig-base) - Base TypeScript configuration (extended by this package)
|
|
243
|
-
- [`@jmlweb/eslint-config-
|
|
273
|
+
- [`@jmlweb/eslint-config-node`](../eslint-config-node) - ESLint configuration for Node.js projects
|
|
244
274
|
- [`@jmlweb/prettier-config-base`](../prettier-config-base) - Prettier config for consistent formatting
|
|
245
275
|
|
|
276
|
+
### External Tools
|
|
277
|
+
|
|
278
|
+
- [TypeScript](https://www.typescriptlang.org/) - Strongly typed programming language that builds on JavaScript
|
|
279
|
+
- [Node.js](https://nodejs.org/) - JavaScript runtime built on Chrome's V8 engine
|
|
280
|
+
- [tsx](https://github.com/privatenumber/tsx) - TypeScript execute (ts-node alternative)
|
|
281
|
+
- [ts-node](https://typestrong.org/ts-node/) - TypeScript execution engine for Node.js
|
|
282
|
+
|
|
283
|
+
## 🔄 Migration Guide
|
|
284
|
+
|
|
285
|
+
### Upgrading to a New Version
|
|
286
|
+
|
|
287
|
+
> **Note:** If no breaking changes were introduced in a version, it's safe to upgrade without additional steps.
|
|
288
|
+
|
|
289
|
+
**No breaking changes have been introduced yet.** This package follows semantic versioning. When breaking changes are introduced, detailed migration instructions will be provided here.
|
|
290
|
+
|
|
291
|
+
For version history, see the [Changelog](./CHANGELOG.md).
|
|
292
|
+
|
|
293
|
+
**Need Help?** If you encounter issues during migration, please [open an issue](https://github.com/jmlweb/tooling/issues/new).
|
|
294
|
+
|
|
295
|
+
## 📜 Changelog
|
|
296
|
+
|
|
297
|
+
See [CHANGELOG.md](./CHANGELOG.md) for version history and release notes.
|
|
298
|
+
|
|
246
299
|
## 📄 License
|
|
247
300
|
|
|
248
301
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmlweb/tsconfig-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
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.4"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {}
|
|
43
43
|
}
|