@govuk-pay/pay-js-commons 3.11.2 → 4.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/README.md +8 -16
- package/package.json +11 -3
- package/.github/dependabot.yml +0 -22
- package/.github/workflows/run-tests.yml +0 -48
- package/.pre-commit-config.yaml +0 -7
- package/.secrets.baseline +0 -122
- package/ci/pipeline.yml +0 -75
- package/jest.config.js +0 -5
package/README.md
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
[](https://travis-ci.org/alphagov/pay-js-commons)
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
# GOV.UK Pay JS Commons
|
|
5
2
|
Reusable js scripts for GOV.UK Pay Node.js projects
|
|
6
3
|
|
|
@@ -10,8 +7,8 @@ Reusable js scripts for GOV.UK Pay Node.js projects
|
|
|
10
7
|
- [Releasing a new version](#releasing-a-new-version)
|
|
11
8
|
|
|
12
9
|
## Browsered scripts
|
|
13
|
-
This is a
|
|
14
|
-
Pay in the browser. We call it browsered because they are written in
|
|
10
|
+
This is a collection of client side scripts we use throughout GOV.UK
|
|
11
|
+
Pay in the browser. We call it `browsered` because they are written in
|
|
15
12
|
Node.js and _browsered_ by Browserify to make them safe for all our
|
|
16
13
|
browsers. We browserify [within the microservice when it’s compiled](https://github.com/alphagov/pay-selfservice/blob/master/Gruntfile.js#L128).
|
|
17
14
|
|
|
@@ -149,7 +146,7 @@ i.e. ``< > ; : ` ( ) " \' = | , ~ [ ]``
|
|
|
149
146
|
|
|
150
147
|
These are small functions that power the nunjucks filters but can also be used for server side stuff too.
|
|
151
148
|
|
|
152
|
-
|
|
149
|
+
### Nunjucks filters
|
|
153
150
|
|
|
154
151
|
These get loaded in to the Nunjucks environment and then can apply changes to variables in templates.
|
|
155
152
|
|
|
@@ -167,18 +164,13 @@ Or a pence value can be converted to GBP
|
|
|
167
164
|
<dd>{{ amount | penceToPounds }}</dd>
|
|
168
165
|
</dl>
|
|
169
166
|
```
|
|
170
|
-
# Releasing a new version
|
|
171
167
|
|
|
172
|
-
|
|
168
|
+
## Releasing
|
|
173
169
|
|
|
174
|
-
|
|
170
|
+
After a pull request is merged, Concourse will automatically create a new release pull request that increments the package version.
|
|
175
171
|
|
|
176
|
-
|
|
177
|
-
- `npm login` (if you’re not already logged in)
|
|
178
|
-
- `npm version major|minor|patch` depending on which sort of release it is
|
|
179
|
-
- `npm publish`
|
|
180
|
-
- A new commit is created automatically to increment the version, create a PR and merge this
|
|
172
|
+
This pull request must be reviewed and merged by a developer.
|
|
181
173
|
|
|
182
|
-
Once
|
|
174
|
+
Once the release pull request is merged, GitHub Actions will publish the new versioned package to NPM.
|
|
183
175
|
|
|
184
|
-
|
|
176
|
+
__IMPORTANT__: Other pull requests will be blocked from merging until the release pull request is merged or closed.
|
package/package.json
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@govuk-pay/pay-js-commons",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "Reusable js scripts for GOV.UK Pay Node.js projects",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": "^
|
|
6
|
+
"node": "^18.17.1"
|
|
7
7
|
},
|
|
8
8
|
"main": "lib/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"images",
|
|
11
|
+
"sass",
|
|
12
|
+
"lib"
|
|
13
|
+
],
|
|
9
14
|
"scripts": {
|
|
10
15
|
"compile": "npm run transpile",
|
|
11
16
|
"clean": "rm -rf lib",
|
|
@@ -16,12 +21,15 @@
|
|
|
16
21
|
"test": "npm run jest-tests npm && npm run karma-tests",
|
|
17
22
|
"karma-tests": "karma start",
|
|
18
23
|
"jest-tests": "jest src/analytics",
|
|
19
|
-
"lint": "
|
|
24
|
+
"lint": "standard --fix"
|
|
20
25
|
},
|
|
21
26
|
"repository": {
|
|
22
27
|
"type": "git",
|
|
23
28
|
"url": "git+https://github.com/alphagov/pay-js-commons.git"
|
|
24
29
|
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"registry": "https://registry.npmjs.org"
|
|
32
|
+
},
|
|
25
33
|
"keywords": [
|
|
26
34
|
"nodejs",
|
|
27
35
|
"js",
|
package/.github/dependabot.yml
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
version: 2
|
|
2
|
-
updates:
|
|
3
|
-
- package-ecosystem: npm
|
|
4
|
-
directory: "/"
|
|
5
|
-
schedule:
|
|
6
|
-
interval: daily
|
|
7
|
-
time: "03:00"
|
|
8
|
-
open-pull-requests-limit: 0
|
|
9
|
-
labels:
|
|
10
|
-
- dependencies
|
|
11
|
-
- govuk-pay
|
|
12
|
-
- javascript
|
|
13
|
-
- package-ecosystem: github-actions
|
|
14
|
-
directory: "/"
|
|
15
|
-
schedule:
|
|
16
|
-
interval: daily
|
|
17
|
-
time: "03:00"
|
|
18
|
-
open-pull-requests-limit: 0
|
|
19
|
-
labels:
|
|
20
|
-
- dependencies
|
|
21
|
-
- govuk-pay
|
|
22
|
-
- github_actions
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
name: Github Actions Tests
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- master
|
|
7
|
-
pull_request:
|
|
8
|
-
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
detect-secrets:
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
steps:
|
|
16
|
-
- name: Git checkout
|
|
17
|
-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
18
|
-
- name: Detect secrets
|
|
19
|
-
uses: alphagov/pay-ci/actions/detect-secrets@master
|
|
20
|
-
|
|
21
|
-
unit-tests:
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
name: Unit tests
|
|
24
|
-
|
|
25
|
-
steps:
|
|
26
|
-
- name: Checkout
|
|
27
|
-
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
|
28
|
-
- name: Parse Node version
|
|
29
|
-
run: echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
|
|
30
|
-
id: parse-node-version
|
|
31
|
-
- name: Setup
|
|
32
|
-
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c
|
|
33
|
-
with:
|
|
34
|
-
node-version: "${{ steps.parse-node-version.outputs.NVMRC }}"
|
|
35
|
-
- name: Cache NPM packages
|
|
36
|
-
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
|
|
37
|
-
with:
|
|
38
|
-
path: ~/.npm
|
|
39
|
-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
40
|
-
restore-keys: ${{ runner.os }}-node-
|
|
41
|
-
- name: Install dependencies
|
|
42
|
-
run: npm ci
|
|
43
|
-
- name: Compile
|
|
44
|
-
run: npm run compile
|
|
45
|
-
- name: Run lint
|
|
46
|
-
run: npm run lint
|
|
47
|
-
- name: Run unit tests
|
|
48
|
-
run: npm test -- --forbid-only --forbid-pending
|
package/.pre-commit-config.yaml
DELETED
package/.secrets.baseline
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "1.4.0",
|
|
3
|
-
"plugins_used": [
|
|
4
|
-
{
|
|
5
|
-
"name": "ArtifactoryDetector"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"name": "AWSKeyDetector"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"name": "AzureStorageKeyDetector"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"name": "Base64HighEntropyString",
|
|
15
|
-
"limit": 4.5
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"name": "BasicAuthDetector"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"name": "CloudantDetector"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "DiscordBotTokenDetector"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"name": "GitHubTokenDetector"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "HexHighEntropyString",
|
|
31
|
-
"limit": 3.0
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"name": "IbmCloudIamDetector"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "IbmCosHmacDetector"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "JwtTokenDetector"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"name": "KeywordDetector",
|
|
44
|
-
"keyword_exclude": ""
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"name": "MailchimpDetector"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"name": "NpmDetector"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"name": "PrivateKeyDetector"
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"name": "SendGridDetector"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "SlackDetector"
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
"name": "SoftlayerDetector"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
"name": "SquareOAuthDetector"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"name": "StripeDetector"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"name": "TwilioKeyDetector"
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
"filters_used": [
|
|
75
|
-
{
|
|
76
|
-
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
|
|
80
|
-
"min_level": 2
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"path": "detect_secrets.filters.heuristic.is_lock_file"
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"path": "detect_secrets.filters.heuristic.is_sequential_string"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"path": "detect_secrets.filters.heuristic.is_swagger_file"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"path": "detect_secrets.filters.heuristic.is_templated_secret"
|
|
108
|
-
}
|
|
109
|
-
],
|
|
110
|
-
"results": {
|
|
111
|
-
"src/utils/field-validation-checks.js": [
|
|
112
|
-
{
|
|
113
|
-
"type": "Secret Keyword",
|
|
114
|
-
"filename": "src/utils/field-validation-checks.js",
|
|
115
|
-
"hashed_secret": "5bb4b8e78cff9ca47061adfd961e2b26c46e7fa5",
|
|
116
|
-
"is_verified": false,
|
|
117
|
-
"line_number": 20
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
},
|
|
121
|
-
"generated_at": "2022-11-09T09:40:45Z"
|
|
122
|
-
}
|
package/ci/pipeline.yml
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
resource_types:
|
|
3
|
-
|
|
4
|
-
- name: pull-request
|
|
5
|
-
type: docker-image
|
|
6
|
-
source:
|
|
7
|
-
repository: teliaoss/github-pr-resource
|
|
8
|
-
|
|
9
|
-
resources:
|
|
10
|
-
|
|
11
|
-
- name: pull-request
|
|
12
|
-
type: pull-request
|
|
13
|
-
icon: github
|
|
14
|
-
source:
|
|
15
|
-
disable_forks: true
|
|
16
|
-
repository: alphagov/pay-js-commons
|
|
17
|
-
access_token: ((github-access-token))
|
|
18
|
-
|
|
19
|
-
- name: pipeline
|
|
20
|
-
type: git
|
|
21
|
-
icon: github
|
|
22
|
-
source:
|
|
23
|
-
uri: https://github.com/alphagov/pay-js-commons
|
|
24
|
-
branch: master
|
|
25
|
-
paths:
|
|
26
|
-
- ci/pipeline.yml
|
|
27
|
-
jobs:
|
|
28
|
-
- name: build-pr
|
|
29
|
-
serial: true
|
|
30
|
-
plan:
|
|
31
|
-
- get: pull-request
|
|
32
|
-
trigger: true
|
|
33
|
-
- put: pull-request
|
|
34
|
-
params:
|
|
35
|
-
path: pull-request
|
|
36
|
-
status: pending
|
|
37
|
-
- task: build
|
|
38
|
-
config:
|
|
39
|
-
platform: linux
|
|
40
|
-
image_resource:
|
|
41
|
-
type: docker-image
|
|
42
|
-
source:
|
|
43
|
-
repository: node
|
|
44
|
-
tag: alpine3.16
|
|
45
|
-
inputs:
|
|
46
|
-
- name: pull-request
|
|
47
|
-
caches:
|
|
48
|
-
- path: pull-request/vendor
|
|
49
|
-
run:
|
|
50
|
-
path: sh
|
|
51
|
-
dir: pull-request
|
|
52
|
-
args:
|
|
53
|
-
- -c
|
|
54
|
-
- |
|
|
55
|
-
apk add --no-cache chromium
|
|
56
|
-
export CHROMIUM_BIN="$(which chromium)"
|
|
57
|
-
npm ci
|
|
58
|
-
npm run test
|
|
59
|
-
on_failure:
|
|
60
|
-
put: pull-request
|
|
61
|
-
params:
|
|
62
|
-
description: "Build failed on PR"
|
|
63
|
-
path: pull-request
|
|
64
|
-
status: failure
|
|
65
|
-
- put: pull-request
|
|
66
|
-
params:
|
|
67
|
-
path: pull-request
|
|
68
|
-
status: success
|
|
69
|
-
|
|
70
|
-
- name: update-pipeline
|
|
71
|
-
plan:
|
|
72
|
-
- get: pipeline
|
|
73
|
-
trigger: true
|
|
74
|
-
- set_pipeline: pay-js-commons
|
|
75
|
-
file: pipeline/ci/pipeline.yml
|