@sapphire/ts-config 5.0.3-next.9233eb17 → 5.0.3
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 +35 -35
- package/package.json +35 -4
- /package/{bundler.json → src/bundler.json} +0 -0
- /package/{decorators.json → src/decorators.json} +0 -0
- /package/{extra-strict.json → src/extra-strict.json} +0 -0
- /package/{tsconfig.json → src/tsconfig.json} +0 -0
- /package/{verbatim.json → src/verbatim.json} +0 -0
package/README.md
CHANGED
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
|
|
15
15
|
**Table of Contents**
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
17
|
+
- [Installation](#installation)
|
|
18
|
+
- [Usage](#usage)
|
|
19
|
+
- [Base](#base)
|
|
20
|
+
- [Extra Strict](#extra-strict)
|
|
21
|
+
- [Decorators](#decorators)
|
|
22
|
+
- [Verbatim](#verbatim)
|
|
23
|
+
- [Bundler](#bundler)
|
|
24
|
+
- [Buy us some doughnuts](#buy-us-some-doughnuts)
|
|
25
|
+
- [Contributors](#contributors)
|
|
26
26
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
@@ -39,24 +39,24 @@ npm install --save-dev @sapphire/ts-config
|
|
|
39
39
|
This package ships a couple of different sets of tsconfig, they should be used in an array of
|
|
40
40
|
`extends` in your `tsconfig.json` file. The supported configs are:
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
42
|
+
- `@sapphire/ts-config/base` -> This is identical to `@sapphire/ts-config`
|
|
43
|
+
- `@sapphire/ts-config/extra-strict`
|
|
44
|
+
- `@sapphire/ts-config/decorators`
|
|
45
|
+
- `@sapphire/ts-config/verbatim`
|
|
46
46
|
|
|
47
47
|
You should always start with the base config, regardless of what other configs you choose.
|
|
48
48
|
Next you can opt-in to the other configs.
|
|
49
49
|
|
|
50
50
|
Finally you should configure your package.json properly based on what kind of package you are writing
|
|
51
51
|
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
|
|
52
|
+
- For CJS packages you should add `"type": "commonjs"` to your `package.json`
|
|
53
|
+
- For ESM packages you should add `"type": "module"` to your `package.json`
|
|
54
|
+
- For a package that is going to be used by both CJS and ESM then you should not add any `"type"` to your `package.json`
|
|
55
|
+
- Note that if you intend to compile for both your best option is to compile
|
|
56
|
+
for CJS from TypeScript, then use [`gen-esm-wrapper`](https://github.com/addaleax/gen-esm-wrapper) to transform your
|
|
57
|
+
input file to ESM compatible exports. This is also what we do for our Sapphire packages.
|
|
58
|
+
- Note also that in this case you should not enable `@sapphire/ts-config/verbatim`, because it will not work without
|
|
59
|
+
a `"type"` specified in `package.json`
|
|
60
60
|
|
|
61
61
|
Next we will go over the different configs and what they do.
|
|
62
62
|
|
|
@@ -65,18 +65,18 @@ Next we will go over the different configs and what they do.
|
|
|
65
65
|
The base config (`@sapphire/ts-config`, or `@sapphire/ts-config/base`) is the default config with options set up in
|
|
66
66
|
such a way that it will suite nearly all projects.
|
|
67
67
|
|
|
68
|
-
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/tsconfig.json)
|
|
68
|
+
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/tsconfig.json)
|
|
69
69
|
|
|
70
70
|
### Extra Strict
|
|
71
71
|
|
|
72
72
|
You should include this config if you want to extra strict checking. This configures the following compiler options:
|
|
73
73
|
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
74
|
+
- [`allowUnreachableCode` to `false`](https://www.typescriptlang.org/tsconfig#allowUnreachableCode)
|
|
75
|
+
- [`allowUnusedLabels` to `false`](https://www.typescriptlang.org/tsconfig#allowUnusedLabels)
|
|
76
|
+
- [`exactOptionalPropertyTypes` to `false`](https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes)
|
|
77
|
+
- [`noImplicitOverride` to `true`](https://www.typescriptlang.org/tsconfig#noImplicitOverride)
|
|
78
78
|
|
|
79
|
-
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/extra-strict.json)
|
|
79
|
+
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/extra-strict.json)
|
|
80
80
|
|
|
81
81
|
### Decorators
|
|
82
82
|
|
|
@@ -87,10 +87,10 @@ you are using decorators. Packages such as `@sapphire/decorators` rely on this c
|
|
|
87
87
|
|
|
88
88
|
This enables the following compiler options:
|
|
89
89
|
|
|
90
|
-
-
|
|
91
|
-
-
|
|
90
|
+
- [experimentalDecorators](https://www.typescriptlang.org/tsconfig#experimentalDecorators)
|
|
91
|
+
- [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata)
|
|
92
92
|
|
|
93
|
-
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config
|
|
93
|
+
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/decorators.json)
|
|
94
94
|
|
|
95
95
|
### Verbatim
|
|
96
96
|
|
|
@@ -101,9 +101,9 @@ See the TypeScript documentation for more information.
|
|
|
101
101
|
|
|
102
102
|
This enables the following compiler options:
|
|
103
103
|
|
|
104
|
-
-
|
|
104
|
+
- [verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax)
|
|
105
105
|
|
|
106
|
-
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/verbatim.json)
|
|
106
|
+
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/verbatim.json)
|
|
107
107
|
|
|
108
108
|
### Bundler
|
|
109
109
|
|
|
@@ -113,10 +113,10 @@ config sets [`moduleResolution` to `Bundler`][moduleResolution] and [`module` to
|
|
|
113
113
|
|
|
114
114
|
This configures the following compiler options:
|
|
115
115
|
|
|
116
|
-
-
|
|
117
|
-
-
|
|
116
|
+
- [`moduleResolution` to `Bundler`][moduleResolution]
|
|
117
|
+
- [`module` to `ES2022`][module]
|
|
118
118
|
|
|
119
|
-
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/bundler.json)
|
|
119
|
+
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/bundler.json)
|
|
120
120
|
|
|
121
121
|
## Buy us some doughnuts
|
|
122
122
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sapphire/ts-config",
|
|
3
|
-
"version": "5.0.3
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Shareable TypeScript configuration for the Sapphire Community",
|
|
5
5
|
"author": "@sapphire",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"main": "src/tsconfig.json",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./src/tsconfig.json",
|
|
11
|
+
"import": "./src/tsconfig.json",
|
|
12
|
+
"require": "./src/tsconfig.json"
|
|
13
|
+
},
|
|
14
|
+
"./base": {
|
|
15
|
+
"types": "./src/tsconfig.json",
|
|
16
|
+
"import": "./src/tsconfig.json",
|
|
17
|
+
"require": "./src/tsconfig.json"
|
|
18
|
+
},
|
|
19
|
+
"./decorators": {
|
|
20
|
+
"types": "./src/decorators.json",
|
|
21
|
+
"import": "./src/decorators.json",
|
|
22
|
+
"require": "./src/decorators.json"
|
|
23
|
+
},
|
|
24
|
+
"./extra-strict": {
|
|
25
|
+
"types": "./src/extra-strict.json",
|
|
26
|
+
"import": "./src/extra-strict.json",
|
|
27
|
+
"require": "./src/extra-strict.json"
|
|
28
|
+
},
|
|
29
|
+
"./verbatim": {
|
|
30
|
+
"types": "./src/verbatim.json",
|
|
31
|
+
"import": "./src/verbatim.json",
|
|
32
|
+
"require": "./src/verbatim.json"
|
|
33
|
+
},
|
|
34
|
+
"./bundler": {
|
|
35
|
+
"types": "./src/bundler.json",
|
|
36
|
+
"import": "./src/bundler.json",
|
|
37
|
+
"require": "./src/bundler.json"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
7
40
|
"sideEffects": false,
|
|
8
41
|
"homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/ts-config",
|
|
9
42
|
"scripts": {
|
|
@@ -18,9 +51,7 @@
|
|
|
18
51
|
"typescript": "~5.4.5"
|
|
19
52
|
},
|
|
20
53
|
"files": [
|
|
21
|
-
"
|
|
22
|
-
"!tests/**",
|
|
23
|
-
"!tsconfig.eslint.json",
|
|
54
|
+
"src",
|
|
24
55
|
"UPGRADING-*.md"
|
|
25
56
|
],
|
|
26
57
|
"engines": {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|