Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"scripts": {
"install:playwright": "playwright install chromium --with-deps --only-shell",
"install:puppeteer": "puppeteer browsers install",
"preclean": "del-cli dist",
"preclean": "del-cli dist/*",
"clean": "npm run clean --if-present --workspaces",
"postclean": "tsc --build --clean",
"build": "npm run build --if-present --workspaces",
Expand Down
2 changes: 1 addition & 1 deletion packages/nhsuk-frontend-review/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "NHS.UK frontend review app",
"license": "MIT",
"scripts": {
"clean": "del-cli dist",
"clean": "del-cli dist/*",
"postclean": "tsc --build --clean",
"build": "gulp build --color",
"serve": "gulp serve --color",
Expand Down
2 changes: 1 addition & 1 deletion packages/nhsuk-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"!**/*.test.*"
],
"scripts": {
"clean": "del-cli dist",
"clean": "del-cli dist/nhsuk/*",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The del package doesn't set maxRetries when removing files or directories

But updating the glob distdist/nhsuk/* splits out multiple paths to delete which appears to solve the problem (i.e. smaller batched deletes rather than one large delete)

"postclean": "tsc --build --clean",
"build": "gulp build --color",
"watch": "gulp watch --color",
Expand Down
6 changes: 3 additions & 3 deletions shared/lib/components.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { readFileSync } from 'node:fs'
import { basename, join } from 'node:path'
import { basename, dirname, join } from 'node:path'

import { paths } from '@nhsuk/frontend-config'

Expand Down Expand Up @@ -76,12 +76,12 @@ export async function loadAll() {
* Get component names
*/
export function getNames() {
const listing = files.getDirectories('nhsuk/components', {
const listing = files.getListing('nhsuk/components/*/template.njk', {
Copy link
Copy Markdown
Contributor Author

@colinrotherham colinrotherham Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change fixes an issue where switching branches would leave empty directories behind, which then causes errors when trying to run file operations or build tasks on them

E.g. packages/nhsuk-frontend/src/nhsuk/components/search-input

cwd: join(paths.pkg, 'src')
})

// Use directory names only
return listing.map((directoryPath) => basename(directoryPath)).sort()
return listing.map((directoryPath) => basename(dirname(directoryPath))).sort()
}

/**
Expand Down
Loading