@ttoss/config 1.15.2 → 1.16.4
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 +14 -14
- package/dist/esm/index.js +3 -7
- package/dist/index.js +2 -7
- package/package.json +14 -20
- package/src/babel.ts +0 -3
- package/src/jest.spec.ts +1 -1
- package/src/jest.ts +0 -3
- package/src/lintstaged.spec.ts +2 -2
- package/src/prettier.spec.ts +2 -2
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
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:
|
|
6
6
|
|
|
7
7
|
```js title=".prettierrc.js"
|
|
8
|
-
const { prettierConfig } = require(
|
|
8
|
+
const { prettierConfig } = require("@ttoss/config");
|
|
9
9
|
|
|
10
10
|
module.exports = prettierConfig();
|
|
11
11
|
```
|
|
@@ -13,7 +13,7 @@ module.exports = prettierConfig();
|
|
|
13
13
|
But, if you want to change the `printWidth` [option](https://prettier.io/docs/en/options.html), you can do so:
|
|
14
14
|
|
|
15
15
|
```js title=".prettierrc.js"
|
|
16
|
-
const { prettierConfig } = require(
|
|
16
|
+
const { prettierConfig } = require("@ttoss/config");
|
|
17
17
|
|
|
18
18
|
module.exports = prettierConfig({
|
|
19
19
|
printWidth: 120,
|
|
@@ -23,24 +23,24 @@ module.exports = prettierConfig({
|
|
|
23
23
|
You can also pass a second argument to every configuration to handle array's append or overwrite items.
|
|
24
24
|
|
|
25
25
|
```js title="babel.config.js"
|
|
26
|
-
const { babelConfig } = require(
|
|
26
|
+
const { babelConfig } = require("@ttoss/config");
|
|
27
27
|
|
|
28
28
|
// Append plugins (default)
|
|
29
29
|
const appendConfig = babelConfig(
|
|
30
30
|
{
|
|
31
|
-
plugins: [
|
|
31
|
+
plugins: ["@babel/plugin-proposal-class-properties"],
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
arrayMerge:
|
|
34
|
+
arrayMerge: "append",
|
|
35
35
|
}
|
|
36
36
|
);
|
|
37
37
|
|
|
38
38
|
const overwriteConfig = babelConfig(
|
|
39
39
|
{
|
|
40
|
-
plugins: [
|
|
40
|
+
plugins: ["@babel/plugin-proposal-class-properties"],
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
|
-
arrayMerge:
|
|
43
|
+
arrayMerge: "overwrite",
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
```
|
|
@@ -67,7 +67,7 @@ Add the configs of this section on the root of your monorepo. For configs for pa
|
|
|
67
67
|
Create `.prettierrc.js` (`touch .prettierrc.js`) and add the following to it:
|
|
68
68
|
|
|
69
69
|
```js title=".prettierrc.js"
|
|
70
|
-
const { prettierConfig } = require(
|
|
70
|
+
const { prettierConfig } = require("@ttoss/config");
|
|
71
71
|
|
|
72
72
|
module.exports = prettierConfig();
|
|
73
73
|
```
|
|
@@ -76,7 +76,7 @@ Create `.eslintrc.js` (`touch .eslintrc.js`) and add the following to it:
|
|
|
76
76
|
|
|
77
77
|
```js title=".eslintrc.js"
|
|
78
78
|
module.exports = {
|
|
79
|
-
extends:
|
|
79
|
+
extends: "@ttoss/eslint-config",
|
|
80
80
|
};
|
|
81
81
|
```
|
|
82
82
|
|
|
@@ -93,7 +93,7 @@ yarn add -DW husky
|
|
|
93
93
|
Create `.commitlintrc.js` (`touch .commitlintrc.js`) and add the following to it:
|
|
94
94
|
|
|
95
95
|
```js title=".commitlintrc.js"
|
|
96
|
-
const { commitlintConfig } = require(
|
|
96
|
+
const { commitlintConfig } = require("@ttoss/config");
|
|
97
97
|
|
|
98
98
|
module.exports = commitlintConfig();
|
|
99
99
|
```
|
|
@@ -101,7 +101,7 @@ module.exports = commitlintConfig();
|
|
|
101
101
|
Create `.lintstagedrc.js` (`touch .lintstagedrc.js`) and add the following to it:
|
|
102
102
|
|
|
103
103
|
```js title=".lintstagedrc.js"
|
|
104
|
-
const { lintstagedConfig } = require(
|
|
104
|
+
const { lintstagedConfig } = require("@ttoss/config");
|
|
105
105
|
|
|
106
106
|
module.exports = lintstagedConfig();
|
|
107
107
|
```
|
|
@@ -168,7 +168,7 @@ You can use configs below to your packages and applications folders.
|
|
|
168
168
|
Add `babel.config.js` (`touch babel.config.js`) on the package folder:
|
|
169
169
|
|
|
170
170
|
```js title="babel.config.js"
|
|
171
|
-
const { babelConfig } = require(
|
|
171
|
+
const { babelConfig } = require("@ttoss/config");
|
|
172
172
|
|
|
173
173
|
module.exports = babelConfig();
|
|
174
174
|
```
|
|
@@ -184,7 +184,7 @@ yarn add -DW jest @types/jest
|
|
|
184
184
|
Create `jest.config.ts` (`touch jest.config.ts`) on the package folder:
|
|
185
185
|
|
|
186
186
|
```ts title="jest.config.ts"
|
|
187
|
-
import { jestConfig } from
|
|
187
|
+
import { jestConfig } from "@ttoss/config";
|
|
188
188
|
|
|
189
189
|
const config = jestConfig();
|
|
190
190
|
|
|
@@ -212,7 +212,7 @@ yarn add -DW tsup
|
|
|
212
212
|
Create `tsup.config.ts` (`touch tsup.config.ts`) on the package folder:
|
|
213
213
|
|
|
214
214
|
```ts title="tsup.config.ts"
|
|
215
|
-
import { tsupConfig } from
|
|
215
|
+
import { tsupConfig } from "@ttoss/config";
|
|
216
216
|
|
|
217
217
|
export const tsup = tsupConfig();
|
|
218
218
|
```
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
1
3
|
// src/configCreator.ts
|
|
2
4
|
import deepmerge from "deepmerge";
|
|
3
5
|
var overwriteMerge = (_, sourceArray) => sourceArray;
|
|
@@ -19,10 +21,7 @@ var defaultConfig = {
|
|
|
19
21
|
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
20
22
|
ast: true
|
|
21
23
|
}
|
|
22
|
-
]
|
|
23
|
-
["@babel/plugin-proposal-class-properties", { loose: true }],
|
|
24
|
-
["@babel/plugin-proposal-private-methods", { loose: true }],
|
|
25
|
-
["@babel/plugin-proposal-private-property-in-object", { loose: true }]
|
|
24
|
+
]
|
|
26
25
|
]
|
|
27
26
|
};
|
|
28
27
|
var babelConfig = configCreator(defaultConfig);
|
|
@@ -39,9 +38,6 @@ var defaultConfig3 = {
|
|
|
39
38
|
collectCoverage: true,
|
|
40
39
|
coverageDirectory: "coverage",
|
|
41
40
|
coverageProvider: "v8",
|
|
42
|
-
moduleNameMapper: {
|
|
43
|
-
"\\.(css)$": "identity-obj-proxy"
|
|
44
|
-
},
|
|
45
41
|
fakeTimers: {
|
|
46
42
|
enableGlobally: true
|
|
47
43
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -52,10 +53,7 @@ var defaultConfig = {
|
|
|
52
53
|
idInterpolationPattern: "[sha512:contenthash:base64:6]",
|
|
53
54
|
ast: true
|
|
54
55
|
}
|
|
55
|
-
]
|
|
56
|
-
["@babel/plugin-proposal-class-properties", { loose: true }],
|
|
57
|
-
["@babel/plugin-proposal-private-methods", { loose: true }],
|
|
58
|
-
["@babel/plugin-proposal-private-property-in-object", { loose: true }]
|
|
56
|
+
]
|
|
59
57
|
]
|
|
60
58
|
};
|
|
61
59
|
var babelConfig = configCreator(defaultConfig);
|
|
@@ -72,9 +70,6 @@ var defaultConfig3 = {
|
|
|
72
70
|
collectCoverage: true,
|
|
73
71
|
coverageDirectory: "coverage",
|
|
74
72
|
coverageProvider: "v8",
|
|
75
|
-
moduleNameMapper: {
|
|
76
|
-
"\\.(css)$": "identity-obj-proxy"
|
|
77
|
-
},
|
|
78
73
|
fakeTimers: {
|
|
79
74
|
enableGlobally: true
|
|
80
75
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.4",
|
|
4
4
|
"description": "Default configuration for packages.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
{
|
|
21
21
|
"email": "pedro@arantespp.com",
|
|
22
22
|
"name": "Pedro Arantes",
|
|
23
|
-
"url": "https://arantespp.com
|
|
23
|
+
"url": "https://arantespp.com"
|
|
24
24
|
}
|
|
25
25
|
],
|
|
26
26
|
"scripts": {
|
|
@@ -28,24 +28,18 @@
|
|
|
28
28
|
"build": "tsup"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/preset-env": "^7.
|
|
32
|
-
"@babel/preset-react": "^7.
|
|
33
|
-
"@babel/preset-typescript": "^7.
|
|
34
|
-
"@commitlint/
|
|
35
|
-
"@
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"babel-jest": "^27.4.6",
|
|
39
|
-
"babel-plugin-formatjs": "^10.3.18",
|
|
40
|
-
"deepmerge": "^4.2.2",
|
|
41
|
-
"eslint": "^8.14.0",
|
|
42
|
-
"identity-obj-proxy": "^3.0.0",
|
|
43
|
-
"lint-staged": "^12.4.1",
|
|
44
|
-
"prettier": "^2.6.2",
|
|
45
|
-
"tsup": "^5.11.11"
|
|
31
|
+
"@babel/preset-env": "^7.18.6",
|
|
32
|
+
"@babel/preset-react": "^7.18.6",
|
|
33
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
34
|
+
"@commitlint/config-conventional": "^17.0.3",
|
|
35
|
+
"@formatjs/ts-transformer": "^3.9.8",
|
|
36
|
+
"babel-plugin-formatjs": "^10.3.24",
|
|
37
|
+
"deepmerge": "^4.2.2"
|
|
46
38
|
},
|
|
47
|
-
"gitHead": "edc913c860d3e8d34b385e599fba28093bf0bd14",
|
|
48
39
|
"devDependencies": {
|
|
49
|
-
"@jest/types": "^27.4.2"
|
|
50
|
-
|
|
40
|
+
"@jest/types": "^27.4.2",
|
|
41
|
+
"@types/jest": "^28.1.3",
|
|
42
|
+
"jest": "^28.1.1"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "c98df8182caa5b9649ce667e88e84cddbe5ef35e"
|
|
51
45
|
}
|
package/src/babel.ts
CHANGED
|
@@ -22,9 +22,6 @@ export const defaultConfig: any = {
|
|
|
22
22
|
ast: true,
|
|
23
23
|
},
|
|
24
24
|
],
|
|
25
|
-
['@babel/plugin-proposal-class-properties', { loose: true }],
|
|
26
|
-
['@babel/plugin-proposal-private-methods', { loose: true }],
|
|
27
|
-
['@babel/plugin-proposal-private-property-in-object', { loose: true }],
|
|
28
25
|
],
|
|
29
26
|
};
|
|
30
27
|
|
package/src/jest.spec.ts
CHANGED
package/src/jest.ts
CHANGED
package/src/lintstaged.spec.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultConfig, lintstagedConfig } from './lintstaged';
|
|
2
2
|
|
|
3
3
|
test('should return default configuration', () => {
|
|
4
4
|
expect(lintstagedConfig()).toEqual(defaultConfig);
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
test('should
|
|
7
|
+
test('should append a config', () => {
|
|
8
8
|
expect(
|
|
9
9
|
lintstagedConfig({
|
|
10
10
|
'.js': 'eslint --fix',
|
package/src/prettier.spec.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defaultConfig, prettierConfig } from './prettier';
|
|
2
2
|
|
|
3
3
|
test('should return default configuration', () => {
|
|
4
4
|
expect(prettierConfig()).toEqual(defaultConfig);
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
test('should
|
|
7
|
+
test('should append config', () => {
|
|
8
8
|
expect(
|
|
9
9
|
prettierConfig({
|
|
10
10
|
printWidth: 100,
|