@mkappelhof/ts-config 2.0.1 → 2.1.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/AGENTS.md CHANGED
@@ -11,6 +11,7 @@ Check `extends` in the project's `tsconfig.json`:
11
11
  | `@mkappelhof/ts-config/next.json` | Next.js apps | ESM, bundler resolution, type-check only (`noEmit`) |
12
12
  | `@mkappelhof/ts-config/react.json` | React apps and libraries built with a bundler (Vite, etc.) | ESM, bundler resolution, type-check only (`noEmit`) |
13
13
  | `@mkappelhof/ts-config/node.json` | Node.js 24+ services, scripts and CLIs | Native Node ESM (`NodeNext`) |
14
+ | `@mkappelhof/ts-config/nest.json` | NestJS services | CommonJS, legacy decorators (`experimentalDecorators`, `emitDecoratorMetadata`) |
14
15
  | `@mkappelhof/ts-config/library.json` | React libraries built with a bundler that publish type declarations | ESM, bundler resolution, declaration emit only (`emitDeclarationOnly`) |
15
16
  | `@mkappelhof/ts-config/astro.json` | Astro sites and apps | ESM, bundler resolution, type-check only (`noEmit`), `jsx: "preserve"` |
16
17
 
@@ -52,6 +53,12 @@ Check `extends` in the project's `tsconfig.json`:
52
53
  - Top-level `await` is allowed.
53
54
  - `@types/node` must be installed. It is the only ambient types package loaded (`"types": ["node"]`); add others to `types` in the project's `tsconfig.json`.
54
55
 
56
+ ## nest.json
57
+
58
+ - CommonJS, not ESM: `module`/`moduleResolution` are `commonjs`/`node`. Use `require`/`module.exports` semantics via `import`/`export` as Nest's CLI generates them; there's no `"type": "module"` requirement and no file-extension-in-import rule.
59
+ - `experimentalDecorators` and `emitDecoratorMetadata` are on, and `erasableSyntaxOnly`/`verbatimModuleSyntax` are off (unlike every other preset in this package). Parameter properties (`constructor(private readonly foo: FooService) {}`) and decorators (`@Injectable()`, `@Controller()`, etc.) are expected and fine to use here — this is the one preset where that's true.
60
+ - Run `nest build` (or `tsc -p tsconfig.build.json` if the project has one) to compile; don't switch the project to `tsc --noEmit`-only workflows.
61
+
55
62
  ## astro.json
56
63
 
57
64
  - `jsx` is `"preserve"`, not `"react-jsx"`. `.astro` files are their own syntax, compiled by the Astro compiler, not `tsc`; this setting only matters for `.tsx` islands (e.g. from `@astrojs/react`), and Astro's Vite plugin handles their actual JSX transform regardless of this setting.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @mkappelhof/ts-config
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3c4c6b4: Add `nest.json` preset for NestJS services: CommonJS, `experimentalDecorators`/`emitDecoratorMetadata` on, `erasableSyntaxOnly`/`verbatimModuleSyntax` off so parameter properties and decorator-based DI work.
8
+
3
9
  ## 2.0.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -7,6 +7,7 @@ Shared `tsconfig.json` presets for TypeScript 6 and 7.
7
7
  | `@mkappelhof/ts-config/next.json` | Next.js applications |
8
8
  | `@mkappelhof/ts-config/react.json` | React apps and libraries built with a bundler (Vite, Rsbuild, etc.) |
9
9
  | `@mkappelhof/ts-config/node.json` | Node.js 24+ services, scripts and CLIs (native ESM) |
10
+ | `@mkappelhof/ts-config/nest.json` | NestJS services (CommonJS, legacy decorators) |
10
11
  | `@mkappelhof/ts-config/library.json` | React libraries built with a bundler that publish type declarations |
11
12
  | `@mkappelhof/ts-config/astro.json` | Astro sites and apps |
12
13
 
@@ -83,6 +84,25 @@ Set `"type": "module"` in your `package.json`, then:
83
84
 
84
85
  The code only uses erasable TypeScript syntax, so you can run it directly with `node src/index.ts` or compile it with `tsc`. Relative imports must include an extension (`./util.ts`), which is rewritten to `.js` on emit.
85
86
 
87
+ ### NestJS
88
+
89
+ ```sh
90
+ pnpm add -D @types/node
91
+ ```
92
+
93
+ ```JSON
94
+ {
95
+ "extends": "@mkappelhof/ts-config/nest.json",
96
+ "compilerOptions": {
97
+ "outDir": "dist",
98
+ "rootDir": "src"
99
+ },
100
+ "include": ["src"]
101
+ }
102
+ ```
103
+
104
+ Unlike the other presets, this one stays on CommonJS and legacy decorators (`experimentalDecorators`, `emitDecoratorMetadata`) with `erasableSyntaxOnly` and `verbatimModuleSyntax` off, since Nest's constructor-based DI relies on parameter properties and decorator metadata. Build with `nest build` (or `tsc -p tsconfig.build.json`).
105
+
86
106
  ### Astro
87
107
 
88
108
  ```JSON
package/nest.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://www.schemastore.org/tsconfig",
3
+ "display": "NestJS",
4
+ "compilerOptions": {
5
+ "target": "ES2023",
6
+ "lib": [
7
+ "ES2023"
8
+ ],
9
+ "module": "commonjs",
10
+ "moduleResolution": "node",
11
+ "moduleDetection": "force",
12
+ "types": [
13
+ "node"
14
+ ],
15
+ "resolveJsonModule": true,
16
+ "experimentalDecorators": true,
17
+ "emitDecoratorMetadata": true,
18
+ "strict": true,
19
+ "noUncheckedIndexedAccess": true,
20
+ "noImplicitOverride": true,
21
+ "noFallthroughCasesInSwitch": true,
22
+ "skipLibCheck": true
23
+ }
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mkappelhof/ts-config",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "main": "base.json",
5
5
  "license": "MIT",
6
6
  "repository": "git@github.com:mkappelhof/frontend-tools.git",