@ministryofjustice/hmpps-precommit-hooks 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -1
- package/README.md +4 -0
- package/bin/prepare.sh +5 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Change log
|
|
2
2
|
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
Fix issue with alpine not having bash installed.
|
|
6
|
+
Also providing ability to disable running script inside docker
|
|
7
|
+
|
|
3
8
|
## 0.0.1
|
|
4
9
|
|
|
5
10
|
Initial release
|
|
6
11
|
|
|
7
|
-
|
|
8
12
|
## 0.0.1-alpha.1
|
|
9
13
|
|
|
10
14
|
Pre-releases which should not be used in projects.
|
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ The prepare script will trigger on any install and ensure that `gitleaks` is ins
|
|
|
45
45
|
|
|
46
46
|
Note: `gitleaks` is installed by `brew`, if `brew` is not available then `prepare` will currently fail loudly and display a message.
|
|
47
47
|
|
|
48
|
+
### Prevent precommit script initialising on prepare
|
|
49
|
+
|
|
50
|
+
To disable the tool running on `npm install` and initialising husky and installing gitleaks, you can pass the `SKIP_PRECOMMIT_INIT=true` env var.
|
|
51
|
+
|
|
48
52
|
### Dealing with false positives
|
|
49
53
|
|
|
50
54
|
When a secret is detected, gitleaks will create a fingerprint. If the secret is a false positive then this can be added to the `./gitleaks/.gitleaksignore` to exclude from future scans.
|
package/bin/prepare.sh
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/bin/
|
|
1
|
+
#!/bin/sh
|
|
2
2
|
#
|
|
3
3
|
# This runs as part of any `npm install` via `prepare`
|
|
4
4
|
#
|
|
@@ -17,8 +17,8 @@ printError() {
|
|
|
17
17
|
printf "\x1b[1;31m%s\x1b[0m\n" "$1"
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
if [ "$CI" = "true" ]; then
|
|
21
|
-
endStage "Not initialising precommit hooks
|
|
20
|
+
if [ "$CI" = "true" ] || [ "$SKIP_PRECOMMIT_INIT" = "true" ]; then
|
|
21
|
+
endStage "Not initialising precommit hooks..."
|
|
22
22
|
exit 0
|
|
23
23
|
fi
|
|
24
24
|
|
|
@@ -26,15 +26,14 @@ fi
|
|
|
26
26
|
node_modules/.bin/husky
|
|
27
27
|
|
|
28
28
|
# Check brew exists
|
|
29
|
-
if ! command -v brew
|
|
29
|
+
if ! command -v brew > /dev/null 2> /dev/null; then
|
|
30
30
|
printError "Brew is not installed. You will need to install gitleaks separately and ensure it's on your PATH. exiting..."
|
|
31
31
|
exit 0
|
|
32
32
|
fi
|
|
33
33
|
|
|
34
34
|
# Initialise gitleaks
|
|
35
|
-
if ! command -v gitleaks
|
|
35
|
+
if ! command -v gitleaks > /dev/null 2> /dev/null; then
|
|
36
36
|
startStage "Installing gitleaks"
|
|
37
37
|
brew install gitleaks
|
|
38
38
|
endStage " ✅ "
|
|
39
39
|
fi
|
|
40
|
-
|