@mkappelhof/ts-config 2.0.1 → 2.1.1
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 +7 -0
- package/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +20 -0
- package/nest.json +24 -0
- package/package.json +6 -5
- package/.turbo/turbo-build.log +0 -13
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,17 @@
|
|
|
1
1
|
# @mkappelhof/ts-config
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bb566eb: Update settings
|
|
8
|
+
|
|
9
|
+
## 2.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 3c4c6b4: Add `nest.json` preset for NestJS services: CommonJS, `experimentalDecorators`/`emitDecoratorMetadata` on, `erasableSyntaxOnly`/`verbatimModuleSyntax` off so parameter properties and decorator-based DI work.
|
|
14
|
+
|
|
3
15
|
## 2.0.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Maurice
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mkappelhof/ts-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"main": "base.json",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "git@github.com:mkappelhof/frontend-tools.git",
|
|
7
7
|
"author": "Maurice Kappelhof <maurice@mauricekappelhof.nl>",
|
|
8
|
-
"scripts": {
|
|
9
|
-
"test": "echo 'No test step'"
|
|
10
|
-
},
|
|
11
8
|
"peerDependencies": {
|
|
12
9
|
"typescript": "^6.0.0 || ^7.0.0"
|
|
13
10
|
},
|
|
@@ -15,5 +12,9 @@
|
|
|
15
12
|
"typescript",
|
|
16
13
|
"tsconfig",
|
|
17
14
|
"config"
|
|
18
|
-
]
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "echo 'No test step'",
|
|
18
|
+
"clean": "rimraf node_modules"
|
|
19
|
+
}
|
|
19
20
|
}
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @mkappelhof/ts-config@1.0.7 build /Users/mauricekappelhof/Dev/frontend-tools/packages/ts-config
|
|
3
|
-
> rollup -c
|
|
4
|
-
|
|
5
|
-
[36m
|
|
6
|
-
[1m./base.json[22m → [1m./dist/base.json[22m...[39m
|
|
7
|
-
[1m[33m(!) Mixing named and default exports[39m[22m
|
|
8
|
-
[90mhttps://rollupjs.org/configuration-options/#output-exports[39m
|
|
9
|
-
[1mThe following entry modules are using named and default exports together:[22m
|
|
10
|
-
base.json
|
|
11
|
-
|
|
12
|
-
Consumers of your bundle will have to use chunk.default to access their default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.
|
|
13
|
-
[32mcreated [1m./dist/base.json[22m in [1m22ms[22m[39m
|