generated from sapphiredev/sapphire-template
-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tsconfig): rework entire tsconfig setup
BREAKING CHANGE: The tsconfig has been majorly restructured. Please see [the upgrading guide](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/UPGRADING-v4-v5.md) for how to migrate to the new version.
- Loading branch information
Showing
10 changed files
with
88 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Migration guide for @sapphire/ts-config v4.x to v5.x | ||
|
||
Between major version 4 and 5 of `@sapphire/ts-config`, the package has been rewritten to fully leverage that TypeScript's `extends` feature now supports an array of config files. | ||
|
||
The following configs have been removed: | ||
|
||
- `@sapphire/ts-config/extra-strict-without-decorators` | ||
- `@sapphire/ts-config/without-decorators` | ||
|
||
The following changes have been applied to the base config: | ||
|
||
- `experimentalDecorators` is now `false` by default | ||
- `emitDecoratorMetadata` is now `false` by default | ||
- `verbatimModuleSyntax` is now `false` by default. It gets set to true alongside `@sapphire/ts-config/esm`, this is because `verbatimModuleSyntax` doesn't work well together with CJS projects. | ||
|
||
The following configs have been added: | ||
|
||
- `@sapphire/ts-config/extra-strict` | ||
- `@sapphire/ts-config/decorators` | ||
- `@sapphire/ts-config/base` -> This is identical to `@sapphire/ts-config` | ||
- `@sapphire/ts-config/cjs` | ||
- `@sapphire/ts-config/esm` | ||
|
||
In order to achieve the following old configs you now need to use: | ||
|
||
| Old config | New config | | ||
| ------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | ||
| `"@sapphire/ts-config"` | `["@sapphire/ts-config", "@sapphire/ts-config/decorators"]` | | ||
| `"@sapphire/ts-config/extra-strict"` | `["@sapphire/ts-config", "@sapphire/ts-config/extra-strict", "@sapphire/ts-config/decorators"]` | | ||
| `"@sapphire/ts-config/extra-strict-without-decorators"` | `["@sapphire/ts-config", "@sapphire/ts-config/extra-strict"]` | | ||
| `"@sapphire/ts-config/without-decorators"` | `["@sapphire/ts-config"]` | | ||
|
||
Then you also have to choose either the CJS or ESM config with `@sapphire/ts-config/cjs` or `@sapphire/ts-config/esm` respectively. | ||
|
||
An example of a CJS project with extra-strict and no decorators would therefore be: | ||
|
||
```json | ||
{ | ||
"extends": ["@sapphire/ts-config", "@sapphire/ts-config/cjs", "@sapphire/ts-config/extra-strict"] | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
packages/ts-config/without-decorators.json → packages/ts-config/src/base/decorators.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/tsconfig.json", | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"emitDecoratorMetadata": false, | ||
"experimentalDecorators": false | ||
"emitDecoratorMetadata": true, | ||
"experimentalDecorators": true | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
packages/ts-config/extra-strict.json → ...ages/ts-config/src/base/extra-strict.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "CommonJS", | ||
"moduleResolution": "Node" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "Node16", | ||
"moduleResolution": "Node16", | ||
"verbatimModuleSyntax": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters