Skip to content

Commit 9eae2b0

Browse files
committed
revert: "refactor: relocate tsconfig files to the package root for rolldown compatibility"
This reverts commit b7f8a51.
1 parent 2944c07 commit 9eae2b0

File tree

8 files changed

+70
-39
lines changed

8 files changed

+70
-39
lines changed

packages/ts-config/README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414

1515
**Table of Contents**
1616

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)
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)
2626

2727
## Installation
2828

@@ -39,24 +39,24 @@ npm install --save-dev @sapphire/ts-config
3939
This package ships a couple of different sets of tsconfig, they should be used in an array of
4040
`extends` in your `tsconfig.json` file. The supported configs are:
4141

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`
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`
4646

4747
You should always start with the base config, regardless of what other configs you choose.
4848
Next you can opt-in to the other configs.
4949

5050
Finally you should configure your package.json properly based on what kind of package you are writing
5151

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`
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`
6060

6161
Next we will go over the different configs and what they do.
6262

@@ -65,18 +65,18 @@ Next we will go over the different configs and what they do.
6565
The base config (`@sapphire/ts-config`, or `@sapphire/ts-config/base`) is the default config with options set up in
6666
such a way that it will suite nearly all projects.
6767

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)
6969

7070
### Extra Strict
7171

7272
You should include this config if you want to extra strict checking. This configures the following compiler options:
7373

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)
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)
7878

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)
8080

8181
### Decorators
8282

@@ -87,10 +87,10 @@ you are using decorators. Packages such as `@sapphire/decorators` rely on this c
8787

8888
This enables the following compiler options:
8989

90-
- [experimentalDecorators](https://www.typescriptlang.org/tsconfig#experimentalDecorators)
91-
- [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata)
90+
- [experimentalDecorators](https://www.typescriptlang.org/tsconfig#experimentalDecorators)
91+
- [emitDecoratorMetadata](https://www.typescriptlang.org/tsconfig#emitDecoratorMetadata)
9292

93-
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config//decorators.json)
93+
You can view the content of this tsconfig [here](https://github.com/sapphiredev/utilities/blob/main/packages/ts-config/src/decorators.json)
9494

9595
### Verbatim
9696

@@ -101,9 +101,9 @@ See the TypeScript documentation for more information.
101101

102102
This enables the following compiler options:
103103

104-
- [verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax)
104+
- [verbatimModuleSyntax](https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax)
105105

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)
107107

108108
### Bundler
109109

@@ -113,10 +113,10 @@ config sets [`moduleResolution` to `Bundler`][moduleResolution] and [`module` to
113113

114114
This configures the following compiler options:
115115

116-
- [`moduleResolution` to `Bundler`][moduleResolution]
117-
- [`module` to `ES2022`][module]
116+
- [`moduleResolution` to `Bundler`][moduleResolution]
117+
- [`module` to `ES2022`][module]
118118

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)
120120

121121
## Buy us some doughnuts
122122

packages/ts-config/package.json

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@
44
"description": "Shareable TypeScript configuration for the Sapphire Community",
55
"author": "@sapphire",
66
"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+
},
740
"sideEffects": false,
841
"homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/ts-config",
942
"scripts": {
@@ -18,9 +51,7 @@
1851
"typescript": "~5.4.5"
1952
},
2053
"files": [
21-
"*.json",
22-
"!tests/**",
23-
"!tsconfig.eslint.json",
54+
"src",
2455
"UPGRADING-*.md"
2556
],
2657
"engines": {

packages/ts-config/tests/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": ["../tsconfig.json", "../extra-strict.json"],
2+
"extends": ["../src/tsconfig.json", "../src/extra-strict.json"],
33
"compilerOptions": {
44
"lib": ["ESNext", "DOM"],
55
"noEmit": true,

0 commit comments

Comments
 (0)