kekel87 / angular-seed

๐Ÿ…ฐ๏ธ Angular seed app with all my default setup, linter, tests, theming

Home Page:https://kekel87.github.io/angular-seed/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular seed angular

angular typescript rxjs ngrx jest cypress eslint prettier github-actions

Here is my project for new angular project, with selection and configuration of tools to ensure a good quality of code, like linter, formatter, unit tests or e2e tests.

Indeed @angular/cli doesn't impose linter or e2e test anymore.

And doesn't seem to want to use var jest for unit testing. ๐Ÿคท

I include @angular/material with theming by CSS variables and ngrx, because I use them in most of my projects.

Commands

Development server

npm start

Linter and Formatter

npm run format
npm run lint

You can run only specific lint/formatter if you want:

# For TS and HTML template (AKA ng lint)
npm run format:ng
npm run lint:ng

# For SCSS, JS and JSON
npm run lint:prettier
npm run format:prettier

# For SCSS
npm run format:stylelint
npm run lint:stylelint

Tests

npm run test
npm run e2e -- -c headless

Build

npm run build

Stack and Changes

  • ๐Ÿ…ฐ๏ธ Core:
    • @angular
    • @angular/cli
      • root scss move to dedicated folder src/scss (stylePreprocessorOptions)
      • remove .vscode folder because it has to remain IDE agnostic
      • basics TS alias
    • @angular/material
      • theming with CSS variables
      • dedicated variables file
      • NO global MaterialModule which import all the lib (tree-shaking ...) !
      • light/dark theme auto switch with prefers-color-scheme (no class)
    • ngrx
  • ๐Ÿ‘ฎ Linter/Formatter
  • โœ” Unit Test
    • jest with @briebug/jest-schematic
      • all config put in src/tests folder
      • prepare src/tests/mocks to put tests mocks
      • setup coverage threshold to 100 because I am a crazy person
      • jest-createspyobj for missing typed createspyobj Need to find better typing
      • jest-marbles for rxjs testing
      • jasmine-marble for rxjs testing (do not trust the name, is not related to jasmine (no dependence))
      • ng-mocks for greatly simplify component testing
  • ๐Ÿต E2E Test
    • cypress
    • disable video and screenshotOnRunFailure
    • I keep only the npm run e2e command (with configs)

Basic GH Actions

CI/CD must guarantee the quality of the code without being burdensome for the developers (so it must be fast).

And it must deploy (here, in GH Pages) the application automatically.

Job Description
๐Ÿšง Install Installation of dependencies and creation/update of cache.
๐Ÿ‘ฎ Lint Syntax verification of the code
โœ” Unit tests Units tests
๐Ÿต E2E tests E2E tests
๐Ÿ› ๏ธ Build Build Angular application in prod config
๐Ÿš€ Deploy Deployment on Github Pages

About

๐Ÿ…ฐ๏ธ Angular seed app with all my default setup, linter, tests, theming

https://kekel87.github.io/angular-seed/


Languages

Language:HTML 39.4%Language:TypeScript 33.5%Language:SCSS 27.1%