@ttoss/config 1.13.1 → 1.14.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 +24 -20
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,15 +53,17 @@ $ yarn add -DW @ttoss/config
|
|
|
53
53
|
|
|
54
54
|
## Monorepo
|
|
55
55
|
|
|
56
|
+
Add the configs of this section on the root of your monorepo. For configs for packages, you can check the section [Packages and Applications](#packages-and-applications). You can check [this monorepo template](https://github.com/ttoss/monorepo) if you want to see the final configuration after following the steps.
|
|
57
|
+
|
|
56
58
|
### ESLint and Prettier
|
|
57
59
|
|
|
58
60
|
Install the following packages on the root of your monorepo:
|
|
59
61
|
|
|
60
62
|
```shell
|
|
61
|
-
yarn add -DW eslint @rushstack/eslint-patch prettier
|
|
63
|
+
yarn add -DW eslint @ttoss/eslint-config @rushstack/eslint-patch prettier
|
|
62
64
|
```
|
|
63
65
|
|
|
64
|
-
Create `.prettierrc.js
|
|
66
|
+
Create `.prettierrc.js` (`touch .prettierrc.js`) and add the following to it:
|
|
65
67
|
|
|
66
68
|
```js title=".prettierrc.js"
|
|
67
69
|
const { prettierConfig } = require('@ttoss/config');
|
|
@@ -69,7 +71,7 @@ const { prettierConfig } = require('@ttoss/config');
|
|
|
69
71
|
module.exports = prettierConfig();
|
|
70
72
|
```
|
|
71
73
|
|
|
72
|
-
Create `.eslintrc.js
|
|
74
|
+
Create `.eslintrc.js` (`touch .eslintrc.js`) and add the following to it:
|
|
73
75
|
|
|
74
76
|
```js title=".eslintrc.js"
|
|
75
77
|
require('@rushstack/eslint-patch/modern-module-resolution');
|
|
@@ -91,7 +93,7 @@ Install the following packages on the root of your monorepo:
|
|
|
91
93
|
yarn add -DW husky @commitlint/cli lint-staged
|
|
92
94
|
```
|
|
93
95
|
|
|
94
|
-
Create `.commitlintrc.js
|
|
96
|
+
Create `.commitlintrc.js` (`touch .commitlintrc.js`) and add the following to it:
|
|
95
97
|
|
|
96
98
|
```js title=".commitlintrc.js"
|
|
97
99
|
const { commitlintConfig } = require('@ttoss/config');
|
|
@@ -99,7 +101,7 @@ const { commitlintConfig } = require('@ttoss/config');
|
|
|
99
101
|
module.exports = commitlintConfig();
|
|
100
102
|
```
|
|
101
103
|
|
|
102
|
-
Create `.lintstagedrc.js
|
|
104
|
+
Create `.lintstagedrc.js` (`touch .lintstagedrc.js`) and add the following to it:
|
|
103
105
|
|
|
104
106
|
```js title=".lintstagedrc.js"
|
|
105
107
|
const { lintstagedConfig } = require('@ttoss/config');
|
|
@@ -110,7 +112,7 @@ module.exports = lintstagedConfig();
|
|
|
110
112
|
Finally, configure Husky:
|
|
111
113
|
|
|
112
114
|
```shell
|
|
113
|
-
|
|
115
|
+
npm set-script prepare "husky install"
|
|
114
116
|
yarn run prepare
|
|
115
117
|
yarn husky add .husky/commit-msg "yarn commitlint --edit"
|
|
116
118
|
yarn husky add .husky/pre-commit "yarn lint-staged"
|
|
@@ -126,7 +128,7 @@ Install [Lerna](https://github.com/lerna/lerna) on the root of your monorepo:
|
|
|
126
128
|
yarn add -DW lerna
|
|
127
129
|
```
|
|
128
130
|
|
|
129
|
-
And add `lerna.json` config file:
|
|
131
|
+
And add `lerna.json` (`touch lerna.json`) config file:
|
|
130
132
|
|
|
131
133
|
```json title="lerna.json"
|
|
132
134
|
{
|
|
@@ -152,7 +154,7 @@ Finally, add the following in a `package.json` file to configure [Yarn Workspace
|
|
|
152
154
|
```json title="package.json"
|
|
153
155
|
{
|
|
154
156
|
"private": true,
|
|
155
|
-
"workspaces": ["
|
|
157
|
+
"workspaces": ["packages/**/*"]
|
|
156
158
|
}
|
|
157
159
|
```
|
|
158
160
|
|
|
@@ -162,9 +164,11 @@ Coming soon...
|
|
|
162
164
|
|
|
163
165
|
## Packages and Applications
|
|
164
166
|
|
|
167
|
+
You can use configs below to your packages and applications folders.
|
|
168
|
+
|
|
165
169
|
### Babel
|
|
166
170
|
|
|
167
|
-
Add `babel.config.js`
|
|
171
|
+
Add `babel.config.js` (`touch babel.config.js`) on the package folder:
|
|
168
172
|
|
|
169
173
|
```js title="babel.config.js"
|
|
170
174
|
const { babelConfig } = require('@ttoss/config');
|
|
@@ -174,13 +178,13 @@ module.exports = babelConfig();
|
|
|
174
178
|
|
|
175
179
|
### Jest
|
|
176
180
|
|
|
177
|
-
Install [Jest](https://jestjs.io/) and its types on the root of your monorepo
|
|
181
|
+
Install [Jest](https://jestjs.io/) and its types on the root of your monorepo:
|
|
178
182
|
|
|
179
183
|
```shell
|
|
180
184
|
yarn add -DW jest @types/jest
|
|
181
185
|
```
|
|
182
186
|
|
|
183
|
-
Create `jest.config.ts`
|
|
187
|
+
Create `jest.config.ts` (`touch jest.config.ts`) on the package folder:
|
|
184
188
|
|
|
185
189
|
```ts title="jest.config.ts"
|
|
186
190
|
import { jestConfig } from '@ttoss/config';
|
|
@@ -190,11 +194,11 @@ const config = jestConfig();
|
|
|
190
194
|
export default config;
|
|
191
195
|
```
|
|
192
196
|
|
|
193
|
-
Configure the `test` script on `package.json
|
|
197
|
+
Configure the `test` script on `package.json` of your package:
|
|
194
198
|
|
|
195
199
|
```json title="package.json"
|
|
196
|
-
"scripts: {
|
|
197
|
-
test:
|
|
200
|
+
"scripts": {
|
|
201
|
+
"test": "jest",
|
|
198
202
|
}
|
|
199
203
|
```
|
|
200
204
|
|
|
@@ -202,13 +206,13 @@ Configure the `test` script on `package.json`:
|
|
|
202
206
|
|
|
203
207
|
Use [tsup](https://tsup.egoist.sh/) to bundle your TypeScript package, if you need to.
|
|
204
208
|
|
|
205
|
-
Install [tsup](https://tsup.egoist.sh/) on the root of your monorepo
|
|
209
|
+
Install [tsup](https://tsup.egoist.sh/) on the root of your monorepo:
|
|
206
210
|
|
|
207
211
|
```shell
|
|
208
212
|
yarn add -DW tsup
|
|
209
213
|
```
|
|
210
214
|
|
|
211
|
-
Create `tsup.config.ts`
|
|
215
|
+
Create `tsup.config.ts` (`touch tsup.config.ts`) on the package folder:
|
|
212
216
|
|
|
213
217
|
```ts title="tsup.config.ts"
|
|
214
218
|
import { tsupConfig } from '@ttoss/config';
|
|
@@ -219,20 +223,20 @@ export const tsup = tsupConfig();
|
|
|
219
223
|
Configure the `build` script on `package.json`:
|
|
220
224
|
|
|
221
225
|
```json title="package.json"
|
|
222
|
-
"scripts: {
|
|
223
|
-
build:
|
|
226
|
+
"scripts": {
|
|
227
|
+
"build": "tsup",
|
|
224
228
|
}
|
|
225
229
|
```
|
|
226
230
|
|
|
227
231
|
### TypeScript
|
|
228
232
|
|
|
229
|
-
Install [TypeScript](https://www.npmjs.com/package/typescript) on the root of your monorepo
|
|
233
|
+
Install [TypeScript](https://www.npmjs.com/package/typescript) on the root of your monorepo:
|
|
230
234
|
|
|
231
235
|
```shell
|
|
232
236
|
yarn add -DW typescript
|
|
233
237
|
```
|
|
234
238
|
|
|
235
|
-
Extend default configuration for each `tsconfig.json`
|
|
239
|
+
Extend default configuration for each `tsconfig.json` (`touch tsconfig.json`) on the package folder:
|
|
236
240
|
|
|
237
241
|
```json title="tsconfig.json"
|
|
238
242
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.1",
|
|
4
4
|
"description": "Default configuration for packages.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"identity-obj-proxy": "^3.0.0",
|
|
41
41
|
"tsup": "^5.11.11"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "c47a7a0773b8ccdf631942994abc660e68f0597e",
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@jest/types": "^27.4.2"
|
|
46
46
|
}
|