-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
533 lines (407 loc) · 16.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
# standardise on a shell
export SHELL := /usr/bin/env bash
################################## DEFAULT TARGET ##############################
# lists available `make` targets
.PHONY: ls
ls:
@node scripts/list-make-targets.mjs
###################################### DEV #####################################
# runs storybook for all projects in single instance
.PHONY: storybooks
storybooks: env
$(call log,"Starting storybooks")
@corepack pnpm --filter=storybooks dev
# runs the dev targets for all projects in single instance
.PHONY: dev
dev: env
$(call log,"Starting dev tasks")
@corepack pnpm -r --no-bail --parallel dev
################################# CODE QUALITY #################################
# runs the unit tests for all projects
.PHONY: test
test: env
$(call log,"Running unit tests")
@corepack pnpm -r --no-bail test
# get test coverage for CSTI projects
.PHONY: test\:coverage
test\:coverage: env
$(call log,"Running unit tests")
@corepack pnpm --filter coverage start
# runs the e2e tests for all projects
.PHONY: e2e
e2e: env
$(call log,"Running e2e tests")
@corepack pnpm -r --no-bail e2e
# runs unit tests against dist for all projects
.PHONY: verify-dist
verify-dist: env
$(call log,"Running unit tests against dist")
@corepack pnpm -r --no-bail verify-dist
# checks all projects for lint errors
.PHONY: lint
lint: env
$(call log,"Linting projects")
@corepack pnpm -r lint
@corepack pnpm lint:packages
@node ./scripts/check-packages-for-tslib.mjs
@node ./scripts/lint-node.js
# check repo for formatting errors
.PHONY: formatting\:check
formatting\:check: env
$(call log,"Checking formatting across repo")
@corepack pnpm prettier --ignore-unknown --cache --check .
# attemps to fix lint errors across all projects
.PHONY: fix
fix: env
$(call log,"Attempting to fix issues across all projects")
@corepack pnpm -r --no-bail fix
@corepack pnpm prettier --ignore-unknown --cache --write .
# type-checking all projects
.PHONY: tsc
tsc: env
$(call log,"Checking types across all projects")
@corepack pnpm -r --no-bail tsc
# makes sure absolutely everything is working
.PHONY: validate
validate: env tsc lint test e2e build verify-dist build-storybook
##################################### BUILD ####################################
# removes all build artifacts and task caches
.PHONY: clean
clean:
$(call log,"Clearing all task caches")
@find . -type d \( -path '*/node_modules*' -prune \) \
-o \( -type d \( -name 'dist' -o -name '.wireit' \) \
-exec rm -rf {} + \)
# builds all projects
.PHONY: build
build: env
$(call log,"Building projects")
@corepack pnpm -r --no-bail build
# builds all storybooks
.PHONY: build-storybook
build-storybook: env
$(call log,"Building storybooks")
@corepack pnpm run -r build-storybook
############################### MANAGING PACKAGES ##############################
# n.b. publishing is handled in CI using .github/workflows/changesets.yml
# creates a new [changeset](https://github.com/changesets/changesets/blob/main/docs/intro-to-using-changesets.md)
.PHONY: changeset
changeset: env
$(call log,"Creating a new changeset")
@corepack pnpm changeset
# takes changesets that have been made and updates versions and dependencies of packages, as well as writing changelogs
# updates the lockfile with the updated versions of the packages https://github.com/changesets/changesets/issues/421
.PHONY: changeset-version
changeset-version: env
$(call log,"Updating versions, dependencies and writing changelog")
@corepack pnpm changeset version
@corepack pnpm install --lockfile-only
################################ INTERNAL UTILS ################################
# loosely styled logging for user feedback
define log
@echo -e "\x1b[2m$(1)\x1b[0m"
endef
# Make sure the local env is set up correctly.
.PHONY: env # PRIVATE
env: check-node-version install
# Make sure we're using the correct node version.
.PHONY: check-node-version # PRIVATE
check-node-version:
$(call log,"Checking Node")
@./scripts/check-node-version
# Install dependencies. If deps are up to date this is almost instant, so we can
# run before every other target with very little DX cost.
.PHONY: install # PRIVATE
install: check-node-version
$(call log,"Refreshing dependencies")
@corepack pnpm install --frozen-lockfile
############################## START PROJECT_TASKS #############################
# This is a set of all possible project-specific tasks.
#
# IT IS AUTOGENERATED BY scripts/maintain-makefile/index.mjs
#
# It enables running the relevant npm-scripts wrapped in the
# standardised Makefile prerequisites.
#
# It also enables us to abstract away things like package manager vendor/version
# etc.
.PHONY: @guardian/ab-core\:build
@guardian/ab-core\:build: env
@corepack pnpm --filter @guardian/ab-core build
.PHONY: @guardian/ab-core\:dev
@guardian/ab-core\:dev: env
@corepack pnpm --filter @guardian/ab-core dev
.PHONY: @guardian/ab-core\:fix
@guardian/ab-core\:fix: env
@corepack pnpm --filter @guardian/ab-core fix
.PHONY: @guardian/ab-core\:lint
@guardian/ab-core\:lint: env
@corepack pnpm --filter @guardian/ab-core lint
.PHONY: @guardian/ab-core\:test
@guardian/ab-core\:test: env
@corepack pnpm --filter @guardian/ab-core test
.PHONY: @guardian/ab-core\:tsc
@guardian/ab-core\:tsc: env
@corepack pnpm --filter @guardian/ab-core tsc
.PHONY: @guardian/ab-core\:verify-dist
@guardian/ab-core\:verify-dist: env
@corepack pnpm --filter @guardian/ab-core verify-dist
.PHONY: @guardian/ab-react\:build
@guardian/ab-react\:build: env
@corepack pnpm --filter @guardian/ab-react build
.PHONY: @guardian/ab-react\:dev
@guardian/ab-react\:dev: env
@corepack pnpm --filter @guardian/ab-react dev
.PHONY: @guardian/ab-react\:fix
@guardian/ab-react\:fix: env
@corepack pnpm --filter @guardian/ab-react fix
.PHONY: @guardian/ab-react\:lint
@guardian/ab-react\:lint: env
@corepack pnpm --filter @guardian/ab-react lint
.PHONY: @guardian/ab-react\:test
@guardian/ab-react\:test: env
@corepack pnpm --filter @guardian/ab-react test
.PHONY: @guardian/ab-react\:tsc
@guardian/ab-react\:tsc: env
@corepack pnpm --filter @guardian/ab-react tsc
.PHONY: @guardian/ab-react\:verify-dist
@guardian/ab-react\:verify-dist: env
@corepack pnpm --filter @guardian/ab-react verify-dist
.PHONY: @guardian/browserslist-config\:fix
@guardian/browserslist-config\:fix: env
@corepack pnpm --filter @guardian/browserslist-config fix
.PHONY: @guardian/browserslist-config\:lint
@guardian/browserslist-config\:lint: env
@corepack pnpm --filter @guardian/browserslist-config lint
.PHONY: @guardian/browserslist-config\:tsc
@guardian/browserslist-config\:tsc: env
@corepack pnpm --filter @guardian/browserslist-config tsc
.PHONY: @guardian/browserslist-config\:update-readme
@guardian/browserslist-config\:update-readme: env
@corepack pnpm --filter @guardian/browserslist-config update-readme
.PHONY: @guardian/core-web-vitals\:build
@guardian/core-web-vitals\:build: env
@corepack pnpm --filter @guardian/core-web-vitals build
.PHONY: @guardian/core-web-vitals\:dev
@guardian/core-web-vitals\:dev: env
@corepack pnpm --filter @guardian/core-web-vitals dev
.PHONY: @guardian/core-web-vitals\:fix
@guardian/core-web-vitals\:fix: env
@corepack pnpm --filter @guardian/core-web-vitals fix
.PHONY: @guardian/core-web-vitals\:lint
@guardian/core-web-vitals\:lint: env
@corepack pnpm --filter @guardian/core-web-vitals lint
.PHONY: @guardian/core-web-vitals\:test
@guardian/core-web-vitals\:test: env
@corepack pnpm --filter @guardian/core-web-vitals test
.PHONY: @guardian/core-web-vitals\:tsc
@guardian/core-web-vitals\:tsc: env
@corepack pnpm --filter @guardian/core-web-vitals tsc
.PHONY: @guardian/core-web-vitals\:verify-dist
@guardian/core-web-vitals\:verify-dist: env
@corepack pnpm --filter @guardian/core-web-vitals verify-dist
.PHONY: @guardian/eslint-config\:fix
@guardian/eslint-config\:fix: env
@corepack pnpm --filter @guardian/eslint-config fix
.PHONY: @guardian/eslint-config\:lint
@guardian/eslint-config\:lint: env
@corepack pnpm --filter @guardian/eslint-config lint
.PHONY: @guardian/identity-auth\:build
@guardian/identity-auth\:build: env
@corepack pnpm --filter @guardian/identity-auth build
.PHONY: @guardian/identity-auth\:dev
@guardian/identity-auth\:dev: env
@corepack pnpm --filter @guardian/identity-auth dev
.PHONY: @guardian/identity-auth\:fix
@guardian/identity-auth\:fix: env
@corepack pnpm --filter @guardian/identity-auth fix
.PHONY: @guardian/identity-auth\:lint
@guardian/identity-auth\:lint: env
@corepack pnpm --filter @guardian/identity-auth lint
.PHONY: @guardian/identity-auth\:test
@guardian/identity-auth\:test: env
@corepack pnpm --filter @guardian/identity-auth test
.PHONY: @guardian/identity-auth\:tsc
@guardian/identity-auth\:tsc: env
@corepack pnpm --filter @guardian/identity-auth tsc
.PHONY: @guardian/identity-auth\:verify-dist
@guardian/identity-auth\:verify-dist: env
@corepack pnpm --filter @guardian/identity-auth verify-dist
.PHONY: @guardian/identity-auth-frontend\:build
@guardian/identity-auth-frontend\:build: env
@corepack pnpm --filter @guardian/identity-auth-frontend build
.PHONY: @guardian/identity-auth-frontend\:dev
@guardian/identity-auth-frontend\:dev: env
@corepack pnpm --filter @guardian/identity-auth-frontend dev
.PHONY: @guardian/identity-auth-frontend\:fix
@guardian/identity-auth-frontend\:fix: env
@corepack pnpm --filter @guardian/identity-auth-frontend fix
.PHONY: @guardian/identity-auth-frontend\:lint
@guardian/identity-auth-frontend\:lint: env
@corepack pnpm --filter @guardian/identity-auth-frontend lint
.PHONY: @guardian/identity-auth-frontend\:test
@guardian/identity-auth-frontend\:test: env
@corepack pnpm --filter @guardian/identity-auth-frontend test
.PHONY: @guardian/identity-auth-frontend\:tsc
@guardian/identity-auth-frontend\:tsc: env
@corepack pnpm --filter @guardian/identity-auth-frontend tsc
.PHONY: @guardian/identity-auth-frontend\:verify-dist
@guardian/identity-auth-frontend\:verify-dist: env
@corepack pnpm --filter @guardian/identity-auth-frontend verify-dist
.PHONY: @guardian/libs\:build
@guardian/libs\:build: env
@corepack pnpm --filter @guardian/libs build
.PHONY: @guardian/libs\:dev
@guardian/libs\:dev: env
@corepack pnpm --filter @guardian/libs dev
.PHONY: @guardian/libs\:e2e
@guardian/libs\:e2e: env
@corepack pnpm --filter @guardian/libs e2e
.PHONY: @guardian/libs\:e2e\:ui
@guardian/libs\:e2e\:ui: env
@corepack pnpm --filter @guardian/libs e2e:ui
.PHONY: @guardian/libs\:fix
@guardian/libs\:fix: env
@corepack pnpm --filter @guardian/libs fix
.PHONY: @guardian/libs\:lint
@guardian/libs\:lint: env
@corepack pnpm --filter @guardian/libs lint
.PHONY: @guardian/libs\:sourcepoint-integration-test
@guardian/libs\:sourcepoint-integration-test: env
@corepack pnpm --filter @guardian/libs sourcepoint-integration-test
.PHONY: @guardian/libs\:test
@guardian/libs\:test: env
@corepack pnpm --filter @guardian/libs test
.PHONY: @guardian/libs\:tsc
@guardian/libs\:tsc: env
@corepack pnpm --filter @guardian/libs tsc
.PHONY: @guardian/libs\:verify-dist
@guardian/libs\:verify-dist: env
@corepack pnpm --filter @guardian/libs verify-dist
.PHONY: @guardian/newsletter-types\:build
@guardian/newsletter-types\:build: env
@corepack pnpm --filter @guardian/newsletter-types build
.PHONY: @guardian/newsletter-types\:dev
@guardian/newsletter-types\:dev: env
@corepack pnpm --filter @guardian/newsletter-types dev
.PHONY: @guardian/newsletter-types\:fix
@guardian/newsletter-types\:fix: env
@corepack pnpm --filter @guardian/newsletter-types fix
.PHONY: @guardian/newsletter-types\:lint
@guardian/newsletter-types\:lint: env
@corepack pnpm --filter @guardian/newsletter-types lint
.PHONY: @guardian/newsletter-types\:tsc
@guardian/newsletter-types\:tsc: env
@corepack pnpm --filter @guardian/newsletter-types tsc
.PHONY: @guardian/prettier\:fix
@guardian/prettier\:fix: env
@corepack pnpm --filter @guardian/prettier fix
.PHONY: @guardian/prettier\:lint
@guardian/prettier\:lint: env
@corepack pnpm --filter @guardian/prettier lint
.PHONY: @guardian/prettier\:tsc
@guardian/prettier\:tsc: env
@corepack pnpm --filter @guardian/prettier tsc
.PHONY: @guardian/react-crossword\:build
@guardian/react-crossword\:build: env
@corepack pnpm --filter @guardian/react-crossword build
.PHONY: @guardian/react-crossword\:build-storybook
@guardian/react-crossword\:build-storybook: env
@corepack pnpm --filter @guardian/react-crossword build-storybook
.PHONY: @guardian/react-crossword\:dev
@guardian/react-crossword\:dev: env
@corepack pnpm --filter @guardian/react-crossword dev
.PHONY: @guardian/react-crossword\:fix
@guardian/react-crossword\:fix: env
@corepack pnpm --filter @guardian/react-crossword fix
.PHONY: @guardian/react-crossword\:lint
@guardian/react-crossword\:lint: env
@corepack pnpm --filter @guardian/react-crossword lint
.PHONY: @guardian/react-crossword\:storybook
@guardian/react-crossword\:storybook: env
@corepack pnpm --filter @guardian/react-crossword storybook
.PHONY: @guardian/react-crossword\:test
@guardian/react-crossword\:test: env
@corepack pnpm --filter @guardian/react-crossword test
.PHONY: @guardian/react-crossword\:tsc
@guardian/react-crossword\:tsc: env
@corepack pnpm --filter @guardian/react-crossword tsc
.PHONY: @guardian/react-crossword\:verify-dist
@guardian/react-crossword\:verify-dist: env
@corepack pnpm --filter @guardian/react-crossword verify-dist
.PHONY: @guardian/source\:build
@guardian/source\:build: env
@corepack pnpm --filter @guardian/source build
.PHONY: @guardian/source\:build-generated
@guardian/source\:build-generated: env
@corepack pnpm --filter @guardian/source build-generated
.PHONY: @guardian/source\:build-storybook
@guardian/source\:build-storybook: env
@corepack pnpm --filter @guardian/source build-storybook
.PHONY: @guardian/source\:create-icons
@guardian/source\:create-icons: env
@corepack pnpm --filter @guardian/source create-icons
.PHONY: @guardian/source\:dev
@guardian/source\:dev: env
@corepack pnpm --filter @guardian/source dev
.PHONY: @guardian/source\:fix
@guardian/source\:fix: env
@corepack pnpm --filter @guardian/source fix
.PHONY: @guardian/source\:lint
@guardian/source\:lint: env
@corepack pnpm --filter @guardian/source lint
.PHONY: @guardian/source\:storybook
@guardian/source\:storybook: env
@corepack pnpm --filter @guardian/source storybook
.PHONY: @guardian/source\:test
@guardian/source\:test: env
@corepack pnpm --filter @guardian/source test
.PHONY: @guardian/source\:tsc
@guardian/source\:tsc: env
@corepack pnpm --filter @guardian/source tsc
.PHONY: @guardian/source\:verify-dist
@guardian/source\:verify-dist: env
@corepack pnpm --filter @guardian/source verify-dist
.PHONY: @guardian/source-development-kitchen\:build
@guardian/source-development-kitchen\:build: env
@corepack pnpm --filter @guardian/source-development-kitchen build
.PHONY: @guardian/source-development-kitchen\:build-storybook
@guardian/source-development-kitchen\:build-storybook: env
@corepack pnpm --filter @guardian/source-development-kitchen build-storybook
.PHONY: @guardian/source-development-kitchen\:dev
@guardian/source-development-kitchen\:dev: env
@corepack pnpm --filter @guardian/source-development-kitchen dev
.PHONY: @guardian/source-development-kitchen\:fix
@guardian/source-development-kitchen\:fix: env
@corepack pnpm --filter @guardian/source-development-kitchen fix
.PHONY: @guardian/source-development-kitchen\:lint
@guardian/source-development-kitchen\:lint: env
@corepack pnpm --filter @guardian/source-development-kitchen lint
.PHONY: @guardian/source-development-kitchen\:storybook
@guardian/source-development-kitchen\:storybook: env
@corepack pnpm --filter @guardian/source-development-kitchen storybook
.PHONY: @guardian/source-development-kitchen\:test
@guardian/source-development-kitchen\:test: env
@corepack pnpm --filter @guardian/source-development-kitchen test
.PHONY: @guardian/source-development-kitchen\:tsc
@guardian/source-development-kitchen\:tsc: env
@corepack pnpm --filter @guardian/source-development-kitchen tsc
.PHONY: @guardian/source-development-kitchen\:verify-dist
@guardian/source-development-kitchen\:verify-dist: env
@corepack pnpm --filter @guardian/source-development-kitchen verify-dist
.PHONY: github-pages\:build
github-pages\:build: env
@corepack pnpm --filter github-pages build
.PHONY: github-pages\:dev
github-pages\:dev: env
@corepack pnpm --filter github-pages dev
.PHONY: github-pages\:start
github-pages\:start: env
@corepack pnpm --filter github-pages start
.PHONY: github-pages\:tsc
github-pages\:tsc: env
@corepack pnpm --filter github-pages tsc
.PHONY: storybooks\:dev
storybooks\:dev: env
@corepack pnpm --filter storybooks dev
############################### END PROJECT_TASKS ##############################