Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Commit

Permalink
chore(config): add husky to the project
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
volkflo committed Aug 25, 2022
1 parent e66804a commit 5e55891
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 5e55891

Please sign in to comment.