Slide 1

Slide 1 text

Rainer Hahnekamp 5. März 2025 Basta Qualität mit Angular Werkzeuge und Prozesse

Slide 2

Slide 2 text

About Me... https://www.youtube.com/ @RainerHahnekamp https://www.ng-news.com https://github.com/softarc-consulting/sheriff ● Rainer Hahnekamp ANGULARarchitects.io NgRx Team (Trusted Collaborator) ● Developer / Trainer / Speaker @RainerHahnekamp Workshops NgRx • Testing • Spring • Quality

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

RainerHahnekamp Why tooling when I use the Angular CLI?

Slide 5

Slide 5 text

RainerHahnekamp What about Nx?

Slide 6

Slide 6 text

RainerHahnekamp Code Guidelines ● ESLint ○ Angular-ESLint ○ Unused Imports ● Prettier ● Husky

Slide 7

Slide 7 text

RainerHahnekamp ESLint ● Stay with pre-defined configs ● Switch to flat config ● Angular-ESLint ○ Ensure that templates and TypeScript are parseable ● Enable automatic fix in IDE ● Easy to write your own Rules ● Check libs for accompanying rules ○ RxJS ○ NgRx ○ Cypress ○ Playwright ○ Storybook ● Run as Git Hook

Slide 8

Slide 8 text

RainerHahnekamp MVP: Define Plugin export default { plugins: { custom: { rules: { 'capitalized-classes': { create(context) { return { ClassDeclaration(node) { context.report({node, message: "This is a class"}) } }; } } } } } }

Slide 9

Slide 9 text

RainerHahnekamp MVP: Activate Plugin export default { plugins: { custom: { rules: { 'capitalized-classes': { create(context) { return { ClassDeclaration(node) { if (node.id.name.match(/^[a-z]/)) { context.report({node, message: "This is a class"}) } } // ...

Slide 10

Slide 10 text

RainerHahnekamp https://typescript-eslint.io/play

Slide 11

Slide 11 text

RainerHahnekamp Prettier ● Understands Angular templates ● No internal discussions "use as is" ● Don't use ESLint Plugin ● Use IDE Integration

Slide 12

Slide 12 text

RainerHahnekamp Husky ● Automatic Git Hooks ● Common Use Cases ○ ESLint ○ Prettier ○ Tests ○ Commit Messages ● Combine with lint-staged ● Careful with long-running Hooks

Slide 13

Slide 13 text

RainerHahnekamp Quality ● SonarQube ● Detective ● Sheriff

Slide 14

Slide 14 text

RainerHahnekamp SonarQube ● CI-embeddable ● "Quality Gates" ● Improvements incrementally ○ "New Code" approach ● Code Coverage requires manual config ● Support for common CI ● ESLint plugin

Slide 15

Slide 15 text

RainerHahnekamp Detective ● Analysis Tool ● Based on Forensics ● Finds Files which are always changed together ● Indicators for ○ Poor Modules ○ High Coupling

Slide 16

Slide 16 text

RainerHahnekamp Sheriff ● Module Encapsulation ● Dependency Rules ● ESLint & CLI Mode ● Framework Agnostic

Slide 17

Slide 17 text

RainerHahnekamp Miscellaneous ● Sentry ● Renovate Bot ● Playwright

Slide 18

Slide 18 text

RainerHahnekamp Sentry ● Collects Errors ○ Groups them into Categories ○ Prioritization ● Supports Sourcemaps ● Integration to Ticket System ● Tracing ● Support for further Metrics

Slide 19

Slide 19 text

RainerHahnekamp Release Management ● Documentation ○ Storybook ○ Docusaurus ○ TypeScript ● Conventional Commits ● Nx Release

Slide 20

Slide 20 text

RainerHahnekamp Storybook ● Started as Widget Gallery ● Interactive Documentation ● Supports Testing ○ Visual Regression ○ A11y Testing ○ other types… ● Standard Tool

Slide 21

Slide 21 text

RainerHahnekamp Commitlint ● Standardized Commit Message ● Contains information about impact of change (none, fix, feat, breaking) ● Optional Scope ● Format: ○ [type](scope?): message description

Slide 22

Slide 22 text

RainerHahnekamp Commitlint Versioning Rules ● Major Change ○ Every type with an ! ○ Description starting with BREAKING CHANGE ● Minor Change ○ Type feat ● Fix ○ Type fix ● None ○ build, chore, ci, docs, perf, refactor, style, test

Slide 23

Slide 23 text

RainerHahnekamp Nx Release ● Automatization ○ Version ○ ChangeLog ○ Publish ● Version Features ○ Automatic Versioning with Commitlint ○ Manual Versioning ● Release Groups ○ Release multiple packages together

Slide 24

Slide 24 text

RainerHahnekamp Initial Steps: Pre-Built Check { "release": { "version": { "preVersionCommand": "npx nx run-many -t build" } } }

Slide 25

Slide 25 text

RainerHahnekamp Initial Steps: Automatic Version Numbers { "release": { "version": { "preVersionCommand": "npx nx run-many -t build", "conventionalCommits": true } } }

Slide 26

Slide 26 text

RainerHahnekamp Important Release commands ● npx nx release --first-release ● # define version npx nx release 1.0.0 ● # increase only version and create ChangeLog npx nx release -–skip-publish ● npx nx release version ● npx nx release changelog ● npx nx release publish