Skip to content

Commit bb6f4b2

Browse files
fergusbissetclaude
andcommitted
Rename package to @nhsdigital/fdp-design-system
- Changed package name from @nhsdigital/nhs-fdp-design-system to @nhsdigital/fdp-design-system - Updated all import references across docs, src, and config files - Package name now matches the repo name and avoids redundant "nhs" prefix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 53b67c8 commit bb6f4b2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+321
-321
lines changed

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,4 @@ jobs:
8080
- name: Summary
8181
run: |
8282
VERSION=$(node -p "require('./package.json').version")
83-
echo "Published @nhsdigital/nhs-fdp-design-system@$VERSION to npm" >> $GITHUB_STEP_SUMMARY
83+
echo "Published @nhsdigital/fdp-design-system@$VERSION to npm" >> $GITHUB_STEP_SUMMARY

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Components with interactivity use a split pattern:
7070
- `.tsx` - Client variant with state and data attributes for behaviours
7171
- `.server.tsx` - Server variant invoking pure renderer only
7272

73-
Server variants can be imported via `@nhsdigital/nhs-fdp-design-system/components/ComponentName/server`
73+
Server variants can be imported via `@nhsdigital/fdp-design-system/components/ComponentName/server`
7474

7575
### Design Token System
7676
Built with Style Dictionary, tokens are in `packages/nhs-fdp/tokens/`:
@@ -112,7 +112,7 @@ The build system auto-generates exports:
112112

113113
1. **Documentation Location**: All docs go in `docs/` subdirectories, never at repo root
114114
2. **React Version**: Uses React 19.2.0
115-
3. **Package Registry**: Published to npm public registry (`@nhsdigital/nhs-fdp-design-system`)
115+
3. **Package Registry**: Published to npm public registry (`@nhsdigital/fdp-design-system`)
116116
4. **Next.js Compatibility**: Supports Next.js 13.4+ through 16
117117
5. **Pre-version Checks**: `npm run preversion` runs lint, tests, and build before version bumps
118118
6. **Repository**: https://github.com/NHSDigital/fdp-react-design-system

