Skip to content

Commit 5154f3f

Browse files
committed
Refactor: Generate HTML report detailing each supplier's configuration
1 parent 9e03d8f commit 5154f3f

10 files changed

Lines changed: 963 additions & 17 deletions

File tree

package-lock.json

Lines changed: 26 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
supplier-reports/
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Supplier Reports CLI
2+
3+
A command-line tool for generating HTML reports for NHS Notify suppliers showing their assigned pack specifications.
4+
5+
## Installation
6+
7+
This package is part of the nhs-notify-supplier-config monorepo. Install dependencies from the root:
8+
9+
```bash
10+
npm install
11+
```
12+
13+
## Usage
14+
15+
```bash
16+
# Generate HTML reports for all suppliers
17+
npm run cli -- report -f specs.xlsx -o ./reports
18+
19+
# Exclude draft packs from reports
20+
npm run cli -- report -f specs.xlsx -o ./reports --exclude-drafts
21+
22+
# Generate a blank Excel template
23+
npm run cli -- template -o specs.template.xlsx
24+
25+
# Force overwrite existing template
26+
npm run cli -- template -o specs.template.xlsx --force
27+
```
28+
29+
### Commands
30+
31+
#### `report`
32+
33+
Generate HTML reports per supplier showing assigned pack specifications.
34+
35+
| Option | Alias | Description | Default |
36+
|--------|-------|-------------|---------|
37+
| `--file` | `-f` | Excel file path | specifications.xlsx |
38+
| `--out` | `-o` | Output directory for HTML reports | ./supplier-reports |
39+
| `--exclude-drafts` | | Exclude supplier packs with DRAFT approval status | false |
40+
41+
#### `template`
42+
43+
Generate a blank Excel template with all required sheets and columns.
44+
45+
| Option | Alias | Description | Default |
46+
|--------|-------|-------------|---------|
47+
| `--out` | `-o` | Output .xlsx file path | specifications.template.xlsx |
48+
| `--force` | `-F` | Overwrite existing file if present | false |
49+
50+
## Report Features
51+
52+
Each supplier report includes:
53+
54+
- Supplier information (ID, name, channel type, daily capacity, status)
55+
- Volume group allocations with percentages
56+
- Summary cards showing pack counts by status
57+
- Table of contents with quick navigation
58+
- Detailed pack specifications including:
59+
- Basic information
60+
- Postage details
61+
- Constraints
62+
- Assembly specifications
63+
- Paper details
64+
65+
## Dependencies
66+
67+
- `@nhs-notify/excel-parser` - For parsing Excel files
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import type { Config } from "jest";
2+
3+
const config: Config = {
4+
moduleNameMapper: {
5+
"^@supplier-config/cli-supplier-reports/(.*)$": "<rootDir>/src/$1",
6+
},
7+
preset: "ts-jest",
8+
testEnvironment: "node",
9+
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
10+
transform: {
11+
"^.+\\.tsx?$": [
12+
"@swc/jest",
13+
{
14+
jsc: {
15+
parser: {
16+
syntax: "typescript",
17+
tsx: false,
18+
},
19+
target: "es2022",
20+
},
21+
},
22+
],
23+
},
24+
};
25+
26+
export default config;
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"bin": {
3+
"supplier-reports": "dist/cli.js"
4+
},
5+
"dependencies": {
6+
"@nhsdigital/nhs-notify-event-schemas-supplier-config": "*",
7+
"@supplier-config/excel-parser": "*",
8+
"yargs": "^17.7.2"
9+
},
10+
"devDependencies": {
11+
"@swc/core": "^1.11.13",
12+
"@swc/jest": "^0.2.37",
13+
"@tsconfig/node22": "^22.0.2",
14+
"@types/jest": "^29.5.14",
15+
"@types/yargs": "^17.0.32",
16+
"jest": "^29.7.0",
17+
"jest-mock-extended": "^3.0.7",
18+
"typescript": "^5.9.3"
19+
},
20+
"name": "@supplier-config/cli-supplier-reports",
21+
"private": true,
22+
"scripts": {
23+
"build": "tsc",
24+
"cli": "ts-node src/cli.ts",
25+
"lint": "eslint .",
26+
"lint:fix": "eslint . --fix",
27+
"test": "jest",
28+
"test:unit": "jest",
29+
"typecheck": "tsc --noEmit"
30+
},
31+
"version": "0.0.1"
32+
}

0 commit comments

Comments
 (0)