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 to Node.js >=22.12.0 #312

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

feat!: bump engines to Node.js >=22.12.0 #312

wants to merge 12 commits into from

Conversation

erickzhao
Copy link
Member

@erickzhao erickzhao commented Jan 11, 2025

BREAKING CHANGE: bumps minimum Node.js version to >=22.12.0

Dependency upgrades

Node.js 22.12 gives us the ability to use CommonJS require calls on ESM dependency graphs. This gives us the ability to upgrade got and env-paths past their last CJS version without using a dynamic await import, which isn't tenable in a few cases.

Removal of deprecated APIs

@electron/get already had a few deprecated APIs and this PR removes them since we're already making a breaking change anyways:

  • nightly_mirror option was removed (was deprecated in favour of nightlyMirror)
  • force option was removed (was deprecated in favour of cacheMode=WriteOnly).

Test migration from Jest to Vitest

Jest currently has issues with require(esm) while it works out of the box with Vitest. We were already looking to migrate to Vitest across other Ecosystem repos, so this PR just switches over.

  • Need to import functions from vitest (no globals)
  • jest.mock calls turned into vi calls
  • Regenerated snapshots

tsconfig.json changes

We're now basing our TypeScript config off of @tsconfig/node22, which is a bit different from what we had in the past.

  • skipLibCheck: true was added due to an incompatibility with got@14.
  • CJS compilation now updated to module: node16 and moduleResolution: node16.
  • ESM compilation kept at module: esnext and moduleResolution: node10.

See full git diff of output: erickzhao/get-diff-tester@8a04644

See tester code for output build: https://github.com/erickzhao/get-tester

d('* Replacing existing file');
await fs.remove(cachePath);

if (!fs.existsSync(path.dirname(cachePath))) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: this new clause is needed because fs.rename will fail if the target directory doesn't exist, while fs.move creates the directory.

This also doesn't work across disks, but we could catch the resulting error and fall back to an fs.copy call if necessary.

@erickzhao erickzhao marked this pull request as ready for review January 13, 2025 21:49
@erickzhao erickzhao requested a review from a team as a code owner January 13, 2025 21:49
package.json Outdated Show resolved Hide resolved
@erickzhao erickzhao requested a review from dsanders11 January 20, 2025 18:26
@erickzhao erickzhao changed the title feat!: bump engines to Node.js 22 feat!: bump engines to Node.js >=22.12.0 Jan 22, 2025
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.

2 participants