MIGRATION-PLAN.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This document outlines the step-by-step process to migrate from `fergusbisset/nh
77
| Item | From | To |
88
|------|------|-----|
99
| **Repository** | `github.com/fergusbisset/nhs-fdp-design-system` | `github.com/NHSDigital/fdp-react-design-system` |
10-
| **Package Name** | `@nhsdigital/nhs-fdp-design-system` | `@nhsdigital/nhs-fdp-design-system` |
10+
| **Package Name** | `@nhsdigital/fdp-design-system` | `@nhsdigital/fdp-design-system` |
1111
| **Registry** | GitHub Packages | npm public registry |
1212
| **Author** | Fergus Bisset | FDP Product Design Team |
1313

@@ -171,7 +171,7 @@ Update `package.json` to remove corresponding npm scripts.
171171

172172
```json
173173
{
174-
"name": "@nhsdigital/nhs-fdp-design-system",
174+
"name": "@nhsdigital/fdp-design-system",
175175
"author": "FDP Product Design Team",
176176
"license": "MIT",
177177
"repository": {
@@ -191,7 +191,7 @@ Update `package.json` to remove corresponding npm scripts.
191191

192192
### Step 5.2: Update all internal package references
193193
Search and replace throughout codebase:
194-
- `@nhsdigital/nhs-fdp-design-system``@nhsdigital/nhs-fdp-design-system`
194+
- `@nhsdigital/fdp-design-system``@nhsdigital/fdp-design-system`
195195

196196
Files to update:
197197
- `README.md` (all import examples)
@@ -202,7 +202,7 @@ Files to update:
202202

203203
### Step 5.3: Update README.md
204204
- Remove GitHub Packages authentication instructions
205-
- Add npm public registry installation: `npm install @nhsdigital/nhs-fdp-design-system`
205+
- Add npm public registry installation: `npm install @nhsdigital/fdp-design-system`
206206
- Update repository URLs
207207
- Update author/team references
208208

@@ -287,7 +287,7 @@ npm publish --access public
287287

288288
### Step 8.3: Verify npm installation
289289
```bash
290-
npm install @nhsdigital/nhs-fdp-design-system
290+
npm install @nhsdigital/fdp-design-system
291291
```
292292

293293
---
@@ -328,7 +328,7 @@ After the main migration is stable, extract SPC to its own repository:
328328
- [x] Update package.json scripts
329329

330330
### Phase 5: Package Config
331-
- [x] Update package name to `@nhsdigital/nhs-fdp-design-system`
331+
- [x] Update package name to `@nhsdigital/fdp-design-system`
332332
- [x] Update author to "FDP Product Design Team"
333333
- [x] Update license to MIT
334334
- [x] Update publishConfig for npm public

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ The NHS FDP Design System provides a complete set of reusable components, design
99
## Installation
1010

1111
```bash
12-
npm install @nhsdigital/nhs-fdp-design-system
12+
npm install @nhsdigital/fdp-design-system
1313
```
1414

1515
## Basic Usage
1616

1717
```tsx
18-
import { Button, Panel, Heading } from '@nhsdigital/nhs-fdp-design-system';
19-
import '@nhsdigital/nhs-fdp-design-system/dist/nhs-fdp-design-system.css';
18+
import { Button, Panel, Heading } from '@nhsdigital/fdp-design-system';
19+
import '@nhsdigital/fdp-design-system/dist/nhs-fdp-design-system.css';
2020

2121
function App() {
2222
return (
@@ -34,17 +34,17 @@ You can import individual components via stable subpaths to keep bundles lean an
3434

3535
```tsx
3636
// Import a single component (JS + types)
37-
import Button from '@nhsdigital/nhs-fdp-design-system/components/Button';
37+
import Button from '@nhsdigital/fdp-design-system/components/Button';
3838

3939
// Many components are available this way, e.g.
40-
import Card from '@nhsdigital/nhs-fdp-design-system/components/Card';
41-
import Grid from '@nhsdigital/nhs-fdp-design-system/components/Grid';
40+
import Card from '@nhsdigital/fdp-design-system/components/Card';
41+
import Grid from '@nhsdigital/fdp-design-system/components/Grid';
4242

4343
// Server-only variants (where available)
44-
import { HeaderServer } from '@nhsdigital/nhs-fdp-design-system/components/Header/server';
44+
import { HeaderServer } from '@nhsdigital/fdp-design-system/components/Header/server';
4545

4646
// Styles can still be brought in globally or per-component via CSS subpaths
47-
import '@nhsdigital/nhs-fdp-design-system/components/Button/css';
47+
import '@nhsdigital/fdp-design-system/components/Button/css';
4848
```
4949

5050
Notes:
@@ -61,9 +61,9 @@ Interactive components (Header overflow, CharacterCount, etc.) require the behav
6161

6262
```tsx
6363
// app/layout.tsx (Server Component)
64-
import '@nhsdigital/nhs-fdp-design-system/dist/nhs-fdp-design-system.css';
65-
import { HeaderServer } from '@nhsdigital/nhs-fdp-design-system/ssr';
66-
import { NHSBehavioursInit } from '@nhsdigital/nhs-fdp-design-system/nextjs';
64+
import '@nhsdigital/fdp-design-system/dist/nhs-fdp-design-system.css';
65+
import { HeaderServer } from '@nhsdigital/fdp-design-system/ssr';
66+
import { NHSBehavioursInit } from '@nhsdigital/fdp-design-system/nextjs';
6767

6868
export default function RootLayout({ children }: { children: React.ReactNode }) {
6969
return (
@@ -124,13 +124,13 @@ Some interactive components adopt an explicit split to guarantee deterministic,
124124
- `Component.tsx` – Client interactive variant that wraps the pure renderer and adds state, effects and data attributes for behaviours.
125125
- `Component.server.tsx` – Server (static) variant invoking the pure renderer only. Contains no React hooks (enforced via `npm run verify:server-variants`).
126126

127-
Current migrated components: `Radios`, `Header` (exporting `RadiosServer`, `HeaderServer`). You can import server variants via `@nhsdigital/nhs-fdp-design-system/components/ComponentName/server`.
127+
Current migrated components: `Radios`, `Header` (exporting `RadiosServer`, `HeaderServer`). You can import server variants via `@nhsdigital/fdp-design-system/components/ComponentName/server`.
128128

129129
Quick SSR usage (Next.js server components):
130130

131131
```tsx
132132
// Import SSR-safe components only
133-
import { Header, ButtonServer, SummaryList, Input, Textarea, Select } from '@nhsdigital/nhs-fdp-design-system/ssr';
133+
import { Header, ButtonServer, SummaryList, Input, Textarea, Select } from '@nhsdigital/fdp-design-system/ssr';
134134
```
135135

136136
## Development

docs/BEHAVIOURS_ARCHITECTURE.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ This architecture ensures:
6363

6464
### 1. SSR Components (Server-Side)
6565

66-
**Import from:** `@nhsdigital/nhs-fdp-design-system/ssr` or main export
66+
**Import from:** `@nhsdigital/fdp-design-system/ssr` or main export
6767

6868
**Usage:**
6969
```tsx
7070
// app/page.tsx (Next.js App Router - Server Component)
71-
import { Button, Radios, Input } from '@nhsdigital/nhs-fdp-design-system/ssr';
71+
import { Button, Radios, Input } from '@nhsdigital/fdp-design-system/ssr';
7272

7373
export default function Page() {
7474
return (
@@ -97,12 +97,12 @@ export default function Page() {
9797

9898
### 2. BehavioursLoader (Client Component)
9999

100-
**Import from:** `@nhsdigital/nhs-fdp-design-system/behaviours/react`
100+
**Import from:** `@nhsdigital/fdp-design-system/behaviours/react`
101101

102102
**Usage:**
103103
```tsx
104104
// app/layout.tsx (Next.js App Router - Server Component)
105-
import { BehavioursLoader } from '@nhsdigital/nhs-fdp-design-system/behaviours/react';
105+
import { BehavioursLoader } from '@nhsdigital/fdp-design-system/behaviours/react';
106106

107107
export default function RootLayout({ children }) {
108108
return (
@@ -137,12 +137,12 @@ export default function RootLayout({ children }) {
137137

138138
### 3. Vanilla JS Behaviours (Browser-Only)
139139

140-
**Import from:** `@nhsdigital/nhs-fdp-design-system/behaviours`
140+
**Import from:** `@nhsdigital/fdp-design-system/behaviours`
141141

142142
**Usage:**
143143
```typescript
144144
// Traditional approach (if not using React)
145-
import { initAll } from '@nhsdigital/nhs-fdp-design-system/behaviours';
145+
import { initAll } from '@nhsdigital/fdp-design-system/behaviours';
146146

147147
// After DOM is ready
148148
document.addEventListener('DOMContentLoaded', () => {
@@ -163,8 +163,8 @@ document.addEventListener('DOMContentLoaded', () => {
163163

164164
```tsx
165165
// app/layout.tsx (Server Component)
166-
import { BehavioursLoader } from '@nhsdigital/nhs-fdp-design-system/behaviours/react';
167-
import '@nhsdigital/nhs-fdp-design-system/css';
166+
import { BehavioursLoader } from '@nhsdigital/fdp-design-system/behaviours/react';
167+
import '@nhsdigital/fdp-design-system/css';
168168

169169
export default function RootLayout({ children }) {
170170
return (
@@ -180,7 +180,7 @@ export default function RootLayout({ children }) {
180180

181181
```tsx
182182
// app/page.tsx (Server Component)
183-
import { Button, Radios } from '@nhsdigital/nhs-fdp-design-system/ssr';
183+
import { Button, Radios } from '@nhsdigital/fdp-design-system/ssr';
184184

185185
export default function Page() {
186186
return (
@@ -196,8 +196,8 @@ export default function Page() {
196196

197197
```tsx
198198
// pages/_app.tsx
199-
import { BehavioursLoader } from '@nhsdigital/nhs-fdp-design-system/behaviours/react';
200-
import '@nhsdigital/nhs-fdp-design-system/css';
199+
import { BehavioursLoader } from '@nhsdigital/fdp-design-system/behaviours/react';
200+
import '@nhsdigital/fdp-design-system/css';
201201

202202
export default function App({ Component, pageProps }) {
203203
return (
@@ -219,7 +219,7 @@ import nunjucks from 'nunjucks';
219219
const app = express();
220220

221221
// Serve behaviours bundle
222-
app.use('/static', express.static('node_modules/@nhsdigital/nhs-fdp-design-system/dist/behaviours'));
222+
app.use('/static', express.static('node_modules/@nhsdigital/fdp-design-system/dist/behaviours'));
223223

224224
// In your template:
225225
// <script src="/static/index.js"></script>
@@ -282,7 +282,7 @@ export function initRadios(scope = document) {
282282
```tsx
283283
// ✅ CORRECT - Import in layout, use after children
284284
// app/layout.tsx (Server Component is OK)
285-
import { BehavioursLoader } from '@nhsdigital/nhs-fdp-design-system/behaviours/react';
285+
import { BehavioursLoader } from '@nhsdigital/fdp-design-system/behaviours/react';
286286

287287
export default function Layout({ children }) {
288288
return (

docs/BEHAVIOURS_INITIALIZATION.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Use Next.js `Script` component or plain `<script>` tags to initialize behaviours
3838

3939
```tsx
4040
// app/layout.tsx (Server Component - no "use client" needed!)
41-
import { InitBehaviours } from '@nhsdigital/nhs-fdp-design-system/nextjs'
41+
import { InitBehaviours } from '@nhsdigital/fdp-design-system/nextjs'
4242

4343
export default function RootLayout({ children }: { children: React.ReactNode }) {
4444
return (
@@ -77,7 +77,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
7777

7878
```tsx
7979
// app/layout.tsx
80-
import { InitBehavioursInline } from '@nhsdigital/nhs-fdp-design-system/nextjs'
80+
import { InitBehavioursInline } from '@nhsdigital/fdp-design-system/nextjs'
8181

8282
export default function RootLayout({ children }: { children: React.ReactNode }) {
8383
return (
@@ -112,7 +112,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
112112

113113
<!-- Load behaviours after content -->
114114
<script
115-
src="/node_modules/@nhsdigital/nhs-fdp-design-system/dist/behaviours/init.js"
115+
src="/node_modules/@nhsdigital/fdp-design-system/dist/behaviours/init.js"
116116
type="module"
117117
defer
118118
></script>
@@ -124,7 +124,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
124124

125125
```html
126126
<script
127-
src="https://unpkg.com/@nhsdigital/nhs-fdp-design-system/dist/behaviours/init.js"
127+
src="https://unpkg.com/@nhsdigital/fdp-design-system/dist/behaviours/init.js"
128128
type="module"
129129
defer
130130
></script>
@@ -149,7 +149,7 @@ export function ClientInitializer() {
149149
if (typeof window === 'undefined') return
150150

151151
// Import and initialize
152-
import('@nhsdigital/nhs-fdp-design-system/behaviours')
152+
import('@nhsdigital/fdp-design-system/behaviours')
153153
.then(({ initAll }) => {
154154
initAll(document)
155155
})
@@ -197,7 +197,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
197197

198198
```tsx
199199
// app/layout.tsx
200-
import { BehavioursLoader } from '@nhsdigital/nhs-fdp-design-system/behaviours/react'
200+
import { BehavioursLoader } from '@nhsdigital/fdp-design-system/behaviours/react'
201201

202202
export default function RootLayout({ children }) {
203203
return (
@@ -215,7 +215,7 @@ export default function RootLayout({ children }) {
215215

216216
```tsx
217217
// app/layout.tsx
218-
import { InitBehaviours } from '@nhsdigital/nhs-fdp-design-system/nextjs'
218+
import { InitBehaviours } from '@nhsdigital/fdp-design-system/nextjs'
219219

220220
export default function RootLayout({ children }) {
221221
return (
@@ -247,7 +247,7 @@ export function ScopedSection() {
247247
useEffect(() => {
248248
if (!containerRef.current) return
249249

250-
import('@nhsdigital/nhs-fdp-design-system/behaviours')
250+
import('@nhsdigital/fdp-design-system/behaviours')
251251
.then(({ initAll }) => {
252252
initAll(containerRef.current!) // Init only in this container
253253
})
@@ -275,7 +275,7 @@ export function ManagedSection() {
275275

276276
let cleanup: (() => void) | undefined
277277

278-
import('@nhsdigital/nhs-fdp-design-system/behaviours')
278+
import('@nhsdigital/fdp-design-system/behaviours')
279279
.then(({ initAll, teardownAll }) => {
280280
initAll(containerRef.current!)
281281
cleanup = () => teardownAll(containerRef.current!)
@@ -306,8 +306,8 @@ export function ManagedSection() {
306306
### "Module not found" errors
307307

308308
**Check**:
309-
1. Package is installed: `npm list @nhsdigital/nhs-fdp-design-system`
310-
2. Import path is correct: `@nhsdigital/nhs-fdp-design-system/nextjs`
309+
1. Package is installed: `npm list @nhsdigital/fdp-design-system`
310+
2. Import path is correct: `@nhsdigital/fdp-design-system/nextjs`
311311
3. Build succeeded: `npm run build`
312312

313313
### Behaviours run too early (before hydration)
@@ -342,7 +342,7 @@ Use `<InitBehavioursInline />` if:
342342
**The recommended approach is `<InitBehaviours />`** from the `/nextjs` export:
343343

344344
```tsx
345-
import { InitBehaviours } from '@nhsdigital/nhs-fdp-design-system/nextjs'
345+
import { InitBehaviours } from '@nhsdigital/fdp-design-system/nextjs'
346346
```
347347

348348
This gives you:

docs/MIGRATIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ We’ve simplified SPC imports to a few stable surfaces and reduced accidental c
55
Recommended pattern (barrel-first):
66

77
- Component and basic types → `src/components/DataVisualisation/charts/SPC` (SPC barrel)
8-
- Example: `import { SPCChart } from '@nhsdigital/nhs-fdp-design-system/src/components/DataVisualisation/charts/SPC'`
8+
- Example: `import { SPCChart } from '@nhsdigital/fdp-design-system/src/components/DataVisualisation/charts/SPC'`
99
- Example: `import type { SPCChartProps, SPCDatum } from '.../charts/SPC'`
1010
- Engine helpers and enums → `src/components/DataVisualisation/charts/SPC/engine`
1111
- Example: `import { buildSpcV26a, SpcVisualCategory } from '.../charts/SPC/engine'`

docs/NEXTJS-QUICK-START.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ Load the behaviours via a tiny client-only component provided by the library. Th
1414

1515
```tsx
1616
// app/layout.tsx (Server Component)
17-
import '@nhsdigital/nhs-fdp-design-system/dist/nhs-fdp-design-system.css';
18-
import { HeaderServer } from '@nhsdigital/nhs-fdp-design-system/ssr';
19-
import { NHSBehavioursInit } from '@nhsdigital/nhs-fdp-design-system/nextjs';
17+
import '@nhsdigital/fdp-design-system/dist/nhs-fdp-design-system.css';
18+
import { HeaderServer } from '@nhsdigital/fdp-design-system/ssr';
19+
import { NHSBehavioursInit } from '@nhsdigital/fdp-design-system/nextjs';
2020

2121
export default function RootLayout({ children }: { children: React.ReactNode }) {
2222
return (
@@ -34,7 +34,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
3434
}
3535
```
3636

37-
Alternative (legacy): If you can’t use the component, create your own client-only wrapper that imports '@nhsdigital/nhs-fdp-design-system/behaviours'. Note: avoid manual script tags (e.g. adding a src directly) – this is brittle in Next.js and won’t help SSR inline dynamic imports.
37+
Alternative (legacy): If you can’t use the component, create your own client-only wrapper that imports '@nhsdigital/fdp-design-system/behaviours'. Note: avoid manual script tags (e.g. adding a src directly) – this is brittle in Next.js and won’t help SSR inline dynamic imports.
3838

3939
## How to Verify It's Working
4040

@@ -64,7 +64,7 @@ So behaviours **automatically initialize** there. But in your Next.js app, nothi
6464

6565
## What the Behaviours Do
6666

67-
When you import `@nhsdigital/nhs-fdp-design-system/behaviours`, it:
67+
When you import `@nhsdigital/fdp-design-system/behaviours`, it:
6868

6969
1. **Auto-initializes** on DOM ready (code at bottom of `behaviours/index.ts`)
7070
2. **Finds all headers** on the page (`.nhsuk-header`)
@@ -80,9 +80,9 @@ Without this, you just get the static SSR markup with no interactivity.
8080

8181
```tsx
8282
// app/layout.tsx
83-
import '@nhsdigital/nhs-fdp-design-system/behaviours' // ← The magic line
84-
import { Header } from '@nhsdigital/nhs-fdp-design-system/ssr'
85-
import '@nhsdigital/nhs-fdp-design-system/dist/nhs-fdp-design-system.css'
83+
import '@nhsdigital/fdp-design-system/behaviours' // ← The magic line
84+
import { Header } from '@nhsdigital/fdp-design-system/ssr'
85+
import '@nhsdigital/fdp-design-system/dist/nhs-fdp-design-system.css'
8686

8787
export default function RootLayout({
8888
children

0 commit comments

Comments
 (0)