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

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/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.38.1",
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"