@ttoss/config 1.31.2 → 1.31.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 +9 -0
- package/dist/esm/index.js +5 -11
- package/dist/index.js +5 -11
- package/package.json +3 -2
- package/src/babel.ts +2 -9
- package/src/jest.ts +5 -0
- package/tsconfig.json +9 -4
- package/tsconfig.test.json +3 -0
package/README.md
CHANGED
|
@@ -154,6 +154,15 @@ Extend default configuration for each `tsconfig.json` (`touch tsconfig.json`) on
|
|
|
154
154
|
}
|
|
155
155
|
```
|
|
156
156
|
|
|
157
|
+
For tests, you can extend the default test configuration `tsconfig.test.json` on the package `tests` folder:
|
|
158
|
+
|
|
159
|
+
```json title="tests/tsconfig.json"
|
|
160
|
+
{
|
|
161
|
+
"extends": "@ttoss/config/tsconfig.test.json",
|
|
162
|
+
"include": ["**/*.test.ts", "**/*.test.tsx"]
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
157
166
|
## Extending configurations
|
|
158
167
|
|
|
159
168
|
Each configuration is customizable and you can extend them with your own. For example, you can use the default `.prettierrc.js` file in your monorepo:
|
package/dist/esm/index.js
CHANGED
|
@@ -15,17 +15,7 @@ var configCreator = (defaultConfig8 = {}) => {
|
|
|
15
15
|
|
|
16
16
|
// src/babel.ts
|
|
17
17
|
var defaultConfig = {
|
|
18
|
-
presets: [
|
|
19
|
-
/**
|
|
20
|
-
* `loose: true` to avoid the Storybook warning:
|
|
21
|
-
*
|
|
22
|
-
* > Though the "loose" option was set to "false" in your @babel/preset-env
|
|
23
|
-
* > config, it will not be used for @babel/plugin-proposal-private-property-in-object
|
|
24
|
-
* > since the "loose" mode option was set to "true"
|
|
25
|
-
* > for @babel/plugin-proposal-private-methods.
|
|
26
|
-
*/
|
|
27
|
-
["@babel/preset-env", {
|
|
28
|
-
loose: true,
|
|
18
|
+
presets: [["@babel/preset-env", {
|
|
29
19
|
targets: {
|
|
30
20
|
node: "current"
|
|
31
21
|
}
|
|
@@ -51,6 +41,10 @@ var defaultConfig3 = {
|
|
|
51
41
|
collectCoverage: true,
|
|
52
42
|
coverageDirectory: "coverage",
|
|
53
43
|
coverageProvider: "v8",
|
|
44
|
+
/**
|
|
45
|
+
* https://github.com/jestjs/jest/issues/13739#issuecomment-1517190965
|
|
46
|
+
*/
|
|
47
|
+
extensionsToTreatAsEsm: [".ts", ".tsx"],
|
|
54
48
|
fakeTimers: {
|
|
55
49
|
enableGlobally: true
|
|
56
50
|
},
|
package/dist/index.js
CHANGED
|
@@ -63,17 +63,7 @@ var configCreator = (defaultConfig8 = {}) => {
|
|
|
63
63
|
|
|
64
64
|
// src/babel.ts
|
|
65
65
|
var defaultConfig = {
|
|
66
|
-
presets: [
|
|
67
|
-
/**
|
|
68
|
-
* `loose: true` to avoid the Storybook warning:
|
|
69
|
-
*
|
|
70
|
-
* > Though the "loose" option was set to "false" in your @babel/preset-env
|
|
71
|
-
* > config, it will not be used for @babel/plugin-proposal-private-property-in-object
|
|
72
|
-
* > since the "loose" mode option was set to "true"
|
|
73
|
-
* > for @babel/plugin-proposal-private-methods.
|
|
74
|
-
*/
|
|
75
|
-
["@babel/preset-env", {
|
|
76
|
-
loose: true,
|
|
66
|
+
presets: [["@babel/preset-env", {
|
|
77
67
|
targets: {
|
|
78
68
|
node: "current"
|
|
79
69
|
}
|
|
@@ -99,6 +89,10 @@ var defaultConfig3 = {
|
|
|
99
89
|
collectCoverage: true,
|
|
100
90
|
coverageDirectory: "coverage",
|
|
101
91
|
coverageProvider: "v8",
|
|
92
|
+
/**
|
|
93
|
+
* https://github.com/jestjs/jest/issues/13739#issuecomment-1517190965
|
|
94
|
+
*/
|
|
95
|
+
extensionsToTreatAsEsm: [".ts", ".tsx"],
|
|
102
96
|
fakeTimers: {
|
|
103
97
|
enableGlobally: true
|
|
104
98
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/config",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.3",
|
|
4
4
|
"description": "Default configuration for packages.",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"src",
|
|
19
|
-
"tsconfig.json"
|
|
19
|
+
"tsconfig.json",
|
|
20
|
+
"tsconfig.test.json"
|
|
20
21
|
],
|
|
21
22
|
"typings": "dist/index.d.ts",
|
|
22
23
|
"dependencies": {
|
package/src/babel.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { configCreator } from './configCreator';
|
|
2
2
|
|
|
3
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
4
|
export const defaultConfig: any = {
|
|
4
5
|
presets: [
|
|
5
|
-
|
|
6
|
-
* `loose: true` to avoid the Storybook warning:
|
|
7
|
-
*
|
|
8
|
-
* > Though the "loose" option was set to "false" in your @babel/preset-env
|
|
9
|
-
* > config, it will not be used for @babel/plugin-proposal-private-property-in-object
|
|
10
|
-
* > since the "loose" mode option was set to "true"
|
|
11
|
-
* > for @babel/plugin-proposal-private-methods.
|
|
12
|
-
*/
|
|
13
|
-
['@babel/preset-env', { loose: true, targets: { node: 'current' } }],
|
|
6
|
+
['@babel/preset-env', { targets: { node: 'current' } }],
|
|
14
7
|
'@babel/preset-typescript',
|
|
15
8
|
['@babel/preset-react', { runtime: 'automatic' }],
|
|
16
9
|
],
|
package/src/jest.ts
CHANGED
|
@@ -10,6 +10,10 @@ export const defaultConfig = {
|
|
|
10
10
|
collectCoverage: true,
|
|
11
11
|
coverageDirectory: 'coverage',
|
|
12
12
|
coverageProvider: 'v8',
|
|
13
|
+
/**
|
|
14
|
+
* https://github.com/jestjs/jest/issues/13739#issuecomment-1517190965
|
|
15
|
+
*/
|
|
16
|
+
extensionsToTreatAsEsm: ['.ts', '.tsx'],
|
|
13
17
|
fakeTimers: {
|
|
14
18
|
enableGlobally: true,
|
|
15
19
|
},
|
|
@@ -25,4 +29,5 @@ export const defaultConfig = {
|
|
|
25
29
|
},
|
|
26
30
|
};
|
|
27
31
|
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
33
|
export const jestConfig = configCreator<any>(defaultConfig);
|
package/tsconfig.json
CHANGED
|
@@ -9,15 +9,20 @@
|
|
|
9
9
|
"ast": true
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Set `moduleResolution` to `Bundler` to use with applications that use
|
|
14
|
+
* webpack, rollup, or other bundlers. If your application uses Node.js
|
|
15
|
+
* without a bundler, set `moduleResolution` to `NodeNext`.
|
|
16
|
+
*/
|
|
17
|
+
"moduleResolution": "Bundler",
|
|
18
|
+
"target": "ESNext",
|
|
19
|
+
"module": "ESNext",
|
|
20
|
+
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
15
21
|
"declaration": true,
|
|
16
22
|
"sourceMap": true,
|
|
17
23
|
"strict": true,
|
|
18
24
|
"noImplicitReturns": true,
|
|
19
25
|
"noFallthroughCasesInSwitch": true,
|
|
20
|
-
"moduleResolution": "node",
|
|
21
26
|
"jsx": "react-jsx",
|
|
22
27
|
"esModuleInterop": true,
|
|
23
28
|
"skipLibCheck": true,
|