chore: update dependencies and refactor code for compatibility#2495
Merged
chore: update dependencies and refactor code for compatibility#2495
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request modernizes the codebase by updating ESM dependencies to their latest versions and refactoring code for compatibility with Node.js's support for using require() on synchronous ES modules. The update required changes to TypeScript configuration, Jest setup, and the replacement of the xdg-basedir dependency with a custom utility.
Key changes include:
- Updated multiple ESM dependencies including chalk, configstore, node-fetch, and xml2js to their latest versions
- Replaced
xdg-basedirdependency with a customxdg-datautility function for better testability - Standardized test setup across all end-to-end tests to use direct environment variable manipulation
Reviewed Changes
Copilot reviewed 26 out of 29 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib/xdg-data.ts | New utility function replacing xdg-basedir functionality |
| src/lib/search-and-replace.ts | Updated chalk import from named to default import |
| src/lib/dev-environment/dev-environment-lando.ts | Replaced xdg-basedir with custom xdg-data utility |
| src/lib/dev-environment/dev-environment-core.ts | Replaced xdg-basedir with custom xdg-data utility and removed helper function |
| src/lib/client-file-uploader.ts | Updated node-fetch type import for compatibility |
| src/lib/cli/exit.ts | Updated chalk import from named to default import |
| src/lib/backup-storage-availability/backup-storage-availability.ts | Replaced xdg-basedir with custom xdg-data utility |
| package.json | Updated dependency versions and removed xdg-basedir |
| tests/lib/dev-environment/env-vars.spec.js | Updated test to use new xdg-data utility |
| tests/lib/dev-environment/dev-environment-core.js | Refactored tests to use environment variables instead of mocking xdg-basedir |
| tests/lib/analytics/clients/tracks.js | Fixed test assertion for user-agent header format |
| tests/devenv-e2e/jest/jest.config.js | Added transformIgnorePatterns configuration for ESM support |
| tests/devenv-e2e/*.spec.js | Standardized test setup to use XDG_DATA_HOME environment variable |
| .github/workflows/ci.yml | Changed CI strategy to continue on failure |
Member
Author
|
/changelog |
Contributor
AI-Generated Changelog Entry
|
- Updated @types/configstore from 5.0.1 to ^6.0.2 - Updated chalk from 4.1.2 to ^5.5.0 - Updated configstore from 5.0.1 to ^7.0.0 - Updated node-fetch from ^2.6.1 to ^3.3.2 - Updated xml2js from ^0.5.0 to ^0.6.2 - Replaced xdg-basedir with custom xdgData function for better compatibility - Refactored exit.ts and search-and-replace.ts to use updated chalk import - Updated type imports in client-file-uploader.ts for node-fetch - Changed TypeScript module and resolution settings to nodenext for better module handling
Updated the CI configuration to allow all test jobs to run, even if one fails. This change aims to improve feedback during the testing process by providing results for all configurations.
Removed unnecessary checks and streamlined the `xdgData` function to always return a string. This change enhances code clarity and ensures consistent return types.
08fdca4 to
b129cef
Compare
|
rinatkhaziev
approved these changes
Aug 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This pull request updates ESM dependencies to their latest versions. This was possible because Node.js now supports using
require()on synchronous ES modules.The update required some other changes:
NodeNext;transformIgnorePatternshad to be explicitly cleared. This increased memory consumption and test execution time (by roughly 4%), but allowed us to use ESM dependencies. The alternative was to mention every ESM package (including transitive dependencies), but that does not scale.xdg-basedirwas replaced with a small function that does the same but is more testable. Mocking ESM in Jest is a huge pain.Key changes include:
Testing environment improvements:
All end-to-end test files in
__tests__/devenv-e2e/00*-*.spec.jsnow setprocess.env.XDG_DATA_HOMEdirectly instead of modifying or mockingxdg-basedir.data, simplifying and standardizing test setup. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19] [20] [21] [22] [23] [24] [25] [26]In
__tests__/lib/dev-environment/dev-environment-core.js, replaces thexdg-basedirmock with direct manipulation ofprocess.env.XDG_DATA_HOME, and updates tests to use the localxdg-datautility. Updates test cases to reflect this change and to mock the new utility when testing error cases. [1] [2] [3] [4]Updates
__tests__/lib/dev-environment/env-vars.spec.jsto use the newxdg-datautility instead ofxdg-basedirfor environment file path resolution. [1] [2]Dependency updates:
@types/configstorefrom 5.0.1 to ^6.0.2chalkfrom 4.1.2 to ^5.5.0configstorefrom 5.0.1 to ^7.0.0node-fetchfrom ^2.6.1 to ^3.3.2xml2jsfrom ^0.5.0 to ^0.6.2Other test fixes:
__tests__/lib/analytics/clients/tracks.jsto expect the correct format for theuser-agentheader.