You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"type-check:watch": "npm run type-check -- --watch --preserveWatchOutput"
122
+
"type-check": "tsc --noEmit"
122
123
},
123
124
...
124
125
```
125
126
126
-
Run it:
127
-
128
-
```bash
129
-
npm run build
130
-
131
-
```
132
-
133
-
> NOTES:
134
-
>
135
-
> Run multiple times to check that it is cached.
136
-
>
137
-
> Add some error in `motto-helpers` to check that the process is stopped.
127
+
Let's add the `.turbo` folder to `.gitignore`:
138
128
139
-
If we want to apply the same approach to the `type-check:watch` command, we can run [multiple tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks#turborepo-can-multitask) in parallel:
> Add some error in `motto-helpers` to check that the process is stopped.
152
+
198
153
If we have more than one project where we need to run the `build` command, and they depend on each other, it will automatically resolve the execution order according to the dependencies.
199
154
200
155
Let's update the `house-helpers` project to add the `build` command:
+ "type-check:watch": "npm run type-check -- --watch --preserveWatchOutput"
239
191
+ },
240
192
...
241
193
@@ -255,6 +207,7 @@ export default defineConfig({
255
207
lib: {
256
208
entry: "src/index.ts",
257
209
name: "HouseHelpers",
210
+
fileName: "index",
258
211
},
259
212
},
260
213
});
@@ -264,7 +217,7 @@ export default defineConfig({
264
217
Run it:
265
218
266
219
```bash
267
-
npm start
220
+
npm run build
268
221
269
222
```
270
223
@@ -279,12 +232,11 @@ _./turbo.json_
279
232
```diff
280
233
{
281
234
"$schema": "https://turbo.build/schema.json",
282
-
"pipeline": {
235
+
"tasks": {
283
236
"start": {
284
237
"cache": false,
285
238
"persistent": true,
286
239
},
287
-
"type-check:watch": {},
288
240
"build": {
289
241
"outputs": ["dist/**/*"],
290
242
- "dependsOn": ["type-check"]
@@ -305,7 +257,7 @@ _./turbo.json_
305
257
```diff
306
258
{
307
259
"$schema": "https://turbo.build/schema.json",
308
-
"pipeline": {
260
+
"tasks": {
309
261
"start": {
310
262
"cache": false,
311
263
"persistent": true
@@ -330,29 +282,28 @@ npm run build
330
282
331
283
```
332
284
333
-
Knowing the above, we could have some errors if we are running the `start` command without running the `build` command before (for example if we remove the dist folder on helpers):
285
+
Knowing the above, we can build the helpers projects before starting the applications:
334
286
335
287
336
288
```bash
337
289
npm start
338
290
339
291
```
340
292
293
+
341
294
Let's update it:
342
295
296
+
343
297
_./turbo.json_
344
298
345
299
```diff
346
300
{
347
301
"$schema": "https://turbo.build/schema.json",
348
-
"pipeline": {
302
+
"tasks": {
349
303
"start": {
350
304
"cache": false,
351
305
"persistent": true,
352
-
+ "dependsOn": ["build"]
353
-
},
354
-
"type-check:watch": {
355
-
+ "dependsOn": ["build"]
306
+
+ "dependsOn": ["^build"]
356
307
},
357
308
"build": {
358
309
"outputs": ["dist/**/*"],
@@ -368,6 +319,30 @@ _./turbo.json_
368
319
369
320
> NOTE: We cannot use a `watch mode` command such as `dependsOn` because it will block the process.
> Make some changes in `house-helpers` and `motto-helpers` to check that the process is restarted.
345
+
371
346
Finally, if we only want to run a command for some projects, we can do it using the [filter](https://turbo.build/repo/docs/core-concepts/monorepos/filtering#multiple-filters) flag:
0 commit comments