fix: Upgrade storage dependencies to corresponding Node 22 versions for core, handwritten and generated libraries - #9135
Conversation
919b1a1 to
eb1bfa8
Compare
There was a problem hiding this comment.
Code Review
This pull request updates dependency versions across various packages, including updates to google-gax, gapic-tools, and other related dependencies, while also standardizing the minimum Node.js version to 18. Additionally, a one-off script upgrade_storage.cjs was introduced to automate these dependency updates. The review feedback suggests either removing this script if it is a one-time utility or moving it to a dedicated scripts/ directory with proper documentation. Furthermore, it is recommended to use the semver package for more robust version parsing instead of manual regex-based comparison in the script.
I am having trouble creating individual review comments. Click here to see my feedback.
upgrade_storage.cjs (1-87)
This script appears to be a one-off utility for upgrading dependencies. Committing such scripts can add clutter to the repository if they are not intended for regular use.
- If this was for a one-time upgrade, please consider removing it from the pull request. The changes it generated are already included.
- If this is a tool that will be used again, it would be more maintainable to place it in a dedicated
scripts/ortools/directory and add documentation explaining its purpose and usage.
upgrade_storage.cjs (66-70)
Using regular expressions to parse and compare semantic versions can be brittle, as it may not handle all valid semver ranges correctly (e.g., >1.0.0, 1.x.x).
For more robust version parsing and comparison, I recommend using the semver package.
For example:
const semver = require('semver');
// ...
if (latestVer && semver.valid(semver.coerce(latestVer)) && semver.validRange(ver)) {
const currentMajor = semver.minVersion(ver).major;
const latestMajor = semver.coerce(latestVer).major;
if (latestMajor > currentMajor) {
// ... your update logic
}
}This would make the script more reliable against different version string formats.
Description
https://github.com/googleapis/google-cloud-node/pull/9079/changes upgrades storage to node v22, but this pull request upgrades the dependencies for this library as well so that they correspond to the latest Node 22 versions of their corresponding libraries.
We didn't upgrade gaxios and auth because doing so introduces compiler errors. We should address upgrading them separately.
Impact
Ensures the library will receive the latest patches because the dependencies are on the latest major version.