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

feat!: bump engines requirement to Node 22 #222

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

erickzhao
Copy link
Member

@erickzhao erickzhao commented Jan 10, 2025

BREAKING CHANGE: bumps required Node.js version to >=22.0.0

Require Test (20.9) to be removed as a required CI check.

BREAKING CHANGE: bumps required Node.js version to >=22.0.0
@electron electron deleted a comment from notion-workspace bot Jan 10, 2025
Copy link
Member

@MarshallOfSound MarshallOfSound left a comment

Choose a reason for hiding this comment

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

Not a chore, please mark as feat to ensure semantic release works

@erickzhao erickzhao changed the title chore!: bump engines requirement to Node 22 feat!: bump engines requirement to Node 22 Jan 10, 2025
@erickzhao erickzhao marked this pull request as ready for review January 10, 2025 21:14
@erickzhao erickzhao requested a review from a team as a code owner January 10, 2025 21:14
Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

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

One other question, but this looks good 👍 If we're ready to merge, I can remove the Node 20 CI required check 😄

src/helpers.ts Outdated
throw err;
}
d('work succeeded');
await fs.remove(dir);
await fs.rm(dir, { recursive: true });
Copy link
Member

Choose a reason for hiding this comment

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

Just checking my assumptions here, but we had to add the recursive option here due to a behavior change when we moved from fs-extra to Node's fs?

Copy link
Member

Choose a reason for hiding this comment

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

Yup. It's not very explicitly documented but fs-extra's remove is recursive while Node's fs is not by default.

If we look at the latest fs-extra code for remove we can see it's just calling through to fs.rm(path, { recursive: true, force: true }) (it's technically using graceful-fs, but looks like that library just passes through fs.rm as-is - yay layers of abstraction).

But this is a good callout, because I think to ensure there's no regression in behavior here we need to add the force: true option. Adding suggestions to do so.

Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping force: true makes things easier for migration purposes, but might just be masking an erroneous call if some folder never exists?

For example, I was running into a case in @electron/get where we were always attempting to delete a folder path that didn't exist.

Copy link
Member

Choose a reason for hiding this comment

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

Fair point. I think for migration purposes we should strive for no intentional behavior change, and then we can follow-up with that change after?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I think removing force calls after the fact could be a good-first-issue since the acceptance criteria is pretty clear!

src/helpers.ts Outdated Show resolved Hide resolved
src/helpers.ts Outdated Show resolved Hide resolved
src/helpers.ts Outdated
throw err;
}
d('work succeeded');
await fs.remove(dir);
await fs.rm(dir, { recursive: true });
Copy link
Member

Choose a reason for hiding this comment

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

Yup. It's not very explicitly documented but fs-extra's remove is recursive while Node's fs is not by default.

If we look at the latest fs-extra code for remove we can see it's just calling through to fs.rm(path, { recursive: true, force: true }) (it's technically using graceful-fs, but looks like that library just passes through fs.rm as-is - yay layers of abstraction).

But this is a good callout, because I think to ensure there's no regression in behavior here we need to add the force: true option. Adding suggestions to do so.

- '18.17'
- '16.20'
- '14.16'
- '22.13'
Copy link
Member

Choose a reason for hiding this comment

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

Something I've thought about in the past (and I feel like @BlackHole1 has pointed this out before), is we should probably explicitly test our lower bound Node.js version to ensure we remain compatible with it. It's extra CI runs, but since we just reduced the matrix here we'll still have a net reduction if we add back '20.0.0' to the matrix.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean the lower bound being 22.0.0 (minimum engines value)?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, typo on my part. 🙁

@dsanders11
Copy link
Member

Not a chore, please mark as feat to ensure semantic release works

@erickzhao, could you also change the commit message just to be sure? Some of these repos aren't configured to default to the PR title and we've accidentally merged in the past where it grabs the first commit message instead of the title.

.nvmrc Outdated
@@ -0,0 +1 @@
22.13.0
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
22.13.0
22.13.0

From the nvm readme:

The contents of a .nvmrc file must contain precisely one <version> (as described by nvm --help) followed by a newline.

nvm install works fine for me without the newline, but we do have it in all other project files anyway 🤷‍♂️

Also a question: shouldn't this version match the one in the engines field? We're saying we support 22.0.0 as the minimum version, but nvm users working on this project will be using 22.13.0 so they could end up adding code that doesn't work on 22.0.0 and not noticing it.

I think this is a similar point to @dsanders11's on test.yml about testing the lowest supported version - we should pick one of 22.0.0 / 22.13.0 and use it everywhere.

Copy link
Member Author

@erickzhao erickzhao Jan 13, 2025

Choose a reason for hiding this comment

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

I like the idea of having it on the lower bound so that we ensure that development happens on the minimum engines version. :)

I guess the one thing is that leaving it running on the lower bound in theory would leave us open to running insecure Node.js versions (e.g. if 22.x.y contains a vulnerability patch, we should probably be running >=22.x.y in development).

erickzhao and others added 4 commits January 13, 2025 13:23
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.

5 participants