Skip to content

Commit 3f7bd4f

Browse files
feat(spc): prep for alpha publish and add CI publish workflow
1 parent 5949a91 commit 3f7bd4f

File tree

4 files changed

+101
-3
lines changed

4 files changed

+101
-3
lines changed

.github/workflows/spc-publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish @nhs-fdp/spc
2+
3+
on:
4+
push:
5+
tags:
6+
- 'spc-v*'
7+
8+
jobs:
9+
publish:
10+
name: Build and publish SPC package
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Use Node.js 22.x
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 22.x
25+
registry-url: 'https://npm.pkg.github.com'
26+
scope: '@nhs-fdp'
27+
28+
- name: Install dependencies
29+
run: npm ci
30+
31+
- name: Build design tokens (smart)
32+
run: npm run build:tokens:smart
33+
34+
- name: Verify tag matches SPC package version
35+
run: |
36+
PKG_VERSION=$(node -p "require('./packages/nhs-fdp-spc/package.json').version")
37+
TAG_VERSION=${GITHUB_REF_NAME#spc-v}
38+
echo "Package version: $PKG_VERSION"
39+
echo "Tag version: $TAG_VERSION"
40+
test "$PKG_VERSION" = "$TAG_VERSION"
41+
42+
- name: Build SPC package
43+
run: npm run build
44+
working-directory: packages/nhs-fdp-spc
45+
46+
- name: Publish @nhs-fdp/spc to GitHub Packages (alpha tag)
47+
run: npm publish --tag alpha
48+
working-directory: packages/nhs-fdp-spc
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

packages/nhs-fdp-spc/LICENSE

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ISC License
2+
3+
Copyright (c) 2025 NHS FDP
4+
5+
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

packages/nhs-fdp-spc/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,37 @@ import { SPCChart, SPCSpark } from '@nhs-fdp/spc';
4747
import { SPCChart } from '@nhs-fdp/design-system';
4848
```
4949

50+
## Installation (External via GitHub Packages)
51+
52+
Until this package is on npmjs, install from GitHub Packages. First, authenticate npm to GitHub Packages (once per machine):
53+
54+
Create a `.npmrc` in your user home directory or project root with:
55+
56+
```ini
57+
@nhs-fdp:registry=https://npm.pkg.github.com
58+
//npm.pkg.github.com/:_authToken=YOUR_GITHUB_TOKEN
59+
```
60+
61+
Then install the alpha build:
62+
63+
```bash
64+
npm install @nhs-fdp/spc@alpha
65+
```
66+
67+
Usage in your app:
68+
69+
```tsx
70+
import { SPCChart } from '@nhs-fdp/spc';
71+
// Import the minimal SPC CSS bundle
72+
import '@nhs-fdp/spc/styles';
73+
```
74+
75+
Notes:
76+
77+
- Your GitHub token needs the “read:packages” scope (and access to the repository if private).
78+
- If your project has a `.npmrc` with a default registry, ensure the scoped registry line for `@nhs-fdp` is present as above.
79+
- Types ship with the package; no extra typings install is needed.
80+
5081
## Export Surface (Initial)
5182

5283
| Entry | Description |

packages/nhs-fdp-spc/package.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
{
22
"name": "@nhs-fdp/spc",
3-
"version": "0.0.0-internal.0",
4-
"private": true,
5-
"description": "Statistical Process Control (SPC) components and engine (internal package – subject to change)",
3+
"version": "0.0.1-alpha.0",
4+
"description": "Statistical Process Control (SPC) components and engine for the NHS FDP Design System",
65
"type": "module",
76
"main": "dist/index.cjs",
87
"module": "dist/index.esm.js",
98
"types": "dist/index.d.ts",
9+
"license": "ISC",
10+
"files": [
11+
"dist",
12+
"README.md",
13+
"LICENSE"
14+
],
15+
"publishConfig": {
16+
"registry": "https://npm.pkg.github.com"
17+
},
1018
"exports": {
1119
".": {
1220
"types": "./dist/index.d.ts",
@@ -35,6 +43,8 @@
3543
"dependencies": {},
3644
"scripts": {
3745
"build": "vite build --config ../../config/vite.spc.config.ts && vite build --config ../../config/vite.spc.css.config.ts",
46+
"exports:check": "node ../../scripts/spc-export-check.cjs",
47+
"prepublishOnly": "npm run exports:check && npm run build",
3848
"test": "vitest run --dir ./tests"
3949
}
4050
}

0 commit comments

Comments
 (0)