Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

yarn prepush
43 changes: 43 additions & 0 deletions bin/prepush.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

yarn lint
lint_status=$?

if [ "$lint_status" -ne 0 ]; then
printf "=============================================================\n" >&2
printf "The following command failed: yarn lint\n" >&2
printf "run yarn lint command to find the lint errors and fix them, then push again.\n" >&2
printf "=============================================================\n" >&2
exit "$lint_status"
fi

yarn test:audit
audit_status=$?

yarn npm audit --recursive --environment production --json > yarn-audit-known-issues
cve_suppress_status=$?

if [ "$cve_suppress_status" -ne 0 ] && [ ! -s yarn-audit-known-issues ]; then
printf "=============================================================\n" >&2
printf "Unable to refresh yarn-audit-known-issues\n" >&2
printf "=============================================================\n" >&2
exit "$cve_suppress_status"
fi

if ! git diff --quiet -- yarn-audit-known-issues; then
printf "=============================================================\n" >&2
printf "yarn-audit-known-issues was refreshed with the latest CVE audit output.\n" >&2
printf "Commit yarn-audit-known-issues and push again.\n" >&2
printf "=============================================================\n" >&2
exit 1
fi

if [ "$audit_status" -ne 0 ]; then
printf "=============================================================\n" >&2
printf "The following command failed: test:audit\n" >&2
printf "\n" >&2
printf "There are unsuppressed vulnerabilities, update yarn-audit-known-issues and commit it.\n" >&2
printf "\n" >&2
printf "=============================================================\n" >&2
exit 1
fi
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"test": "ng test ccd-case-ui-toolkit-lib --code-coverage",
"test:watch": "ng test ccd-case-ui-toolkit-lib --code-coverage --watch=true",
"test:audit": "./bin/run-yarn-audit.sh -f yarn-audit-known-issues",
"prepush": "bash ./bin/prepush.sh",
"tslint": "tslint",
"docs:json": "compodoc -p ./tsconfig.json -e json -d .",
"storybook": "yarn docs:json && start-storybook -p 6006",
Expand Down Expand Up @@ -132,6 +133,7 @@
"gulp": "^4.0.2",
"gulp-inline-ng2-template": "^5.0.1",
"gulp-sass": "^5.1.0",
"husky": "^9.1.7",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "~5.1.0",
"jasmine-spec-reporter": "~7.0.0",
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3456,6 +3456,7 @@ __metadata:
gulp: "npm:^4.0.2"
gulp-inline-ng2-template: "npm:^5.0.1"
gulp-sass: "npm:^5.1.0"
husky: "npm:^9.1.7"
istanbul-instrumenter-loader: "npm:^3.0.1"
jasmine-core: "npm:~5.1.0"
jasmine-spec-reporter: "npm:~7.0.0"
Expand Down Expand Up @@ -17022,6 +17023,15 @@ __metadata:
languageName: node
linkType: hard

"husky@npm:^9.1.7":
version: 9.1.7
resolution: "husky@npm:9.1.7"
bin:
husky: bin.js
checksum: 10/c2412753f15695db369634ba70f50f5c0b7e5cb13b673d0826c411ec1bd9ddef08c1dad89ea154f57da2521d2605bd64308af748749b27d08c5f563bcd89975f
languageName: node
linkType: hard

"hyperdyperid@npm:^1.2.0":
version: 1.2.0
resolution: "hyperdyperid@npm:1.2.0"
Expand Down
Loading