diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 00000000..75d9e832 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,21 @@ +#!/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 diff --git a/README.md b/README.md index cea5706d..c6787eca 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ * 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 ``` diff --git a/package-lock.json b/package-lock.json index 9c93cdc3..3cc7c4a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,6 +57,7 @@ "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", @@ -9434,6 +9435,21 @@ "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", @@ -24023,6 +24039,12 @@ "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", diff --git a/package.json b/package.json index b6fa61aa..70ea5dac 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "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": { @@ -64,6 +65,7 @@ "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",