-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbaldrick-broth.yaml
670 lines (658 loc) · 27.7 KB
/
baldrick-broth.yaml
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
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
model:
project:
title: The easiest way to encrypt your data with TypeScript on the server side
description: Foolproof encryption functions curated for business cases
version: 0.1.0
keywords:
- encryption
- hashing
- authentication
- secret
- JWT
- HS256
readme:
highlights:
- Simplify your encryption needs with a user-friendly library
- Choose the best encryption method for your scenario, such as signing ID, verifying data, or securing messages
- Avoid common encryption pitfalls with sensible defaults and best practices
- Leverage the power and security of JOSE JWT standards
links:
- "[Npm dependencies](DEPENDENCIES.md)"
- "[Usage](USAGE.md)"
tags:
- image-hero
cheatsheet:
- title: Sign a payload with just an identifier and get back a full token
example: "const signResult = await signLunarCrypt.signId('product', { id: 'product123'});"
- title: Verify a full token and get back a payload
example: "const verifyResult = await lunarCrypt.verifyId(fullToken);"
github:
account: flarebyte
name: lunar-obsidian-crypt
copyright:
holder: Flarebyte.com
startYear: 2023
license: MIT
author:
name: Olivier Huin
url: https://github.com/olih
implementation:
tags:
- lib
workflow-version: 0.3.0
workflows:
test:
title: Test the library
description: Test the library for defects
tasks:
jest:
title: Run the unit tests with Jest
description: Use the Jest framework to run unit test (deprecated)
links:
- title: Jest is a JavaScript Testing Framework
url: https://jestjs.io/
main:
commands:
- title: Test all test files in test folder
run: npx baldrick-dev-ts test check
spec:
title: Run unit tests declaratively
description: Run unit tests for pure functions declaratively using YAML files
motivation: Check that the units of code behave as intended
links:
- title: Baldrick Zest run tests declaratively
url: https://github.com/flarebyte/baldrick-zest-engine
main:
commands:
- title: Run all baldrick zest files
run: node --loader ts-node/esm .baldrick-zest.ts
unit:
title: Run node.js unit tests
description: Run traditional unit tests
motivation: Test what is not easily covered with zest
links:
- title: JavaScript tests that report results in TAP format
url: https://nodejs.org/dist/latest-v18.x/docs/api/test.html
main:
commands:
- title: Run unit tests
run: yarn test
pest:
title: Run acceptance tests for the CLI
description: Run acceptance tests declaratively using YAML files
motivation: Check that the CLI application behaves as intended
links:
- title: Testing with baldrick-pest
url: https://github.com/flarebyte/baldrick-pest
before:
commands:
- title: List pest files
name: pest-files-string
run: find . -type f -name *.pest.yaml
onSuccess:
- save
- silent
- a: split-lines
name: pest-files
title: Split the list of pest files
value: data.pest-files-string
main:
each:
- name: pest-file
values: data.pest-files
commands:
- title: Run regression on file
name: Run regression on {{_.pest-file}}
run: npx baldrick-pest@latest test --spec-file {{_.pest-file}}
pest1:
title: Run one acceptance tests for the CLI
description: Run one acceptance tests declaratively using YAML files
motivation: Check that the CLI application behaves as intended
links:
- title: Testing with baldrick-pest
url: https://github.com/flarebyte/baldrick-pest
main:
commands:
- title: List pest files
name: pest-files-string
run: find . -type f -name *.pest.yaml
onSuccess:
- save
- silent
- a: split-lines
name: pest-files
title: Split the list of pest files
value: data.pest-files-string
- a: prompt-select
title: Prompt for pest filename
message: Select pest file
name: pest-file
select: data.pest-files
- title: Run pest file
name: run
run: npx baldrick-pest@latest test --spec-file {{_.pest-file}}
scc:
title: Count lines of code
description: Count lines of code
motivation: Count lines of code
links:
- title: Counting lines of code in many programming languages
url: https://github.com/boyter/scc
before:
commands:
- name: pest-files
title: List pest yaml files
run: scc pest-spec --include-ext yaml --by-file --format csv
onSuccess:
- save
- csv
- silent
main:
each:
- name: pest-file
values: data.test::pest::pest-files
commands:
- title: Display info
name: Display info {{pest-file.Location}}
run: echo {{pest-file.Location}}
cli:
title: Run client directly
description: Run the client with ts-node during development
motivation:
Simulate a CLI app in development without the need to install it
globally
main:
commands:
- title: Run the CLI locally
run: node --loader ts-node/esm src/cli.mts
transpile:
title: Transpile the source code
description: Transpile source code
tasks:
ts:
title: Transpile typescript
description: Generate javascript from the typescript source code
motivation: Javascript code is more portable and can be consumed by other projects
links:
- title: tsc compiles typescript defined by a tsconfig.json
url: https://www.typescriptlang.org/docs/handbook/compiler-options.html
main:
commands:
- title: Delete dist folder
run: rm -rf dist
- title: Compile with typescript
run: tsc --outDir dist
deps:
title: Library dependencies
description: Npm dependencies
tasks:
upgrade:
title: Upgrade to latest dependencies
description: Upgrade to latest npm dependencies
motivation: Keep up with security and improvements
main:
commands:
- title: Upgrade to latest dependencies
run: yarn upgrade --latest
- title: Display advice about yarn upgrade-interactive
run: echo "❐ You could also use yarn upgrade-interactive --latest"
doc:
title: Generate the documentation
description: Generate the documentation automatically
tasks:
ts:
title: Generate documentation
description: Generate the markdown documentation for the typescript project
motivation: Good documentation is essential for developer experience
links:
- title: TypeDoc converts comments in Typescript into a JSON model
url: https://typedoc.org/
- title: baldrick-doc-ts produces markdown documentation
url: https://github.com/flarebyte/baldrick-doc-ts
- title: baldrick-doc-ts produces markdown documentation
url: https://github.com/flarebyte/baldrick-doc-ts
- title: Package development of Typescript library in ESM format
url: https://github.com/flarebyte/baldrick-dev-ts
main:
commands:
- name: report-folder
title: Ensure that we have a report folder
run: mkdir -p report
- name: typedoc
title: Generate typedoc doc.json
run: npx typedoc@latest --json report/doc.json --pretty src/index.mts
- name: api
title: Generate markdown files for the Api
run: npx baldrick-doc-ts@latest typedoc --json-source report/doc.json
- name: ngram
title: Generate some markdown files with ngram
run: npx baldrick-doc-ts@latest parse -f internal ngram
- name: functions-csv
title: Generate csv file with all the functions
run: npx baldrick-doc-ts@latest parse --feature functions-csv
- name: deps
title: Document the npm dependencies
run: npx zx https://raw.githubusercontent.com/flarebyte/baldrick-reserve/main/script/npm-dependencies.mjs
- name: fix
title: Fix all the markdown files
run: npx baldrick-dev-ts@latest markdown fix
- name: github
title: Fixes markdown in github folder
run: npx baldrick-dev-ts@latest markdown fix -s .github/
github:
title: Management of the github project
description: Generate the documentation based on the source code
tasks:
standard:
title: Standardize the github repository
description: Enable useful features for the github project repository
motivation: Create consistent settings
main:
commands:
- name: edit
title: Configure usual settings for github project
run: gh repo edit --delete-branch-on-merge --enable-squash-merge
lint:
title: Static code analysis
description: Find problems in the code base
tasks:
check:
title: Static code analysis of Typescript code
description: Find problems in Typescript code
motivation: Make the code more consistent and avoid bugs
main:
commands:
- name: check
title: Lint check sources
run: npx xo
fix:
title: Fix static code analysis
description: Fix problems in Typescript code
motivation: Facilitate routine maintenance of code
main:
commands:
- name: fix
title: Fix source code
run: npx xo --fix
md:
title: Markdown documentation
description: Manage markdown documentation
tasks:
check:
title: Check Markdown files
description: Checks that the markdown documents follows some consistent guidelines
motivation: Make the markdown documents consistent in style
main:
commands:
- name: check
title: Check markdown files
run: baldrick markdown check
- name: github
title: Check markdown files in github
run: npx baldrick-dev-ts@latest markdown check -s .github/
fix:
title: Fix Markdown files
description:
Modify the markdown documents to ensure they follow some consistent
guidelines
motivation: Make the markdown documents consistent in style
main:
commands:
- title: Fix markdown files
run: npx baldrick-dev-ts@latest markdown fix
- title: Fix markdown files in github
run: npx baldrick-dev-ts@latest markdown fix -s .github/
release:
title: Release of the library
tasks:
ready:
title: Ready for publishing
description:
Run a sequence of commands to check that the library is ready to be
published
motivation: Detect quality flaws before pushing the code
parameters:
- description: |
Pull request mode.
Run the pest and zest tests.
flags: -pr, --pull-request
main:
commands:
- name: remove-build
title: Remove previous build
run: rm -rf dist
- name: build
title: Build the project
run: yarn build
- name: release-check
title: Checks that the version has been incremented
run: npx baldrick-dev-ts@latest release check
- name: lint
title: Check linting
run: npx xo
- name: markdown
title: Check markdown files
run: npx baldrick-dev-ts@latest markdown check
- name: markdown-github
title: Check markdown files in github
run: npx baldrick-dev-ts@latest markdown check -s .github/
- name: outdated
title: Check whether some libraries are outdated
run: yarn outdated
- name: audit
title: Audit some libraries
run: yarn audit
- name: has-pest-files
title: Check if there are any pest files
run: find . -type f -name *.pest.yaml
onSuccess:
- save
- silent
- a: every-truthy
name: should-run-pest
title: Is this a PR and is there some pest files
values:
- data.has-pest-files
- runtime.parameters.pullRequest
- name: pest
title: Run the integration pest tests
if: data.should-run-pest
run: npx baldrick-broth@latest test pest
- name: has-zest-files
title: Check if there are any zest files
run: find . -type f -name *.zest.yaml
onSuccess:
- save
- silent
- a: every-truthy
name: should-run-zest
title: Is this a PR and is there some zest files
values:
- data.has-zest-files
- runtime.parameters.pullRequest
- name: zest
title: Run the unit zest tests
if: data.should-run-zest
run: npx npx baldrick-broth@latest test spec
- name: rm-report
title: Remove previous report
run: rm -f temp/pull_request_relevant.md
- name: report
a: template
title: Create a report
template: >
# Summary of the change
## Code check
{{#if _.result-of-build}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} Transpile to javascript
{{#if _.result-of-release-check}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} The version has been incremented to "v{{build.model.project.version}}"
{{#if _.result-of-lint}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} Static analysis and linting
{{#if _.result-of-markdown}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} Markdown formatting
{{#if _.result-of-outdated}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} No outdated NPM libraries
{{#if _.result-of-audit}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} Security audit
{{#if _.result-of-pest}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} Integration tests with baldrick-pest {{#unless _.should-run-pest}}(Not supported yet){{/unless}}
{{#if _.result-of-zest}}- :heavy_check_mark:{{else}}- :heavy_exclamation_mark:{{/if}} Unit tests with baldrick-zest {{#unless _.should-run-zest}}(Not supported yet){{/unless}}
- name: write-report
a: append-to-file
title: Write the report
value: data.report
filename: temp/pull_request_relevant.md
pr:
title: Pull request for the project
description: Create a pull request for the branch
motivation: Automate the body of pull request
main:
commands:
- a: prompt-choices
name: category
title: Category for the pull request
message: Classify the pull request
choices:
- feat
- fix
- chore
- docs
- style
- refactor
- a: prompt-input
name: title
title: Title for the pull request
description: A short title used for the pull request
message: Short title describing the pull request
- run:
gh pr create --title {{escapeSpace _.category}}:{{escapeSpace _.title}}
--body-file temp/pull_request_relevant.md
title: Create the pull request
publish:
title: Publish the current library
description: Publih the current library to npm
motivation: Detect quality flaws before pushing the code
main:
commands:
- name: checkout-main
title: Checkout main
run: git checkout main
- name: fetch-all
title: Fetch all
run: git fetch --all
- name: rebase-main
title: Rebase main
run: git rebase
- name: status
title: Git status
run: git status
- name: remove-build
title: Remove previous build
run: rm -rf dist
- name: build
title: Build the project
run: yarn build
- name: publish
title: Publish to NPM
run: npm publish
- name: release
title: Release the library to Github
run: gh release create "v{{build.model.project.version}}" --generate-notes
- name: refresh
title: Get the latest tag from Github
run: git fetch --all
scaffold:
title: Scaffolding for the project
tasks:
upgrade:
title: Upgrade baldrick-broth configuration to latest version
description: Gets the latest version of this configuration file
motivation: Always apply the latest project conventions
main:
commands:
- title: Remove previous temporary directory
run: rm -rf temp/broth
- title: Create temporary directory
run: mkdir -p temp/broth
- a: mask-object
name: broth-model
title: Extract model from this baldrick-broth.yaml
value: build
mask: model
- name: save-old-model
a: write-to-file
title: Save baldrick-broth file with existing model
value: data.broth-model
filename: temp/broth/baldrick-broth-model.json
- title: merge model with new workflow
run: npx baldrick-whisker@latest object baldrick-broth.yaml
temp/broth/baldrick-broth-model.json
github:flarebyte:baldrick-reserve:data/ts/baldrick-broth.yaml
norm:
title: Normalize the project
description: Normalize the project in a similar fashion that the other
typescript projects
motivation: Make the project structure consistent and easier to navigate
main:
commands:
- title: Create all github repositories
run: mkdir -p .github/workflows .github/ISSUE_TEMPLATE
- title: Github - create bug report form
run:
npx baldrick-whisker@latest object .github/ISSUE_TEMPLATE/bug_report.yaml
github:flarebyte:baldrick-reserve:data/ts/bug-report.yaml
- title: Github - create feature request form
run: npx baldrick-whisker@latest object
.github/ISSUE_TEMPLATE/feature_request.yaml
github:flarebyte:baldrick-reserve:data/ts/feature-request.yaml
- title: Github - create main workflow
run: npx baldrick-whisker@latest object .github/workflows/main.yml
github:flarebyte:baldrick-reserve:data/ts/workflow-main.yml
- title: Github - create pull request configuration
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/pull-request-template.hbs
.github/pull_request_template.md
- title: Create all needed repositories
run: mkdir -p .vscode src test spec script script/data script/schema
- title: Install default vscode snippets
run: npx baldrick-whisker@latest object --no-ext
.vscode/baldrick.code-snippets.json
github:flarebyte:baldrick-reserve:data/ts/snippet.yaml
- title: Create .gitignore
links:
- title: Specify files to ignore in source control
url: https://git-scm.com/docs/gitignore
run:
npx baldrick-whisker@latest render --no-ext baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/gitignore.hbs
.gitignore.sh
- title: Create .editorconfig
run:
npx baldrick-whisker@latest render --no-ext baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/editorconfig.hbs
.editorconfig.sh
links:
- title: Maintain consistent coding styles for spaces
url: https://editorconfig.org/
- title: Create a starter .vscode/settings.json
run: npx baldrick-whisker@latest object .vscode/settings.json
github:flarebyte:baldrick-reserve:data/ts/vscode-settings.json
--no-overwrite
- title: Create tsconfig.json
run: npx baldrick-whisker@latest object tsconfig.json
github:flarebyte:baldrick-reserve:data/ts/tsconfig-2021.yaml
- title: Create .prettierrc.json
run: npx baldrick-whisker@latest object .prettierrc.json
github:flarebyte:baldrick-reserve:data/ts/prettierrc.json
- title: Create .remarkrc.yml
run: npx baldrick-whisker@latest object .remarkrc.yml
github:flarebyte:baldrick-reserve:data/ts/remarkrc.yml
- title: Create .xo-config.json
run: npx baldrick-whisker@latest object .xo-config.json
github:flarebyte:baldrick-reserve:data/ts/xo-config.yaml
links:
- title: TypeScript linter with great defaults
url: https://github.com/xojs/xo
- title: Create CONTRIBUTING.md with contribution guidelines
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/contributing.hbs
CONTRIBUTING.md
- title: Create CODE_OF_CONDUCT.md with code of conduct guidelines
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/code-of-conduct.hbs
CODE_OF_CONDUCT.md
- title: Create GLOSSARY.md with project vocabulary
run: npx baldrick-whisker@latest render
github:flarebyte:baldrick-reserve:data/glossary.yaml
github:flarebyte:baldrick-reserve:template/glossary.hbs
GLOSSARY.md
- title: Create a starter DECISIONS.md
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/decisions.hbs
DECISIONS.md --no-overwrite
- title: Create README.md
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/readme.hbs
README.md
- title: Create TECHNICAL_DESIGN.md
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/technical-design.hbs
TECHNICAL_DESIGN.md
- title: Create MAINTENANCE.md
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/maintenance.hbs
MAINTENANCE.md
- title: Create LICENSE
run:
npx baldrick-whisker@latest render --no-ext baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/license.hbs
LICENSE.md
- title: Fix markdown
run: npx baldrick-broth@latest md fix
- name: package-json
title: Backup dependencies
run: cat package.json
onSuccess:
- save
- silent
- json
- a: mask-object
title: Extracts dependencies from package.json
name: package-json-deps
value: data.package-json
mask: dependencies,devDependencies,peerDependencies
- name: save-package-json-deps
title: Save package.json with only dependencies
stdin: data.package-json-deps
run: sponge temp/broth/package-deps.json
- title: Create package.json metadata from broth model
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/package.hbs
temp/broth/package-specific.json
- title: merge dependencies with broth model info
run: npx baldrick-whisker@latest object package.json
temp/broth/package-specific.json temp/broth/package-deps.json
norm-package:
title: Normalize the project
description: Normalize the project in a similar fashion that the other
typescript projects
motivation: Make the project structure consistent and easier to navigate
main:
commands:
- name: package-json
title: Backup dependencies
run: cat package.json
onSuccess:
- save
- silent
- json
- a: mask-object
title: Extracts dependencies from package.json
name: package-json-deps
value: data.package-json
mask: dependencies,devDependencies,peerDependencies
- a: write-to-file
title: Save package.json with only dependencies
name: save-package-json-deps
value: data.package-json-deps
filename: temp/broth/package-deps.json
- title: Create package.json metadata from broth model
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/package.hbs
temp/broth/package-specific.json
- title: merge dependencies with broth model info
run: npx baldrick-whisker@latest object package.json
temp/broth/package-specific.json temp/broth/package-deps.json
custom:
title: Normalize using the custom script
description: Normalize the project using a custom script for this project
motivation:
Enable an imperative approach for some of normalisation to keep the
model simple
main:
commands:
- title: Normalize using the custom script
run: sh custom-scaffolding.sh
readme:
title: Update readme
description: Updates readme
main:
commands:
- title: Create README.md
run: npx baldrick-whisker@latest render baldrick-broth.yaml
github:flarebyte:baldrick-reserve:template/ts/readme.hbs
README.md