@codecompose/typescript-config 2.0.0 → 2.1.0-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/README.md +19 -32
- package/package.json +4 -8
- package/src/base.json +10 -2
- package/src/library.json +1 -3
- package/src/nextjs.json +1 -3
- package/src/react-library.json +1 -5
- package/src/shared-library.json +10 -0
- package/src/shared-react-library.json +10 -0
- package/src/monorepo/library.json +0 -9
- package/src/monorepo/react-library.json +0 -10
package/README.md
CHANGED
|
@@ -18,43 +18,18 @@ Configurations are organized based on their intended use:
|
|
|
18
18
|
- **Monorepo configurations**: Under the `/monorepo` path for monorepo-specific
|
|
19
19
|
setups
|
|
20
20
|
|
|
21
|
-
## Warning
|
|
22
|
-
|
|
23
|
-
At the time of writing, not all tooling correctly interprets the use of
|
|
24
|
-
`${configDir}` introduced in TS v5.5 that this package depends on.
|
|
25
|
-
|
|
26
|
-
- Next.js will require you to explicitly defined "includes". Give it "src" and
|
|
27
|
-
it will inject its types on startup.
|
|
28
|
-
- TSUP will not understand the tsconfig if you ask it to generate type
|
|
29
|
-
definitions. I use tsc to generate the types, as demonstrated in
|
|
30
|
-
[mono-ts](https://github.com/0x80/mono-ts).
|
|
31
|
-
|
|
32
21
|
## Install
|
|
33
22
|
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
...or the equivalent for your package manager.
|
|
23
|
+
`npm i @codecompose/typescript-config -D`
|
|
37
24
|
|
|
38
25
|
## Usage
|
|
39
26
|
|
|
40
|
-
For non-monorepo projects:
|
|
41
|
-
|
|
42
27
|
```json
|
|
43
28
|
{
|
|
44
|
-
"extends": "@codecompose/typescript-config/
|
|
29
|
+
"extends": "@codecompose/typescript-config/base"
|
|
45
30
|
}
|
|
46
31
|
```
|
|
47
32
|
|
|
48
|
-
For monorepo projects:
|
|
49
|
-
|
|
50
|
-
```json
|
|
51
|
-
{
|
|
52
|
-
"extends": "@codecompose/typescript-config/monorepo/library"
|
|
53
|
-
}
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Note: The `.json` extension is no longer needed in imports.
|
|
57
|
-
|
|
58
33
|
## Available Configurations
|
|
59
34
|
|
|
60
35
|
### Base Configuration
|
|
@@ -63,6 +38,7 @@ Note: The `.json` extension is no longer needed in imports.
|
|
|
63
38
|
|
|
64
39
|
### Stand-alone Configurations
|
|
65
40
|
|
|
41
|
+
- `base` - For anything non-specific
|
|
66
42
|
- `library` - For general libraries
|
|
67
43
|
- `react-library` - For React component libraries
|
|
68
44
|
- `nextjs` - For Next.js applications
|
|
@@ -71,16 +47,16 @@ Note: The `.json` extension is no longer needed in imports.
|
|
|
71
47
|
### Monorepo Configurations
|
|
72
48
|
|
|
73
49
|
When using a monorepo, the packages that other packages depend on should use the
|
|
74
|
-
|
|
50
|
+
"shared" variant.
|
|
75
51
|
|
|
76
|
-
- `
|
|
77
|
-
- `
|
|
52
|
+
- `shared-library` - For shared libraries in a monorepo
|
|
53
|
+
- `shared-react-library` - For shared React component libraries in a monorepo
|
|
78
54
|
|
|
79
55
|
The `nextjs` and `service` configs are compatible with both monorepo and
|
|
80
56
|
non-monorepo.
|
|
81
57
|
|
|
82
|
-
For other project types, like a CLI or E2E app, you can
|
|
83
|
-
|
|
58
|
+
For other project types, like a CLI or E2E app, you can use the `base`
|
|
59
|
+
configuration.
|
|
84
60
|
|
|
85
61
|
## Assumptions and Recommendations
|
|
86
62
|
|
|
@@ -93,3 +69,14 @@ happen that builds get stuck in limbo and you need to delete the
|
|
|
93
69
|
recommend adding the following script to your manifest based on `del-cli`:
|
|
94
70
|
|
|
95
71
|
`"clean": "del-cli dist tsconfig.tsbuildinfo"`
|
|
72
|
+
|
|
73
|
+
## Known Issues
|
|
74
|
+
|
|
75
|
+
At the time of writing, not all tooling correctly interprets the use of
|
|
76
|
+
`${configDir}` introduced in TS v5.5 that this package depends on.
|
|
77
|
+
|
|
78
|
+
- Next.js will require you to explicitly defined "includes". Give it "src" and
|
|
79
|
+
it will inject its types on startup.
|
|
80
|
+
- TSUP will not understand the tsconfig if you ask it to generate type
|
|
81
|
+
definitions. I use tsc to generate the types, as demonstrated in
|
|
82
|
+
[mono-ts](https://github.com/0x80/mono-ts).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecompose/typescript-config",
|
|
3
3
|
"description": "Opinionated reusable TypeScript configurations",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.1.0-0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Thijs Koerselman",
|
|
7
7
|
"publishConfig": {
|
|
@@ -28,12 +28,8 @@
|
|
|
28
28
|
"./nextjs": "./src/nextjs.json",
|
|
29
29
|
"./react-library": "./src/react-library.json",
|
|
30
30
|
"./service": "./src/service.json",
|
|
31
|
-
"./
|
|
32
|
-
"./
|
|
31
|
+
"./shared-library": "./src/shared-library.json",
|
|
32
|
+
"./shared-react-library": "./src/shared-react-library.json"
|
|
33
33
|
},
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"eslint": "^8.57.0",
|
|
36
|
-
"prettier": "^3.3.3",
|
|
37
|
-
"prettier-plugin-jsdoc": "^1.3.0"
|
|
38
|
-
}
|
|
34
|
+
"devDependencies": {}
|
|
39
35
|
}
|
package/src/base.json
CHANGED
|
@@ -18,6 +18,9 @@
|
|
|
18
18
|
"noUncheckedIndexedAccess": true,
|
|
19
19
|
"noImplicitOverride": true,
|
|
20
20
|
|
|
21
|
+
/* Assuming bundler will output EVERYTHING. You'll need a modern bundler
|
|
22
|
+
like tsdown to output declarationMaps for shared monorepo libraries. */
|
|
23
|
+
"noEmit": true,
|
|
21
24
|
/* Opinion */
|
|
22
25
|
"incremental": true,
|
|
23
26
|
"tsBuildInfoFile": "${configDir}/tsconfig.tsbuildinfo",
|
|
@@ -26,9 +29,14 @@
|
|
|
26
29
|
"baseUrl": "${configDir}",
|
|
27
30
|
"rootDir": "${configDir}/src",
|
|
28
31
|
"paths": {
|
|
29
|
-
"~/*": ["./src/*"]
|
|
32
|
+
"~/*": ["./src/*"],
|
|
33
|
+
"@/*": ["./src/*"]
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"include": ["${configDir}/src", "${configDir}/src/**/*.json"],
|
|
33
|
-
"exclude": [
|
|
37
|
+
"exclude": [
|
|
38
|
+
"${configDir}/node_modules",
|
|
39
|
+
"${configDir}/dist",
|
|
40
|
+
"${configDir}/isolate"
|
|
41
|
+
]
|
|
34
42
|
}
|
package/src/library.json
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
"display": "Standalone shared library",
|
|
4
4
|
"extends": "./base.json",
|
|
5
5
|
"compilerOptions": {
|
|
6
|
-
/*
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true
|
|
6
|
+
/* Assuming your bundler will output declaration and declarationMap */
|
|
9
7
|
}
|
|
10
8
|
}
|
package/src/nextjs.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
"compilerOptions": {
|
|
6
6
|
"jsx": "preserve", // next does its own jsx transformation
|
|
7
7
|
"lib": ["dom", "dom.iterable", "esnext"],
|
|
8
|
-
"noEmit": true,
|
|
9
8
|
"rootDir": "${configDir}", // nextjs targets files outside of src in root as well
|
|
10
9
|
"plugins": [
|
|
11
10
|
{
|
|
@@ -18,6 +17,5 @@
|
|
|
18
17
|
"${configDir}/**/*.json",
|
|
19
18
|
"${configDir}/next-env.d.ts",
|
|
20
19
|
"${configDir}/.next/types/**/*.ts"
|
|
21
|
-
]
|
|
22
|
-
"exclude": ["${configDir}/node_modules"]
|
|
20
|
+
]
|
|
23
21
|
}
|
package/src/react-library.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Monorepo shared library",
|
|
4
|
+
"extends": "./library.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
/* Required for project references, which provide go-to-definition in your IDE without first having to build the module, which is essential during development. */
|
|
7
|
+
"composite": true
|
|
8
|
+
/* Assuming your bundler will output type declarations and declaration-maps */
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"display": "Monorepo shared React component library",
|
|
4
|
+
"extends": "./react-library.json",
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
/* Required for project references, which provide go-to-definition in your IDE without first having to build the module, which is essential during development. */
|
|
7
|
+
"composite": true
|
|
8
|
+
/* Assuming your bundler will output type declarations and declaration-maps */
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
-
"display": "Monorepo React component library",
|
|
4
|
-
"extends": "../react-library.json",
|
|
5
|
-
"compilerOptions": {
|
|
6
|
-
/* AND if you're building for a library in a monorepo: */
|
|
7
|
-
"composite": true,
|
|
8
|
-
"declarationMap": true
|
|
9
|
-
}
|
|
10
|
-
}
|