Skip to content

Tooling refresh - #1164

Open
Michael1142 wants to merge 47 commits into
masterfrom
tooling-refresh
Open

Tooling refresh#1164
Michael1142 wants to merge 47 commits into
masterfrom
tooling-refresh

Conversation

@Michael1142

Copy link
Copy Markdown
Contributor

Summary

Modernises the Express.js service template and brings its runtime, development tooling, frontend build and test stack up to date.

The changes remove obsolete dependencies and configuration, improve the local development experience, and simplify how applications created from the template are built and run.

Changes

Runtime and container

  • Upgrade the template to Node.js 24.
  • Run Node directly as PID 1 in the production container so Kubernetes termination signals are handled correctly.
  • Retain the production HTTP server and close it gracefully on SIGTERM.
  • Update the Docker Compose configuration.
  • Include the Yarn Plug'n'Play ESM loader in the Docker build context.

TypeScript and development workflow

  • Upgrade to TypeScript 6.
  • Adopt the modern Node module configuration and target ES2023.
  • Replace Nodemon and ts-node with tsx watch.
  • Add Yarn editor SDKs and workspace configuration so imports resolve correctly in VS Code.
  • Remove obsolete TypeScript and development dependencies.

Logging

  • Replace @hmcts/nodejs-logging with an application-owned Winston 3 logger.
  • Use structured JSON logging.
  • Remove the local compatibility declaration previously required by the HMCTS logging package.

Testing and linting

  • Upgrade Jest, ts-jest, Playwright and related test tooling.
  • Include route tests in the standard test command.
  • Replace the remaining Chai assertions with Jest assertions.
  • Migrate ESLint to flat configuration and upgrade to ESLint 10.
  • Consolidate the TypeScript ESLint configuration.
  • Replace eslint-plugin-import ordering rules with simple import sorting.
  • Upgrade Prettier, lint-staged and Husky to their current configuration formats.

Frontend build

  • Upgrade GOV.UK Frontend to 6.4.
  • Upgrade Webpack, Sass and the associated loaders and plugins.
  • Replace the deprecated Sass import with the GOV.UK Frontend module entrypoint.
  • Simplify the Webpack configuration and runtime asset copying.
  • Remove unused frontend dependencies and obsolete build configuration.

Dependency maintenance

  • Upgrade supported runtime and development dependencies.
  • Remove obsolete dependency resolutions for form-data and js-yaml.
  • Remove the obsolete copy-webpack-plugin restriction from Renovate.
  • Remove the redundant @types/config package now that config provides its own types.
  • Retain explicit Plug'n'Play peer dependencies where required by the existing tooling.

Template maintenance

  • Update the repository initialisation script.
  • Update GitHub Actions for the revised Node.js and Yarn configuration.

Why

The template had accumulated outdated dependencies, legacy configuration and compatibility workarounds. Updating these incrementally had become increasingly difficult because several parts of the toolchain were coupled to older versions of Node.js, TypeScript, Webpack and ESLint.

This change establishes a more current baseline for services created from the template and reduces the amount of migration work required by adopting teams.

Testing

  • yarn install
  • yarn typecheck
  • yarn lint
  • yarn test
  • yarn build
  • yarn start:dev
  • Production container builds successfully
  • Production container starts and responds to health checks
  • Container shuts down cleanly on SIGTERM
  • Template initialisation script tested against a newly cloned repository

Review notes

This is a broad toolchain update, but the commits have been kept separate by concern to make review easier.

The areas most worth reviewing closely are:

  • the Node.js 24 and TypeScript 6 configuration;
  • the replacement of @hmcts/nodejs-logging;
  • the production container entrypoint and graceful shutdown behaviour;
  • the GOV.UK Frontend and Webpack asset changes; and
  • the updated template initialisation script.

Breaking changes

Services generated from the updated template will use newer versions of Node.js, TypeScript, ESLint, GOV.UK Frontend and associated tooling.

This PR updates the template itself and does not automatically migrate existing services.

Upgrade GOV.UK Frontend to version 6.4.

Remove unused frontend dependencies and obsolete Webpack configuration.

Simplify the Sass loader chain and copy only the GOV.UK fonts and images required at runtime, while loading Nunjucks templates directly from the installed package.

Retain the local TypeScript declaration required for the GOV.UK Frontend JavaScript entrypoint.
Upgrade Sass, sass-loader, css-loader and Mini CSS Extract Plugin.

Replace the deprecated Sass import with the module-based GOV.UK Frontend entrypoint.
Upgrade the asset-copying, generated-template and TypeScript loader dependencies.
Upgrade to ESLint 10 and replace the legacy ESLint configuration with flat config.

Use the consolidated TypeScript ESLint package, scope Jest and CommonJS rules to the relevant files, and replace eslint-plugin-import with simple import sorting.

Remove the obsolete Babel ESLint dependencies and legacy configuration files, and exclude generated output from Prettier.
Upgrade Jest, ts-jest and the HTML smoke-test reporter.

Replace the remaining Chai assertions with Jest assertions and remove unused test dependencies.

Retain jest-util as an explicit peer dependency required by ts-jest under Yarn Plug'n'Play.
Upgrade Prettier, lint-staged and Husky.

Migrate the Husky installation and pre-commit hook to the current format, skip hook installation in CI and production, and run staged-file fixes sequentially.
Use Playwright Test as the browser API entry point and remove the redundant direct Playwright and debug dependencies.

Retain Chokidar for Nunjucks template watching and playwright-core for the Axe Playwright peer dependency.

Remove the unused TypeScript decorator option.
Replace Nodemon and ts-node with tsx watch for local development.

Remove redundant direct Playwright and debug dependencies, use Playwright Test as the browser API entry point, and retain Chokidar for Nunjucks template watching.

Include route tests in the standard test command and remove the unused TypeScript decorator configuration.
Remove the form-data and js-yaml dependency overrides.

Allow dependencies to resolve versions within their declared compatibility ranges. This updates form-data naturally and avoids forcing js-yaml 4 into tooling that declares support for js-yaml 3.
Upgrade the compiler and adopt the modern Node 20 module model with an ES2023 target.

Explicitly configure Node and Jest types, enable isolated module transforms for ts-jest, and declare SCSS imports handled by Webpack.
Retain the production HTTP server so it can be closed on SIGTERM.

Leave SIGINT to Node's default handling so local development exits immediately on Ctrl+C.
Use an application-owned Winston 3 logger with structured JSON output.

Remove the direct dependency and local type declaration for @hmcts/nodejs-logging.
Declare the production runtime command so Node runs as PID 1 and receives Kubernetes termination signals.

Include the Yarn PnP ESM loader in the Docker build context.
Update Playwright, linting, testing and runtime packages within their existing major versions.
Upgrade node-config and remove its obsolete DefinitelyTyped package.

Upgrade express-rate-limit, align the Supertest types and move the Stylelint toolchain to its latest major versions.
Add the Yarn editor SDKs and workspace TypeScript configuration so dependencies resolve correctly in VS Code.
@Michael1142
Michael1142 requested review from a team as code owners July 27, 2026 15:56
@Michael1142
Michael1142 requested review from Asaleem-hmcts, SalimKainos and jordankainos and removed request for a team July 27, 2026 15:56
@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants