@ministryofjustice/hmpps-precommit-hooks 0.0.1 → 0.0.3

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 CHANGED
@@ -1,10 +1,18 @@
1
1
  # Change log
2
2
 
3
+ ## 0.0.3
4
+
5
+ Remove pipefail from prepare script
6
+
7
+ ## 0.0.2
8
+
9
+ Fix issue with alpine not having bash installed.
10
+ Also providing ability to disable running script inside docker
11
+
3
12
  ## 0.0.1
4
13
 
5
14
  Initial release
6
15
 
7
-
8
16
  ## 0.0.1-alpha.1
9
17
 
10
18
  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,9 +1,9 @@
1
- #!/bin/bash
1
+ #!/bin/sh
2
2
  #
3
3
  # This runs as part of any `npm install` via `prepare`
4
4
  #
5
5
 
6
- set -eo pipefail
6
+ set -e
7
7
 
8
8
  startStage() {
9
9
  printf "%s" "$1"
@@ -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 in CI..."
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 &> /dev/null; then
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 &> /dev/null; then
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
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ministryofjustice/hmpps-precommit-hooks",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Precommit hooks for HMPPS typescript projects",
5
5
  "keywords": [
6
6
  "precommit"