@zayne-labs/tsconfig 0.7.8 → 0.8.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 +77 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# `@zayne-labs/tsconfig`
|
|
2
|
+
|
|
3
|
+
This package helps set proper tsconfig presets for most projects. Inspired by Matt Pocock's [TSConfig Cheat Sheet](https://www.totaltypescript.com/tsconfig-cheat-sheet).
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
1. Install:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Npm
|
|
11
|
+
npm install --save-dev @zayne-labs/tsconfig
|
|
12
|
+
|
|
13
|
+
# Pnpm
|
|
14
|
+
pnpm add -D @zayne-labs/tsconfig
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
2. Choose which `tsconfig.json` you need from the [list](#list-of-tsconfigs) below.
|
|
18
|
+
|
|
19
|
+
3. Add it to your `tsconfig.json`:
|
|
20
|
+
|
|
21
|
+
```jsonc
|
|
22
|
+
{
|
|
23
|
+
// For building an app that runs in the DOM with an external bundler
|
|
24
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/app"
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## List of TSConfigs
|
|
29
|
+
|
|
30
|
+
### Are You Using `tsc` To Turn Your `.ts` Files Into `.js` Files?
|
|
31
|
+
|
|
32
|
+
#### Yes
|
|
33
|
+
|
|
34
|
+
If yes, use this selection of configs:
|
|
35
|
+
|
|
36
|
+
```jsonc
|
|
37
|
+
{
|
|
38
|
+
// For code that runs in the DOM:
|
|
39
|
+
"extends": "@zayne-labs/tsconfig/tsc/dom/app", // For an app
|
|
40
|
+
"extends": "@zayne-labs/tsconfig/tsc/dom/library", // For a library
|
|
41
|
+
"extends": "@zayne-labs/tsconfig/tsc/dom/library-monorepo", // For a library in a monorepo
|
|
42
|
+
|
|
43
|
+
// For code that doesn't run in the DOM (for instance, in Node.js):
|
|
44
|
+
"extends": "@zayne-labs/tsconfig/tsc/no-dom/app", // For an app
|
|
45
|
+
"extends": "@zayne-labs/tsconfig/tsc/no-dom/library", // For a library
|
|
46
|
+
"extends": "@zayne-labs/tsconfig/tsc/no-dom/library-monorepo" // For a library in a monorepo
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
#### No
|
|
51
|
+
|
|
52
|
+
If no, you're probably using an external bundler.
|
|
53
|
+
|
|
54
|
+
```jsonc
|
|
55
|
+
{
|
|
56
|
+
// For code that runs in the DOM:
|
|
57
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/app", // For an app
|
|
58
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/library", // For a library
|
|
59
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/library-monorepo", // For a library in a monorepo
|
|
60
|
+
|
|
61
|
+
// For code that doesn't run in the DOM (for instance, in Node.js):
|
|
62
|
+
"extends": "@zayne-labs/tsconfig/bundler/no-dom/app", // For an app
|
|
63
|
+
"extends": "@zayne-labs/tsconfig/bundler/no-dom/library", // For a library
|
|
64
|
+
"extends": "@zayne-labs/tsconfig/bundler/no-dom/library-monorepo" // For a library in a monorepo
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Framework-Specific Options
|
|
69
|
+
|
|
70
|
+
The following are currently supported framework-specific options, will add more if needed in future:
|
|
71
|
+
|
|
72
|
+
```jsonc
|
|
73
|
+
{
|
|
74
|
+
// For a nextjs app
|
|
75
|
+
"extends": "@zayne-labs/tsconfig/bundler/dom/next"
|
|
76
|
+
}
|
|
77
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zayne-labs/tsconfig",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0",
|
|
5
5
|
"description": "A collection of TypeScript configurations for various projects, based on Total TypeScript's TSConfig Cheat Sheet, with a few additions.",
|
|
6
6
|
"author": "Ryan Zayne",
|
|
7
7
|
"license": "MIT",
|