Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skuba migrate node 22 #1735

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

skuba migrate node 22 #1735

wants to merge 11 commits into from

Conversation

zbrydon
Copy link
Contributor

@zbrydon zbrydon commented Nov 13, 2024

Resolves #1549

Copy link

changeset-bot bot commented Nov 13, 2024

⚠️ No Changeset found

Latest commit: b165e28

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@zbrydon zbrydon mentioned this pull request Nov 13, 2024
17 tasks
'dist-tags': Record<string, string>;
};

export const getLatestNodeTypes = async (): Promise<VersionResult> => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm we might not want the latest latest, because Node releases odd number versions as unstable so there may be Node 23 types coming soon. If possible we want to get the latest version 22 types

try {
const fetchResponse = await fetch(url, { headers });
const jsonResponse = (await fetchResponse.json()) as RegistryResponse;
const latestNode22 = jsonResponse['dist-tags'].node22;
Copy link
Contributor

Choose a reason for hiding this comment

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

Does a node22 dist tag exist..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As it turns out... no 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Swapped it for your suggestion of
npm show @types/node@^22 version --json

Comment on lines 3 to 4
export const getNode22TypesVersion = () =>
execSync("npm show @types/node@^22 version --json | jq '.[-1]'").toString();
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could generalise a bit:

Suggested change
export const getNode22TypesVersion = () =>
execSync("npm show @types/node@^22 version --json | jq '.[-1]'").toString();
export const getNodeTypesVersionForMajor = (major: number) =>
execSync(`npm show @types/node@^${major} version --json | jq '.[-1]'`).toString();

@@ -3,7 +3,7 @@ import { log } from '../../utils/logging';
import { nodeVersionMigration } from './nodeVersion';

const migrations: Record<string, () => Promise<void>> = {
node20: () => nodeVersionMigration(20),
node22: () => nodeVersionMigration(22),
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like it could be fine to keep 20 around just for purposes of people doing a 2-step upgrade? 🤷 maybe not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel we need to test how this behaves in a file structure, would the best way to do this be by utilising memfs?

{
id: 'package-json-2',
files: '**/package.json',
test: /("engines":\s*{[^}]*"node":\s*">=)(\d+)("[^}]*})(?![^}]*"skuba":\s*{[^}]*"type":\s*"package")/gm,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This regex is doing what checkSkubaType() does, thoughts on keeping both or just using the function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Node 22 support
3 participants