merge-tsconfigs 0.0.3 → 0.0.5

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 CHANGED
@@ -1,3 +1,139 @@
1
- # Merge Tsconfig
1
+ # Merge-Tsconfigs
2
2
 
3
- A CLI and node scripts to merge 2 or more tsconfig files
3
+ ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555)
4
+ [![npm version](https://badge.fury.io/js/merge-tsconfigs.svg)](https://badge.fury.io/js/merge-tsconfigs)
5
+ ![ci](https://github.com/yowainwright/merge-tsconfigs/actions/workflows/ci.yml/badge.svg)
6
+ [![Github](https://badgen.net/badge/icon/github?icon=github&label&color=grey)](https://github.com/yowainwright/merge-tsconfigs)
7
+ ![Twitter](https://img.shields.io/twitter/url?url=https%3A%2F%2Fgithub.com%2Fyowainwright%2Fmerge-tsconfigs)
8
+
9
+ _Merge-tsconfigs_ is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want. 💪
10
+
11
+ ---
12
+
13
+ ## Why do I want this?
14
+
15
+ 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_.
16
+
17
+ 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.
18
+
19
+ 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.
20
+
21
+ ---
22
+
23
+ ## How do I use this?
24
+
25
+ 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.
26
+
27
+ ---
28
+ ### CLI API
29
+
30
+ Listed below are the CLI options and arguments to execute merge-tsconfigs. To \*_view all_ cli options in your browser, run `merge-tsconfigs --help`!
31
+
32
+ ```sh
33
+ Usage: merge-tsconfigs [options] [files...]
34
+
35
+ Merge-tsconfigs is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want 🛣️
36
+
37
+ Arguments:
38
+ files files to check, matches an array pattern
39
+
40
+ Options:
41
+ -o, --out [out] output file
42
+ -i, --include [include...] files to include, matches a glob or array pattern
43
+ -e, --exclude [exclude...] files to exclude, matches a glob or array pattern
44
+ -h, --help display help for command
45
+ ```
46
+ \*compiler options are not added above for readability (but they can be leveraged). To view all cli options, run `merge-tsconfigs --help`!
47
+
48
+ #### Recipes
49
+
50
+ Merge tsconfig files into a single tsconfig
51
+
52
+ ```sh
53
+ merge-tsconfigs ./tsconfig.json ./tsconfig.build.json
54
+ # => ./tsconfig.merged.json
55
+ ```
56
+
57
+ Merge tsconfig files a specific tsconfig file
58
+
59
+ ```sh
60
+ merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --out ./tsconfig.out.json
61
+ # => ./tsconfig.out.json
62
+ ```
63
+
64
+ Merge tsconfig files with unique `include` and `exclude` strings
65
+
66
+ ```sh
67
+ merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --include 'src/**.ts' --exclude 'test/**.ts'
68
+ # => ./tsconfig.merged.json
69
+ ```
70
+
71
+ Merge tsconfig files with unique `include` and `exclude` or by using arrays
72
+
73
+ ```sh
74
+ merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --include 'src/**.ts' --exclude 'test/**.ts' 'config/*.ts'
75
+ # => ./tsconfig.merged.json
76
+ ```
77
+
78
+ Sprinkle in some `compilerOptions` to the mix
79
+
80
+ ```sh
81
+ merge-tsconfigs ./tsconfig.json ./tsconfig.build.json --out ./tsconfig.out.json --allowJs true --noEmit true
82
+ ```
83
+
84
+ ---
85
+
86
+ ### Node API
87
+
88
+ The node API works exactly the same as the CLI API.
89
+
90
+ ```ts
91
+ import mergeTsconfigs from 'merge-tsconfigs';
92
+
93
+ mergeTsconfigs({
94
+ files: ['./tsconfig.json', './tsconfig.build.json'],
95
+ out: './tsconfig.out.json',
96
+ include: ['src/**.ts'],
97
+ exclude: ['test/**.ts'],
98
+ compilerOptions: {
99
+ allowJs: true,
100
+ noEmit: true,
101
+ },
102
+ });
103
+
104
+ ```
105
+
106
+ 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.
107
+
108
+ #### Recipes
109
+
110
+ Merge tsconfig files into a single tsconfig
111
+
112
+ ```ts
113
+ const config = mergeTsconfigs({
114
+ files: ['./tsconfig.json', './tsconfig.build.json'],
115
+ });
116
+ // => config = { ... }
117
+ ```
118
+
119
+ Merge tsconfig files into a custom output file
120
+
121
+ ```ts
122
+ const config = mergeTsconfigs({
123
+ files: ['./tsconfig.json', './tsconfig.build.json'],
124
+ out: './new-dir/tsconfig.out.json',
125
+ });
126
+ // => config = { ... }
127
+ ```
128
+
129
+ ---
130
+
131
+ ## How do I install this?
132
+
133
+ ```sh
134
+ npm install merge-tsconfigs --save-dev
135
+ ```
136
+
137
+ ---
138
+
139
+ Made by [@yowainwright](https://github.com/yowainwright), MIT 2023