@defra/fcp-sfd-frontend-engine 0.38.0 → 0.39.0

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.
@@ -0,0 +1 @@
1
+ npm run check:synthetic-ids
package/README.md CHANGED
@@ -72,4 +72,17 @@ The script uploads results for the current branch and prints:
72
72
  - Open issues on new code (when the gate fails)
73
73
  - **Accepted / false-positive issues without comment** — DEFRA quality gates require a justification comment on each suppressed issue; add comments in SonarCloud under the issue **Activity** tab
74
74
 
75
- Exit code is `0` when the gate passes and all suppressed issues are commented, `1` otherwise.
75
+ Exit code is `0` when the gate passes and all suppressed issues are commented, `1` otherwise.
76
+
77
+ ## Pre-commit hook
78
+
79
+ A [Husky](https://typicode.github.io/husky/) pre-commit hook runs [`sfd-id-check`](https://github.com/DEFRA/fcp-sfd-core/tree/main/scripts/check-synthetic-ids), which blocks commits that add real-looking CRNs or SBIs. Pull requests run the same check.
80
+
81
+ Enable the hook once per clone:
82
+
83
+ ```bash
84
+ npm install
85
+ npm run setup:husky
86
+ ```
87
+
88
+ Use synthetic identifiers only: CRNs from `9000000000` to `9999999999` and SBIs from `800000000` to `899999999`. If a flagged number isn't a CRN or SBI, such as a timestamp, add `sfd-id-check: allow` in a comment on the same line, or list it in `.sfd-id-check-allow`. See the [`sfd-id-check` README](https://github.com/DEFRA/fcp-sfd-core/tree/main/scripts/check-synthetic-ids) for details.
package/dist/index.cjs CHANGED
@@ -97,6 +97,9 @@ var MONTH_MAP = {
97
97
  dec: 12
98
98
  };
99
99
 
100
+ // src/constants/not-added-text.js
101
+ var NOT_ADDED_TEXT = "Not added";
102
+
100
103
  // src/constants/success-messages.js
101
104
  var BUSINESS_ADDRESS = "You have updated your business address";
102
105
  var BUSINESS_CHARITY_REGISTRATION_NUMBER = "You have updated your charity commission registration number";
@@ -302,6 +305,7 @@ var constants = {
302
305
  NO_CONTROL_CHARS_PATTERN
303
306
  },
304
307
  monthMap: MONTH_MAP,
308
+ NOT_ADDED_TEXT,
305
309
  successMessages: {
306
310
  BUSINESS_ADDRESS,
307
311
  BUSINESS_CHARITY_REGISTRATION_NUMBER,
package/dist/index.js CHANGED
@@ -56,6 +56,9 @@ var MONTH_MAP = {
56
56
  dec: 12
57
57
  };
58
58
 
59
+ // src/constants/not-added-text.js
60
+ var NOT_ADDED_TEXT = "Not added";
61
+
59
62
  // src/constants/success-messages.js
60
63
  var BUSINESS_ADDRESS = "You have updated your business address";
61
64
  var BUSINESS_CHARITY_REGISTRATION_NUMBER = "You have updated your charity commission registration number";
@@ -261,6 +264,7 @@ var constants = {
261
264
  NO_CONTROL_CHARS_PATTERN
262
265
  },
263
266
  monthMap: MONTH_MAP,
267
+ NOT_ADDED_TEXT,
264
268
  successMessages: {
265
269
  BUSINESS_ADDRESS,
266
270
  BUSINESS_CHARITY_REGISTRATION_NUMBER,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/fcp-sfd-frontend-engine",
3
- "version": "0.38.0",
3
+ "version": "0.39.0",
4
4
  "description": "Shared frontend engine used by both the internal and external frontend applications.",
5
5
  "main": "./dist/index.cjs",
6
6
  "engines": {
@@ -18,7 +18,9 @@
18
18
  "build": "tsup",
19
19
  "test": "npm run build && vitest run --coverage",
20
20
  "test:watch": "vitest",
21
- "sonar": "node scripts/sonar-scan.js"
21
+ "sonar": "node scripts/sonar-scan.js",
22
+ "check:synthetic-ids": "sfd-id-check --staged",
23
+ "setup:husky": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module"
22
24
  },
23
25
  "repository": {
24
26
  "type": "git",
@@ -43,7 +45,9 @@
43
45
  "devDependencies": {
44
46
  "@vitest/coverage-v8": "5.0.2",
45
47
  "eslint": "9.39.2",
48
+ "fcp-sfd-core": "github:DEFRA/fcp-sfd-core#95f58ade56b2d0dd0f15bdcba6a5f37a54bcc939",
46
49
  "graphql": "16.13.2",
50
+ "husky": "9.1.7",
47
51
  "neostandard": "0.13.0",
48
52
  "tsup": "8.5.1",
49
53
  "vitest": "5.0.2"
@@ -32,6 +32,9 @@ import {
32
32
  import { PHONE_NUMBER_PATTERN, NO_CONTROL_CHARS_PATTERN } from './patterns.js'
33
33
  import { MONTH_MAP } from './month-map.js'
34
34
 
35
+ // Empty value display text
36
+ import { NOT_ADDED_TEXT } from './not-added-text.js'
37
+
35
38
  // Success messages
36
39
  import {
37
40
  BUSINESS_ADDRESS,
@@ -109,6 +112,7 @@ export const constants = {
109
112
  NO_CONTROL_CHARS_PATTERN
110
113
  },
111
114
  monthMap: MONTH_MAP,
115
+ NOT_ADDED_TEXT,
112
116
  successMessages: {
113
117
  BUSINESS_ADDRESS,
114
118
  BUSINESS_CHARITY_REGISTRATION_NUMBER,
@@ -0,0 +1 @@
1
+ export const NOT_ADDED_TEXT = 'Not added'