@ttoss/config 1.17.0 → 1.18.1
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 +16 -16
- package/dist/esm/index.js +3 -2
- package/dist/index.js +3 -2
- package/package.json +15 -18
- package/src/lintstaged.ts +2 -1
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,23 +168,23 @@ 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
|
```
|
|
175
175
|
|
|
176
176
|
### Jest
|
|
177
177
|
|
|
178
|
-
Install [Jest](https://jestjs.io/) and its types on
|
|
178
|
+
Install [Jest](https://jestjs.io/) and its types on your package:
|
|
179
179
|
|
|
180
180
|
```shell
|
|
181
|
-
yarn add -
|
|
181
|
+
yarn add -D jest @types/jest
|
|
182
182
|
```
|
|
183
183
|
|
|
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
|
@@ -49,8 +49,9 @@ var jestConfig = configCreator(defaultConfig3);
|
|
|
49
49
|
|
|
50
50
|
// src/lintstaged.ts
|
|
51
51
|
var defaultConfig4 = {
|
|
52
|
-
"*.{js,jsx,ts,tsx}": "eslint --fix",
|
|
53
|
-
"*.{md,mdx,html,json,yml,yaml}": "prettier --write"
|
|
52
|
+
"*.{js,jsx,ts,tsx}": "eslint --quiet --fix",
|
|
53
|
+
"*.{md,mdx,html,json,yml,yaml}": "prettier --write",
|
|
54
|
+
"package.json": "prettier-package-json --write"
|
|
54
55
|
};
|
|
55
56
|
var lintstagedConfig = configCreator(defaultConfig4);
|
|
56
57
|
|
package/dist/index.js
CHANGED
|
@@ -81,8 +81,9 @@ var jestConfig = configCreator(defaultConfig3);
|
|
|
81
81
|
|
|
82
82
|
// src/lintstaged.ts
|
|
83
83
|
var defaultConfig4 = {
|
|
84
|
-
"*.{js,jsx,ts,tsx}": "eslint --fix",
|
|
85
|
-
"*.{md,mdx,html,json,yml,yaml}": "prettier --write"
|
|
84
|
+
"*.{js,jsx,ts,tsx}": "eslint --quiet --fix",
|
|
85
|
+
"*.{md,mdx,html,json,yml,yaml}": "prettier --write",
|
|
86
|
+
"package.json": "prettier-package-json --write"
|
|
86
87
|
};
|
|
87
88
|
var lintstagedConfig = configCreator(defaultConfig4);
|
|
88
89
|
|
package/package.json
CHANGED
|
@@ -1,32 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"description": "Default configuration for packages.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
"author": "ttoss",
|
|
7
|
+
"contributors": [
|
|
8
|
+
"Pedro Arantes <pedro@arantespp.com> (https://arantespp.com)"
|
|
9
|
+
],
|
|
9
10
|
"main": "dist/index.js",
|
|
10
|
-
"typings": "dist/index.d.ts",
|
|
11
11
|
"module": "dist/esm/index.js",
|
|
12
12
|
"files": [
|
|
13
13
|
"dist",
|
|
14
14
|
"src",
|
|
15
15
|
"tsconfig.json"
|
|
16
16
|
],
|
|
17
|
-
"keywords": [],
|
|
18
|
-
"author": "ttoss",
|
|
19
|
-
"contributors": [
|
|
20
|
-
{
|
|
21
|
-
"email": "pedro@arantespp.com",
|
|
22
|
-
"name": "Pedro Arantes",
|
|
23
|
-
"url": "https://arantespp.com"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
17
|
"scripts": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
18
|
+
"build": "tsup-node",
|
|
19
|
+
"test": "jest"
|
|
29
20
|
},
|
|
21
|
+
"typings": "dist/index.d.ts",
|
|
30
22
|
"dependencies": {
|
|
31
23
|
"@babel/preset-env": "^7.18.6",
|
|
32
24
|
"@babel/preset-react": "^7.18.6",
|
|
@@ -35,12 +27,17 @@
|
|
|
35
27
|
"@formatjs/ts-transformer": "^3.9.8",
|
|
36
28
|
"babel-plugin-formatjs": "^10.3.24",
|
|
37
29
|
"deepmerge": "^4.2.2",
|
|
38
|
-
"identity-obj-proxy": "^3.0.0"
|
|
30
|
+
"identity-obj-proxy": "^3.0.0",
|
|
31
|
+
"prettier-package-json": "^2.6.4"
|
|
39
32
|
},
|
|
40
33
|
"devDependencies": {
|
|
41
34
|
"@jest/types": "^27.4.2",
|
|
42
35
|
"@types/jest": "^28.1.3",
|
|
43
36
|
"jest": "^28.1.1"
|
|
44
37
|
},
|
|
45
|
-
"
|
|
38
|
+
"keywords": [],
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "5624791e118681b8ecbe2372bbc61806442df71b"
|
|
46
43
|
}
|
package/src/lintstaged.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { configCreator } from './configCreator';
|
|
2
2
|
|
|
3
3
|
export const defaultConfig: any = {
|
|
4
|
-
'*.{js,jsx,ts,tsx}': 'eslint --fix',
|
|
4
|
+
'*.{js,jsx,ts,tsx}': 'eslint --quiet --fix',
|
|
5
5
|
'*.{md,mdx,html,json,yml,yaml}': 'prettier --write',
|
|
6
|
+
'package.json': 'prettier-package-json --write',
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export const lintstagedConfig = configCreator(defaultConfig);
|