chore(config): add husky to the project
Added a pre-commit hook with husky to the project that runs all linters before the commit.
The hooks automatically get installed via the prepare script during `npm install`.
ADD
.husky/pre-commit
+#!/usr/bin/env sh
+#
+# Copyright 2022 Scheer PAS Schweiz AG
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# imitations under the License.
+#
+
+. "$(dirname -- "$0")/_/husky.sh"
+
+# run linter before commit because lint-fix does not append the changes to the current commit
+npm run lint

MODIFY
README.md
README.md
* Create a copy of the `src/assets/config.json5` called `src/assets/local-config.json5`
* Adapt the `endpoint` and `auth.url` to match you apiman and keycloak setup
-* Execute `npm ci && npm run start` or use our provided run configuration (Jetbrains IntelliJ/WebStorm)
+* Execute `npm install && npm run start` or use our provided run configuration (Jetbrains IntelliJ/WebStorm)
#### Linux / Windows
```bash
cp src/assets/config.json5 src/assets/local-config.json5
-npm ci
+npm install
npm run start
```

MODIFY
package-lock.json
package-lock.json
"eslint": "8.20.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
+ "husky": "8.0.1",
"jasmine-core": "4.2.0",
"karma": "6.4.0",
"karma-chrome-launcher": "3.1.1",
"ms": "^2.0.0"
}
},
+ "node_modules/husky": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
+ "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
+ "dev": true,
+ "bin": {
+ "husky": "lib/bin.js"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/typicode"
+ }
+ },
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"ms": "^2.0.0"
}
},
+ "husky": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
+ "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
+ "dev": true
+ },
"iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",

MODIFY
package.json
package.json
"lint-fix": "ng lint --fix && stylelint --fix '**/*.scss'",
"build-production": "ng build --configuration production",
"cy:open": "cypress open",
- "cy:run": "cypress run"
+ "cy:run": "cypress run",
+ "prepare": "husky install"
},
"private": true,
"dependencies": {
"eslint": "8.20.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.2.1",
+ "husky": "8.0.1",
"jasmine-core": "4.2.0",
"karma": "6.4.0",
"karma-chrome-launcher": "3.1.1",

chore(config): add husky to the project

Added a pre-commit hook with husky to the project that runs all linters before the commit.
The hooks automatically get installed via the prepare script during `npm install`.