@ttoss/config 1.37.9 → 1.37.10

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.
Files changed (2) hide show
  1. package/README.md +137 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,13 +12,29 @@ pnpm add -Dw @ttoss/config
12
12
 
13
13
  Use the configs of this section on the root of your monorepo.
14
14
 
15
+ ### Quick Setup (Recommended)
16
+
17
+ The easiest way to set up all monorepo configurations at once is using the `@ttoss/monorepo` command:
18
+
19
+ ```shell
20
+ pnpm add -Dw @ttoss/monorepo
21
+ npx @ttoss/monorepo setup-monorepo
22
+ ```
23
+
24
+ This command will automatically create all configuration files and install all necessary dependencies for ESLint, Prettier, Husky, commitlint, lint-staged, Lerna, Syncpack, and pnpm workspace.
25
+
26
+ For more details, see [@ttoss/monorepo documentation](https://github.com/ttoss/ttoss/tree/main/packages/monorepo).
27
+
28
+ ### Manual Setup
29
+
30
+ Alternatively, you can set up each tool manually:
31
+
15
32
  ### ESLint and Prettier
16
33
 
17
34
  Install the following packages:
18
35
 
19
36
  ```shell
20
- pnpm add -Dw eslint prettier @ttoss/eslint-config
21
-
37
+ pnpm add -Dw eslint prettier @ttoss/eslint-config @ttoss/config
22
38
  ```
23
39
 
24
40
  Create the `.prettierrc.js` file and add the following configuration:
@@ -69,7 +85,125 @@ Finally, configure Husky:
69
85
  npm set-script prepare "husky install"
70
86
  pnpm run prepare
71
87
  pnpm husky add .husky/commit-msg "pnpm commitlint --edit"
72
- pnpm husky add .husky/pre-commit "pnpm lint-staged"
88
+ pnpm husky add .husky/pre-commit "pnpm lint-staged && pnpm syncpack:list"
89
+ ```
90
+
91
+ ### Lerna (optional)
92
+
93
+ [Lerna](https://lerna.js.org/) helps manage versioning and publishing of packages in a monorepo.
94
+
95
+ Install lerna-lite packages:
96
+
97
+ ```shell
98
+ pnpm add -Dw @lerna-lite/cli @lerna-lite/version @lerna-lite/changed @lerna-lite/list
99
+ ```
100
+
101
+ Create the `lerna.json` file and configure it according to your monorepo structure:
102
+
103
+ ```json title="lerna.json"
104
+ {
105
+ "$schema": "node_modules/@lerna-lite/cli/schemas/lerna-schema.json",
106
+ "version": "independent",
107
+ "npmClient": "pnpm",
108
+ "stream": true,
109
+ "command": {
110
+ "publish": {
111
+ "allowBranch": "main",
112
+ "noPrivate": true
113
+ },
114
+ "version": {
115
+ "conventionalCommits": true,
116
+ "createRelease": "github",
117
+ "message": "chore(release): publish packages",
118
+ "syncWorkspaceLock": true,
119
+ "allowPeerDependenciesUpdate": true
120
+ }
121
+ },
122
+ "ignoreChanges": ["**/__fixtures__/**", "**/tests/**"],
123
+ "packages": ["packages/*"]
124
+ }
125
+ ```
126
+
127
+ ### Syncpack (optional)
128
+
129
+ [Syncpack](https://jamiemason.github.io/syncpack/) ensures consistent versions of dependencies across all packages in your monorepo.
130
+
131
+ Install syncpack:
132
+
133
+ ```shell
134
+ pnpm add -Dw syncpack
135
+ ```
136
+
137
+ Create the `.syncpackrc.js` file:
138
+
139
+ ```js title=".syncpackrc.js"
140
+ const { syncpackConfig } = require('@ttoss/config');
141
+
142
+ module.exports = syncpackConfig();
143
+ ```
144
+
145
+ Add syncpack scripts to your root `package.json`:
146
+
147
+ ```json title="package.json"
148
+ {
149
+ "scripts": {
150
+ "syncpack:fix": "syncpack fix-mismatches",
151
+ "syncpack:list": "syncpack list-mismatches"
152
+ }
153
+ }
154
+ ```
155
+
156
+ ### pnpm workspace (required for pnpm monorepos)
157
+
158
+ Create a `pnpm-workspace.yaml` file to define which directories contain packages:
159
+
160
+ ```yaml title="pnpm-workspace.yaml"
161
+ packages:
162
+ - 'packages/*'
163
+ ```
164
+
165
+ Adjust the `packages` array to match your monorepo structure. For example:
166
+
167
+ ```yaml title="pnpm-workspace.yaml"
168
+ packages:
169
+ - 'packages/*'
170
+ - 'examples/*'
171
+ - 'apps/*'
172
+ ```
173
+
174
+ ### .gitignore (recommended)
175
+
176
+ Create a `.gitignore` file in the monorepo root to exclude common build artifacts and dependencies:
177
+
178
+ ```gitignore title=".gitignore"
179
+ node_modules/
180
+ dist/
181
+ build/
182
+ .build/
183
+ coverage/
184
+ *.log
185
+ .env
186
+ .env.test
187
+ .cache/
188
+ .turbo
189
+ **/i18n/compiled/
190
+ **/i18n/missing/
191
+ **/i18n/unused/
192
+ tsup.config.bundled*.mjs
193
+ package-lock.json
194
+ yarn.lock
195
+ ```
196
+
197
+ ### .npmrc (recommended for pnpm)
198
+
199
+ Create an `.npmrc` file to configure pnpm behavior:
200
+
201
+ ```ini title=".npmrc"
202
+ enable-pre-post-scripts=true
203
+ engine-strict=true
204
+ public-hoist-pattern[]=*eslint*
205
+ public-hoist-pattern[]=*prettier*
206
+ public-hoist-pattern[]=@types*
73
207
  ```
74
208
 
75
209
  ## Packages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/config",
3
- "version": "1.37.9",
3
+ "version": "1.37.10",
4
4
  "description": "Default configuration for packages.",
5
5
  "license": "MIT",
6
6
  "author": "ttoss",