@vyriy/typescript-config 0.1.20 → 0.1.22
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 +41 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,13 +4,9 @@ Shared TypeScript configs for Vyriy projects.
|
|
|
4
4
|
|
|
5
5
|
## Purpose
|
|
6
6
|
|
|
7
|
-
This package provides
|
|
7
|
+
This package provides the base TypeScript config used by Vyriy repositories.
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
- build config
|
|
11
|
-
- config-file-oriented config
|
|
12
|
-
|
|
13
|
-
The package is designed for monorepos and shared project setup, while path-based settings such as `include`, `rootDir`, and `outDir` stay in the consumer project.
|
|
9
|
+
The package is designed for monorepos and shared project setup, while path-based settings such as `include`, `rootDir`, `outDir`, and emit behavior stay in the consumer project. Projects extend the shared baseline and override only the options that are specific to their build or type-checking workflow.
|
|
14
10
|
|
|
15
11
|
## Install
|
|
16
12
|
|
|
@@ -30,34 +26,35 @@ Install `typescript` in the consumer project so CLI commands are available.
|
|
|
30
26
|
|
|
31
27
|
## Usage
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
Create `tsconfig.json` and extend the shared config:
|
|
34
30
|
|
|
35
31
|
```json
|
|
36
32
|
{
|
|
37
|
-
"extends": "@vyriy/typescript-config",
|
|
33
|
+
"extends": "@vyriy/typescript-config/index.json",
|
|
34
|
+
"compilerOptions": {
|
|
35
|
+
"noEmit": false
|
|
36
|
+
},
|
|
38
37
|
"include": [
|
|
39
|
-
".
|
|
40
|
-
".storybook/**/*.ts",
|
|
41
|
-
".storybook/**/*.tsx",
|
|
42
|
-
"packages/**/*.ts",
|
|
43
|
-
"packages/**/*.tsx",
|
|
44
|
-
"stack/*.ts"
|
|
38
|
+
"index.ts"
|
|
45
39
|
]
|
|
46
40
|
}
|
|
47
41
|
```
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
The shared config defaults to `noEmit: true`, which is useful for type-check-only workflows. Set `noEmit` to `false` in the consumer project when TypeScript should write JavaScript output.
|
|
44
|
+
|
|
45
|
+
For a package or monorepo build, keep project-specific paths local:
|
|
50
46
|
|
|
51
47
|
```json
|
|
52
48
|
{
|
|
53
|
-
"extends": "
|
|
49
|
+
"extends": "@vyriy/typescript-config/index.json",
|
|
54
50
|
"compilerOptions": {
|
|
51
|
+
"noEmit": false,
|
|
55
52
|
"outDir": "./dist",
|
|
56
|
-
"rootDir": "./
|
|
53
|
+
"rootDir": "./src"
|
|
57
54
|
},
|
|
58
55
|
"include": [
|
|
59
|
-
"
|
|
60
|
-
"
|
|
56
|
+
"src/**/*.ts",
|
|
57
|
+
"src/**/*.tsx"
|
|
61
58
|
],
|
|
62
59
|
"exclude": [
|
|
63
60
|
"**/*.stories.ts",
|
|
@@ -67,3 +64,28 @@ Build config:
|
|
|
67
64
|
]
|
|
68
65
|
}
|
|
69
66
|
```
|
|
67
|
+
|
|
68
|
+
## Compiler Baseline
|
|
69
|
+
|
|
70
|
+
The shared config uses:
|
|
71
|
+
|
|
72
|
+
- `target: "ESNext"`
|
|
73
|
+
- `module: "ESNext"`
|
|
74
|
+
- `moduleResolution: "Bundler"`
|
|
75
|
+
- `jsx: "react-jsx"`
|
|
76
|
+
- `strict: true`
|
|
77
|
+
- `isolatedModules: true`
|
|
78
|
+
- `skipLibCheck: true`
|
|
79
|
+
|
|
80
|
+
## CLI
|
|
81
|
+
|
|
82
|
+
Run the TypeScript compiler with the local project config:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npx tsc
|
|
86
|
+
npx tsc --noEmit
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Full Example
|
|
90
|
+
|
|
91
|
+
See the article with a complete compile-and-run walkthrough: <https://vyriy.dev/examples/vyriy-typescript-config/>.
|