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: add node v22 and npm v10 support #2695

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

feat: add node v22 and npm v10 support #2695

wants to merge 21 commits into from

Conversation

mvadari
Copy link
Collaborator

@mvadari mvadari commented May 15, 2024

High Level Overview of Change

This PR adds CI for Node 22 and updates all the actions to the latest versions. It also adds support for npm v10.

Context of Change

node v22 was just released

Type of Change

  • Tests (You added tests for code that already exists, or your new feature included in this PR)

Test Plan

CI should pass with node 22.

@mvadari
Copy link
Collaborator Author

mvadari commented May 15, 2024

This works locally, and in a Linux docker container, but not in CI for some reason.....

@mvadari
Copy link
Collaborator Author

mvadari commented May 15, 2024

This is likely related: nodejs/node#52797

@justinr1234
Copy link
Collaborator

@CodeRabbit full review

@justinr1234
Copy link
Collaborator

@coderabbitai full review

Copy link

coderabbitai bot commented Sep 19, 2024

Actions performed

Full review triggered.

Copy link

coderabbitai bot commented Sep 19, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes involve updates to the CI/CD workflow configuration and package definitions. The Node.js and npm versions in the CI/CD pipeline have been upgraded, expanding the Node.js version matrix and updating the npm version. Additionally, the package.json files for certain packages have been modified to reflect these version changes, including a more verbose build command in one package. These updates aim to enhance compatibility and improve the build process.

Changes

File(s) Change Summary
.github/workflows/nodejs.yml Updated Node.js version matrix to include 22.x, upgraded npm from 9 to 10, and reiterated caching.
package.json Updated npm version constraint from >=7.10.0 < 10.0.0 to >=7.10.0.
packages/ripple-keypairs/package.json Modified build script to include --verbose flag for enhanced output during TypeScript compilation.

Suggested reviewers

  • khancode
  • justinr1234

Poem

🐰 In the garden where code does grow,
New versions sprout, putting on a show.
With npm ten and Node twenty-two,
Our builds are bright, and the tests are too!
Hopping along, let the changes ring,
A joyful leap for the code we bring! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mvadari
Copy link
Collaborator Author

mvadari commented Sep 19, 2024

@coderabbitai full review

Copy link

coderabbitai bot commented Sep 19, 2024

Actions performed

Full review triggered.

@mvadari mvadari marked this pull request as ready for review October 11, 2024 17:43
@mvadari
Copy link
Collaborator Author

mvadari commented Oct 11, 2024

This is likely related: nodejs/node#52797

