merge-tsconfigs 0.0.2 → 0.0.4
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 +132 -2
- package/dist/index.cjs +85 -2797
- package/dist/index.d.ts +8 -15
- package/dist/index.js +88 -2827
- package/package.json +49 -25
package/README.md
CHANGED
|
@@ -1,3 +1,133 @@
|
|
|
1
|
-
# Merge
|
|
1
|
+
# Merge-Tsconfigs
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
_Merge-tsconfigs_ is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want. 💪
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Why do I want this?
|
|
8
|
+
|
|
9
|
+
Tsconfig files are copied, pasted, or left as out-of-sync widows 😥 throughout projects. _Merge-tsconfigs_ provides a CLI and node functions to merge tsconfigs files and compilerOptions into _the single tsconfig file you want at a given time_.
|
|
10
|
+
|
|
11
|
+
For example, if you have a monorepo with multiple packages and you want to deploy one of them with a single tsconfig, you might need to copy a tsconfig from root, or write another static tsconfig just for deployment. Well, with _Merge-tsconfigs_ you can run the CLI to write a temporary tsconfig to be used for deployment.
|
|
12
|
+
|
|
13
|
+
By providing an easy way to create the tsconfig you want, your everyday tsconfig code remains the same, your dockerfiles require less context into other directories, and your deployment process is dynamically more exact.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## How do I use this?
|
|
18
|
+
|
|
19
|
+
Merge-tsconfigs is built to be uses as a CLI first and foremost. It also exports node functions which can be used to preform the same merge operation.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
### CLI API
|
|
23
|
+
|
|
24
|
+
Listed below are the CLI options and arguments to execute merge-tsconfigs. To \*_view all_ cli options in your browser, run `merge-tsconfigs --help`!
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
Usage: merge-tsconfigs [options] [files...]
|
|
28
|
+
|
|
29
|
+
Merge-tsconfigs is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want 🛣️
|
|
30
|
+
|
|
31
|
+
Arguments:
|
|
32
|
+
files files to check, matches an array pattern
|
|
33
|
+
|
|
34
|
+
Options:
|
|
35
|
+
-o, --out [out] output file
|
|
36
|
+
-i, --include [include...] files to include, matches a glob or array pattern
|
|
37
|
+
-e, --exclude [exclude...] files to exclude, matches a glob or array pattern
|
|
38
|
+
-h, --help display help for command
|
|
39
|
+
```
|
|
40
|
+
\*compiler options are not added above for readability (but they can be leveraged). To view all cli options, run `merge-tsconfigs --help`!
|
|
41
|
+
|
|
42
|
+
#### Recipes
|
|
43
|
+
|
|
44
|
+
Merge tsconfig files into a single tsconfig
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
merge-tsconfigs ./tsconfig.json ./tsconfig.build.json
|
|
48
|
+
# => ./tsconfig.merged.json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Merge tsconfig files a specific tsconfig file
|
|
52
|
+
|
|
53
|
+
```sh
|
|
54
|
+
merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --out ./tsconfig.out.json
|
|
55
|
+
# => ./tsconfig.out.json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Merge tsconfig files with unique `include` and `exclude` strings
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --include 'src/**.ts' --exclude 'test/**.ts'
|
|
62
|
+
# => ./tsconfig.merged.json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Merge tsconfig files with unique `include` and `exclude` or by using arrays
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --include 'src/**.ts' --exclude 'test/**.ts' 'config/*.ts'
|
|
69
|
+
# => ./tsconfig.merged.json
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Sprinkle in some `compilerOptions` to the mix
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --out ./tsconfig.out.json --allowJs true --noEmit true
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Node API
|
|
81
|
+
|
|
82
|
+
The node API works exactly the same as the CLI API.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
import mergeTsconfigs from 'merge-tsconfigs';
|
|
86
|
+
|
|
87
|
+
mergeTsconfigs({
|
|
88
|
+
files: ['./tsconfig.json', './tsconfig.build.json'],
|
|
89
|
+
out: './tsconfig.out.json',
|
|
90
|
+
include: ['src/**.ts'],
|
|
91
|
+
exclude: ['test/**.ts'],
|
|
92
|
+
compilerOptions: {
|
|
93
|
+
allowJs: true,
|
|
94
|
+
noEmit: true,
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
You can use any compiler options provided by [Typescript](https://www.typescriptlang.org/docs/handbook/compiler-options.html). Object keys aren't currently implemented but can be upon feature request.
|
|
101
|
+
|
|
102
|
+
#### Recipes
|
|
103
|
+
|
|
104
|
+
Merge tsconfig files into a single tsconfig
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
const config = mergeTsconfigs({
|
|
108
|
+
files: ['./tsconfig.json', './tsconfig.build.json'],
|
|
109
|
+
});
|
|
110
|
+
// => config = { ... }
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Merge tsconfig files into a custom output file
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const config = mergeTsconfigs({
|
|
117
|
+
files: ['./tsconfig.json', './tsconfig.build.json'],
|
|
118
|
+
out: './new-dir/tsconfig.out.json',
|
|
119
|
+
});
|
|
120
|
+
// => config = { ... }
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## How do I install this?
|
|
126
|
+
|
|
127
|
+
```sh
|
|
128
|
+
npm install merge-tsconfigs --save-dev
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
Made by [@yowainwright](https://github.com/yowainwright), MIT 2023
|