alphagov / govuk-prototype-kit

Rapidly create HTML prototypes of GOV.UK services
https://prototype-kit.service.gov.uk
MIT License
303 stars 236 forks source link

Support for the new Node LTS (version 20) #2363

Closed BenSurgisonGDS closed 10 months ago

BenSurgisonGDS commented 10 months ago

As the current LTS version of node.js is 20 and the maintenance version is 18, we should reflect that within the protoype kit.

See here for the current LTS version: https://nodejs.org/en/download

nataliecarey commented 10 months ago

This PR drops support for 16 which we shouldn't be doing. We should be adding support for 20 without dropping support for 16.

We should also go back to using a specific version in our .nvmrc file, that should be 20.9.0 as that's the current LTS.

colinrotherham commented 10 months ago

Hope this is useful, but you'll probably want Node.js v20.x rather than v20.9.0 or you'll miss new releases:

- lts/*
+ lts/iron

We've just completed our GOV.UK Frontend switch to Node.js 20

Snags wise, Dependabot is still using Node.js 18 which caught us out today:

But otherwise all our tooling blockers were completed and I've added notes for asdf or nvm gotchas

colinrotherham commented 10 months ago

Bear in mind too that you're still on the legacy { "lockfileVersion": 2 } format

Similar to how Node.js 18 shipped with npm v8 but later npm v9, watch out for this to become an issue:

nataliecarey commented 10 months ago

With the version - I think it's important that we specify the version in .nvmrc as it allows reproducibility if we're looking at the same code in the future rather than it using whatever version is lts at that future time.

colinrotherham commented 10 months ago

With the version - I think it's important that we specify the version in .nvmrc as it allows reproducibility if we're looking at the same code in the future rather than it using whatever version is lts at that future time.

That's fair, don't forget your node-version matrix uses the latest (cached) version too

matrix:
  node-version: [16.x, 18.x, 20.x]