Update: this problem has been fixed, and seems to have been fixed in every minor version of Node 22 (I didn't check all the patch versions). So anyone running into this issue should just upgrade their Node 22 version.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
package.json (1)

68-68: Approved, but consider a more controlled version range.

The removal of the upper limit for the npm version (>=7.10.0) allows for greater flexibility and easier adoption of newer npm versions. This change aligns with the PR objective of adding Node 22 support.

However, to maintain better control over the development environment and reduce the risk of compatibility issues, consider using a more specific version range. For example:

"npm": ">=7.10.0 <11.0.0"

This approach would allow for a wider range of npm versions while still providing an upper bound to prevent potential breaking changes from future major releases.

.github/workflows/nodejs.yml (4)

62-62: LGTM: Adding Node.js 22.x to the test matrix

The addition of Node.js 22.x to the test matrix aligns perfectly with the PR objective to add Node 22 support. This ensures that unit tests are run across all supported Node.js versions, including the latest LTS versions and the newest release.

Consider adding a comment explaining the Node.js version selection strategy, e.g.:

node-version: [18.x, 20.x, 22.x] # Latest LTS versions and current release

This will help future maintainers understand the reasoning behind the version selection.


71-73: LGTM: Consistent npm version update

The addition of npm version 10 setup in the "unit" job is consistent with the previous update in the "build-and-lint" job. This ensures that all jobs use the same npm version, which is a good practice for maintaining consistency across the workflow.

Consider creating a reusable workflow step for setting up npm version 10, as this setup is repeated across multiple jobs. This would improve maintainability and reduce duplication. For example:

jobs:
  setup-npm:
    runs-on: ubuntu-latest
    steps:
      - name: Setup npm version 10
        run: |
          npm i -g npm@10 --registry=https://registry.npmjs.org
    outputs:
      npm-path: ${{ steps.npm-path.outputs.path }}

  unit:
    needs: setup-npm
    steps:
      - uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
      - name: Use npm 10
        run: echo "${{ needs.setup-npm.outputs.npm-path }}" >> $GITHUB_PATH

This approach would allow you to reuse the npm setup across all jobs that require it.


204-204: LGTM: Comprehensive updates across all jobs

The changes in the "snippets" job complete the set of updates across all jobs in the workflow:

  1. Adding Node.js 22.x to the test matrix ensures that code snippets are tested on the latest Node.js version.
  2. Setting up npm version 10 maintains consistency with the npm version used in other jobs.

These final changes ensure that all aspects of the project (build, lint, unit tests, integration tests, and code snippets) are tested and run using the latest Node.js and npm versions.

With these changes, the workflow now comprehensively covers Node.js 22 support across all jobs. This update significantly improves the robustness of your CI process by ensuring compatibility with the latest Node.js version.

To further enhance the workflow:

  1. Consider adding a job to test with the minimum supported Node.js version to ensure backward compatibility.
  2. Implement the suggestions from previous comments to improve code reuse and documentation.
  3. Regularly review and update the Node.js version matrix to stay current with the latest LTS releases.

Also applies to: 213-215


Line range hint 1-240: Summary: Successful implementation of Node.js 22 support

This PR successfully achieves its primary objective of adding CI support for Node.js version 22. The changes made to the .github/workflows/nodejs.yml file are comprehensive and consistent, updating all relevant jobs to include Node.js 22.x in their test matrices and upgrading npm to version 10 throughout the workflow.

Key improvements:

  1. All jobs (build-and-lint, unit, integration, and snippets) now support Node.js 22.x.
  2. npm has been updated to version 10 across all jobs, ensuring consistency.
  3. The CI process now covers a wider range of Node.js versions (18.x, 20.x, and 22.x), improving the robustness of the testing suite.

These changes significantly enhance the CI/CD pipeline by ensuring compatibility with the latest Node.js version while maintaining support for previous LTS versions.

To further improve the workflow:

  1. Implement the suggested reusable workflow step for npm setup to reduce code duplication.
  2. Add comments explaining the Node.js version selection strategy for better maintainability.
  3. Consider adding a job to test with the minimum supported Node.js version for backward compatibility checks.
  4. Regularly review and update the Node.js version matrix to stay current with the latest LTS releases.

Overall, this PR successfully addresses the stated objectives and improves the project's CI process.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 210fc84 and 5aafe0b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • .github/workflows/nodejs.yml (8 hunks)
  • package.json (1 hunks)
🧰 Additional context used
📓 Learnings (1)
.github/workflows/nodejs.yml (1)
Learnt from: mvadari
PR: XRPLF/xrpl.js#2788
File: .github/workflows/nodejs.yml:25-25
Timestamp: 2024-09-26T21:14:56.813Z
Learning: In `.github/workflows/nodejs.yml`, the `build-and-lint` job's actions `actions/setup-node` and `actions/cache` are updated to `@v4`.
🔇 Additional comments (3)
package.json (1)

67-68: Verify Node 22 compatibility.

While the npm version constraint has been updated, there's no explicit mention of Node 22 support in the engines section. To ensure full compatibility with Node 22, consider updating the node version constraint as well.

Run the following script to check the current Node.js version support:

.github/workflows/nodejs.yml (2)

31-33: LGTM: Updating to npm version 10

The addition of npm version 10 setup is consistent with the PR objective to update to the latest versions. This change is appropriate for Node.js 18.x and above, and it uses the official npm registry, which is a good practice.


102-102: LGTM: Consistent updates for integration tests

The changes in the "integration" job are consistent with the updates made in previous jobs:

  1. Adding Node.js 22.x to the test matrix ensures that integration tests are run on the latest Node.js version.
  2. Setting up npm version 10 maintains consistency with the npm version used in other jobs.

These changes align well with the PR objective and ensure that integration tests are run with the latest Node.js and npm versions.

Please refer to the previous comments regarding:

  1. Adding a comment to explain the Node.js version selection strategy.
  2. Considering a reusable workflow step for setting up npm version 10 to reduce duplication across jobs.

Also applies to: 116-118

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
README.md (1)

28-28: LGTM! Consider a minor clarification.

The update to include Node.js v22 support aligns well with the PR objective. The information is clear and consistent with the rest of the document.

For slightly improved readability, you might consider adding "LTS" (Long Term Support) to v18 and v20, as these are the current LTS versions. This could help users understand which versions are recommended for production use. For example:

- + **[Node.js v18](https://nodejs.org/)** is recommended. We also support v20 and v22. Other versions may work but are not frequently tested.
+ + **[Node.js v18 LTS](https://nodejs.org/)** is recommended. We also support v20 LTS and v22. Other versions may work but are not frequently tested.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~28-~28: Possible missing comma found.
Context: ...ort v20 and v22. Other versions may work but are not frequently tested. ### Install...

(AI_HYDRA_LEO_MISSING_COMMA)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5aafe0b and 6995f3e.

📒 Files selected for processing (1)
  • README.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md

[uncategorized] ~28-~28: Possible missing comma found.
Context: ...ort v20 and v22. Other versions may work but are not frequently tested. ### Install...

(AI_HYDRA_LEO_MISSING_COMMA)

@mvadari mvadari changed the title feat: add node 22 support feat: add node v22 and npm v10 support Oct 15, 2024
@@ -65,6 +65,6 @@
],
"engines": {
"node": ">=18.0.0",
"npm": ">=7.10.0 < 10.0.0"
"npm": ">=7.10.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't the CI adhere to the minimum supported version of npm ? If users who use npm@v7 experience any problems with xrpl.js, we won't detect it since we are upgrading to npm@v10.

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.

3 participants