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

Commit 5e55891

Browse files
committed
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`.
1 parent e66804a commit 5e55891

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

.husky/pre-commit

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env sh
2+
#
3+
# Copyright 2022 Scheer PAS Schweiz AG
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# imitations under the License.
16+
#
17+
18+
. "$(dirname -- "$0")/_/husky.sh"
19+
20+
# run linter before commit because lint-fix does not append the changes to the current commit
21+
npm run lint

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
* Create a copy of the `src/assets/config.json5` called `src/assets/local-config.json5`
1616
* Adapt the `endpoint` and `auth.url` to match you apiman and keycloak setup
17-
* Execute `npm ci && npm run start` or use our provided run configuration (Jetbrains IntelliJ/WebStorm)
17+
* Execute `npm install && npm run start` or use our provided run configuration (Jetbrains IntelliJ/WebStorm)
1818

1919
#### Linux / Windows
2020
```bash
2121
cp src/assets/config.json5 src/assets/local-config.json5
22-
npm ci
22+
npm install
2323
npm run start
2424
```
2525

package-lock.json

Lines changed: 22 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"lint-fix": "ng lint --fix && stylelint --fix '**/*.scss'",
1212
"build-production": "ng build --configuration production",
1313
"cy:open": "cypress open",
14-
"cy:run": "cypress run"
14+
"cy:run": "cypress run",
15+
"prepare": "husky install"
1516
},
1617
"private": true,
1718
"dependencies": {
@@ -64,6 +65,7 @@
6465
"eslint": "8.20.0",
6566
"eslint-config-prettier": "8.5.0",
6667
"eslint-plugin-prettier": "4.2.1",
68+
"husky": "8.0.1",
6769
"jasmine-core": "4.2.0",
6870
"karma": "6.4.0",
6971
"karma-chrome-launcher": "3.1.1",

0 commit comments

Comments
 (0)