@4mbl/tsconfig 0.0.0-alpha.9b8878c

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 ADDED
@@ -0,0 +1,65 @@
1
+ # @4mbl/tsconfig Changelog
2
+
3
+ ## 4.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 05ab9ba: [browser,node,node-ts] Replace `baseUrl` with `paths` catch-all to improve TypeScript 7 support.
8
+
9
+ ## 4.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - ce274df: node-ts: add rewriteRelativeImportExtensions
14
+
15
+ ## 4.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 090f642: Add node-ts template.
20
+
21
+ ## 4.1.3
22
+
23
+ ### Patch Changes
24
+
25
+ - 0957212: Migrate to monorepo setup internally. No changes to the package itself.
26
+
27
+ ## 4.1.2
28
+
29
+ - Setup npm trusted publishing. No changes to the package itself.
30
+
31
+ ## 4.1.1
32
+
33
+ - Fixed missing artifacts in the previous release.
34
+
35
+ ## 4.1.0
36
+
37
+ - Add vite-react template.
38
+
39
+ ## 4.0.1
40
+
41
+ - Move `baseUrl` definition from the base template to child templates to improve Next.js support.
42
+
43
+ ## 4.0.0
44
+
45
+ - Migrated from versioned templates to a single template per type. The package version is now used to determine the template version. This simplifies both the maintenance and usage of the package.
46
+ - Enabled the following options in the base template:
47
+ - `declarationMap`
48
+ - `tsBuildInfoFile` set to `node_modules/.tmp/tsbuildinfo`
49
+ - `verbatimModuleSyntax`
50
+ - `allowSyntheticDefaultImports`
51
+ - `noImplicitOverride`
52
+ - In the Next.js all paths now use paths relative to the project.
53
+ - Removed `tsBuildInfoFile` from browser template in favor of the base template value.
54
+
55
+ ## 3.0.0
56
+
57
+ - Enabled `erasableSyntaxOnly` option in the base template. Requires TypeScript 5.8.0+.
58
+
59
+ ## 2.0.0
60
+
61
+ - Changed path options to use `${configDir}` instead of relative paths in base template. Requires TypeScript 5.5.0+.
62
+
63
+ ## 1.0.0
64
+
65
+ - Initial release
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @4mbl/tsconfig
2
+
3
+ > Strict TypeScript configuration for various environments.
4
+
5
+ * [Usage](#usage)
6
+ * [Available templates](#available-templates)
7
+ * [Base (tsconfig)](#base-tsconfig)
8
+ * [Node (tsconfig)](#node-tsconfig)
9
+ * [Node-TS (tsconfig)](#node-ts-tsconfig)
10
+ * [Browser (tsconfig)](#browser-tsconfig)
11
+ * [Next (tsconfig)](#next-tsconfig)
12
+ * [Vite React (app | node)](#vite-react-app--node)
13
+ * [Versioning](#versioning)
14
+
15
+ ---
16
+
17
+ ## Usage
18
+
19
+ Install the [`@4mbl/tsconfig`](https://www.npmjs.com/package/@4mbl/tsconfig) npm package.
20
+
21
+ ```shell
22
+ npm install -D @4mbl/tsconfig
23
+ ```
24
+
25
+ Create a `tsconfig.json` file in the root of your project and extend the desired `tsconfig` template.
26
+
27
+ ```jsonc
28
+ {
29
+ "extends": "@4mbl/tsconfig/node"
30
+ // your custom configuration...
31
+ }
32
+ ```
33
+
34
+ ## Available templates
35
+
36
+ These are the currently available `tsconfig` templates.
37
+
38
+ ### Base (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/base.json)</kbd>)
39
+
40
+ This is the base `tsconfig` file that is used by the other templates. It contains common configuration for TypeScript with minimal environment specific configuration.
41
+
42
+ ### Node (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/node.json)</kbd>)
43
+
44
+ Extends the base template with configuration specific to Node.js.
45
+
46
+ ### Node-TS (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/node-ts.json)</kbd>)
47
+
48
+ Extends the node template with configuration for TypeScript-only projects.
49
+
50
+ ### Browser (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/browser.json)</kbd>)
51
+
52
+ Extends the base template with configuration specific to browser and React applications.
53
+
54
+ ### Next (<kbd>[tsconfig](https://unpkg.com/@4mbl/tsconfig@latest/next.json)</kbd>)
55
+
56
+ Extends the base template with configuration from the Next.js app template.
57
+
58
+ [Next.js does not yet support tsconfig template variables](https://github.com/vercel/next.js/issues/70912), so you need to override the paths manually on the `tsconfig.json` file of your project.
59
+
60
+ ```jsonc
61
+ {
62
+ "extends": "@4mbl/tsconfig/next",
63
+ "compilerOptions": {
64
+ "paths": {
65
+ "@/*": ["./src/*"]
66
+ }
67
+ },
68
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
69
+ "exclude": ["node_modules"]
70
+ }
71
+ ```
72
+
73
+ ### Vite React (<kbd>[app](https://unpkg.com/@4mbl/tsconfig@latest/vite-react/app.json)</kbd> | <kbd>[node](https://unpkg.com/@4mbl/tsconfig@latest/vite-react/node.json)</kbd>)
74
+
75
+ Extends the base template with configuration from Vite's `react-ts` preset.
76
+
77
+ Vite uses seperate `tsconfig` files for the application and the node environment. So you need to have three files in total:
78
+
79
+ **`tsconfig.json`**
80
+
81
+ ```jsonc
82
+ {
83
+ "files": [],
84
+ "references": [
85
+ { "path": "./tsconfig.app.json" },
86
+ { "path": "./tsconfig.node.json" }
87
+ ]
88
+ }
89
+ ```
90
+
91
+ **`tsconfig.app.json`**
92
+
93
+ ```jsonc
94
+ {
95
+ "extends": "@4mbl/tsconfig/vite-react/app"
96
+ }
97
+ ```
98
+
99
+ **`tsconfig.node.json`**
100
+
101
+ ```jsonc
102
+ {
103
+ "extends": "@4mbl/tsconfig/vite-react/node"
104
+ }
105
+ ```
106
+
107
+ ## Versioning
108
+
109
+ As of version 4.0.0, the package migrated to a single template per type. The package version is now used to determine the template version. This simplifies both the maintenance and usage of the package.
110
+
111
+ The package follows the following versioning scheme: `X.Y.Z`
112
+
113
+ - `X` - Breaking changes to the base template.
114
+ - `Y` - Breaking changes to individual, non-base templates. New templates may be introduced.
115
+ - `Z` - Minor fixes to any template.
package/dist/base.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Base",
4
+ "compilerOptions": {
5
+ /* Base Options */
6
+ "lib": ["ESNext"],
7
+ "allowJs": true,
8
+ "skipLibCheck": true,
9
+ "resolveJsonModule": true,
10
+ "moduleDetection": "force",
11
+ "paths": {
12
+ "@/*": ["${configDir}/src/*"]
13
+ },
14
+
15
+ /* Output */
16
+ "target": "ES6",
17
+ "outDir": "${configDir}/dist",
18
+ "sourceMap": true,
19
+ "declarationMap": true,
20
+ "declaration": true,
21
+ "incremental": true,
22
+ "isolatedModules": true,
23
+ "esModuleInterop": true,
24
+ "tsBuildInfoFile": "${configDir}/node_modules/.tmp/tsconfig.tsbuildinfo",
25
+ "verbatimModuleSyntax": true,
26
+
27
+ /* Linting */
28
+ "strict": true,
29
+ "checkJs": true,
30
+ "erasableSyntaxOnly": true,
31
+ "forceConsistentCasingInFileNames": true,
32
+ "allowSyntheticDefaultImports": true,
33
+ "noFallthroughCasesInSwitch": true,
34
+ "noImplicitAny": true,
35
+ "noImplicitOverride": true,
36
+ "noImplicitReturns": false,
37
+ "noUnusedLocals": true,
38
+ "noUnusedParameters": true,
39
+ "noUncheckedIndexedAccess": true
40
+ },
41
+ "include": ["${configDir}/src/**/*"],
42
+ "exclude": ["${configDir}/node_modules"]
43
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Browser",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "lib": ["DOM", "DOM.Iterable", "ESNext"],
7
+ "jsx": "react-jsx",
8
+ "module": "ESNext",
9
+ "moduleResolution": "Bundler",
10
+ "paths": { "*": ["${configDir}/src/*"] },
11
+ "noEmit": true,
12
+ "sourceMap": true
13
+ }
14
+ }
package/dist/next.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Next.js",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "target": "ES2017",
7
+ "lib": ["dom", "dom.iterable", "esnext"],
8
+ "allowJs": true,
9
+ "skipLibCheck": true,
10
+ "strict": true,
11
+ "noEmit": true,
12
+ "esModuleInterop": true,
13
+ "module": "preserve",
14
+ "moduleResolution": "bundler",
15
+ "resolveJsonModule": true,
16
+ "isolatedModules": true,
17
+ "jsx": "preserve",
18
+ "incremental": true,
19
+ "plugins": [
20
+ {
21
+ "name": "next"
22
+ }
23
+ ],
24
+ "paths": {
25
+ "@/*": ["${configDir}/src/*"]
26
+ }
27
+ },
28
+ "include": [
29
+ "${configDir}/next-env.d.ts",
30
+ "${configDir}/**/*.ts",
31
+ "${configDir}/**/*.tsx",
32
+ "${configDir}/.next/types/**/*.ts"
33
+ ],
34
+ "exclude": ["${configDir}/node_modules"]
35
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Node (TS)",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ // same options as node template
7
+ "target": "ESNext",
8
+ "moduleResolution": "NodeNext",
9
+ "module": "NodeNext",
10
+ "paths": { "*": ["${configDir}/src/*"] },
11
+
12
+ // options for typescript-only
13
+ // https://nodejs.org/api/typescript.html#type-stripping
14
+ "noEmit": true,
15
+ "allowImportingTsExtensions": true,
16
+ "rewriteRelativeImportExtensions": true
17
+ }
18
+ }
package/dist/node.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Node",
4
+ "extends": "./base.json",
5
+ "compilerOptions": {
6
+ "target": "ESNext",
7
+ "moduleResolution": "NodeNext",
8
+ "module": "NodeNext",
9
+ "paths": { "*": ["${configDir}/src/*"] }
10
+ }
11
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Vite React (App)",
4
+ "extends": "../base.json",
5
+ "compilerOptions": {
6
+ "tsBuildInfoFile": "${configDir}/node_modules/.tmp/tsconfig.app.tsbuildinfo",
7
+ "target": "ES2022",
8
+ "useDefineForClassFields": true,
9
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
10
+ "module": "ESNext",
11
+
12
+ /* Bundler mode */
13
+ "moduleResolution": "bundler",
14
+ "allowImportingTsExtensions": true,
15
+ "noEmit": true,
16
+ "jsx": "react-jsx",
17
+
18
+ /* Linting */
19
+ "noUncheckedSideEffectImports": true
20
+ },
21
+ "include": ["${configDir}/src"]
22
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Vite React (Node)",
4
+ "extends": "../base.json",
5
+ "compilerOptions": {
6
+ "tsBuildInfoFile": "${configDir}/node_modules/.tmp/tsconfig.node.tsbuildinfo",
7
+ "target": "ES2023",
8
+ "lib": ["ES2023"],
9
+ "module": "ESNext",
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "noEmit": true,
15
+
16
+ /* Linting */
17
+ "noUncheckedSideEffectImports": true
18
+ },
19
+ "include": ["${configDir}/vite.config.ts"]
20
+ }
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@4mbl/tsconfig",
3
+ "version": "0.0.0-alpha.9b8878c",
4
+ "description": "Strict TypeScript configuration for various environments.",
5
+ "type": "module",
6
+ "author": "4mbl",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/4mbl/config/tree/main/packages/tsconfig#readme",
9
+ "exports": {
10
+ "./browser": "./dist/browser.json",
11
+ "./next": "./dist/next.json",
12
+ "./node-ts": "./dist/node-ts.json",
13
+ "./node": "./dist/node.json",
14
+ "./vite-react/app": "./dist/vite-react/app.json",
15
+ "./vite-react/node": "./dist/vite-react/node.json"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "package.json",
20
+ "README.md",
21
+ "CHANGELOG.md"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/4mbl/config.git",
26
+ "directory": "packages/tsconfig"
27
+ },
28
+ "keywords": [
29
+ "typescript",
30
+ "tsconfig"
31
+ ],
32
+ "peerDependencies": {
33
+ "typescript": ">=5.8.0"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "typescript": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "scripts": {
41
+ "build": "rm -rf dist && mkdir dist && cp -r templates/* dist/ && node scripts/generate-exports.mjs"
42
+ }
43
+ }