Skip to content

build: use node 22 to build osmo-x API #424

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

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

kshitij-k-osmosys
Copy link
Contributor

@kshitij-k-osmosys kshitij-k-osmosys commented May 12, 2025

API PR Checklist

Task Link

Osmosys Developers must include the Pinestem task link in the PR.

OSXT-315

Pre-requisites

  • I have gone through the Contributing guidelines for Submitting a Pull Request (PR) and ensured that this is not a duplicate PR.
  • I have performed unit testing for the new feature added or updated to ensure the new features added are working as expected.
  • I have added/updated test cases to the test suite as applicable.
  • I have performed preliminary testing using the test suite to ensure that any existing features are not impacted and any new features are working as expected as a whole.
  • I have added/updated the required api docs as applicable.
  • I have added/updated the .env.example file with the required values as applicable.

PR Details

PR details have been updated as per the given format (see below)

  • PR title adheres to the format specified in guidelines (e.g., feat: add admin login endpoint)
  • Description has been added
  • Related changes have been added (optional)
  • Screenshots have been added (optional)
  • Query request and response examples have been added (as applicable, in case added or updated)
  • Documentation changes have been listed (as applicable)
  • Test suite/unit testing output is added (as applicable)
  • Pending actions have been added (optional)
  • Any other additional notes have been added (optional)

Additional Information

  • Appropriate label(s) have been added (ready for review should be added if the PR is ready to be reviewed)
  • Assignee(s) and reviewer(s) have been added (optional)

Note: Reviewer should ensure that the checklist and description have been populated and followed correctly, and the PR should be merged only after resolving all conversations and verifying that CI checks pass.


Description:

Update the OsmoX API to be compatible with and run on Node.js version 22

Related changes:

  • Delete node_modules and package-lock.json
  • Update package.json node engine to node 22
  • Install node 22 binary using nvm
  • Switch to node 22
  • Run npm install
  • Update Dockerfile to use node 22 image
  • Build API solution container and test out feature

Screenshots:

image

Summary by CodeRabbit

  • Chores
    • Updated the required Node.js version from 20.x to 22.x across the application, including Docker configuration, documentation, package settings, and CI workflows.
  • Documentation
    • Revised setup and prerequisite instructions to reflect the new minimum Node.js version (22.x) in all relevant guides.
    • Updated Docker command references for running database migrations to specify the exact API container name.

Copy link

coderabbitai bot commented May 12, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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

Walkthrough

The changes update the required Node.js version from 20.x to 22.x across the API application's Dockerfile, documentation, and package configuration. All references, instructions, and engine constraints now specify Node.js 22.x as the minimum version. No other modifications were made to code, dependencies, or setup procedures.

Changes

Files/Paths Change Summary
apps/api/Dockerfile Updated base Docker image from Node.js 20 to Node.js 22.
apps/api/package.json Changed Node.js engine requirement from "20.x" to "22.x"; updated @types/node dev dependency version accordingly.
apps/api/docs/api-test-cases.md
apps/api/docs/development-setup.md
apps/api/docs/production-setup.md
Updated documentation to require Node.js 22.x instead of 20.x; adjusted NVM instructions accordingly; refined Docker migration command in production setup.
.github/workflows/backend.yml Updated Node.js version from 20 to 22 in lint and build jobs.

Suggested labels

documentation

Suggested reviewers

  • xixas

Poem

A hop and a leap, we upgrade our stack,
Node twenty-two is here—there’s no turning back!
The docs and the Docker now sing the same tune,
Our engines are ready, we launch to the moon.
With every new version, our code hops ahead—
A rabbit’s delight, on Node.js we’re fed! 🐇✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@kshitij-k-osmosys kshitij-k-osmosys added dependencies Pull requests that update a dependency file ready for review labels May 12, 2025
@kshitij-k-osmosys kshitij-k-osmosys marked this pull request as ready for review May 12, 2025 07:48
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: 1

🧹 Nitpick comments (3)
apps/api/Dockerfile (1)

1-2: Correctly updated base image to Node.js 22.
The Dockerfile now uses node:22 as the base image, aligning with the PR objective to upgrade the runtime environment.
Optionally, to reduce image size and attack surface, consider switching to node:22-alpine or adopting a multi-stage build (separate build and runtime stages). Also, please confirm that the updated package-lock.json is committed—npm ci requires it to install production dependencies reliably.

apps/api/docs/production-setup.md (1)

10-10: Inconsistent list-item formatting for Node.js prerequisite.
Other items use a colon after the bold term. Consider updating to:

- **Node.js:** v22.x or higher

for consistency across the prerequisites.

apps/api/docs/development-setup.md (1)

10-10: Refine Node.js prerequisite sentence for clarity and style.
Combine into a single statement, add a colon, and reduce repetition. For example:

- - **Node.js** Node.js v22.x or higher. Can be installed via `nvm install 22` and used with `nvm use 22`.
+ - **Node.js:** v22.x or higher (install via `nvm install 22` and switch with `nvm use 22`).
🧰 Tools
🪛 LanguageTool

[style] ~10-~10: To form a complete sentence, be sure to include a subject.
Context: ... - Node.js Node.js v22.x or higher. Can be installed via nvm using `nvm insta...

(MISSING_IT_THERE)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c3d658 and f6f72ee.

⛔ Files ignored due to path filters (1)
  • apps/api/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • apps/api/Dockerfile (1 hunks)
  • apps/api/docs/api-test-cases.md (1 hunks)
  • apps/api/docs/development-setup.md (1 hunks)
  • apps/api/docs/production-setup.md (1 hunks)
  • apps/api/package.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
apps/api/docs/development-setup.md

[style] ~10-~10: To form a complete sentence, be sure to include a subject.
Context: ... - Node.js Node.js v22.x or higher. Can be installed via nvm using `nvm insta...

(MISSING_IT_THERE)

🔇 Additional comments (1)
apps/api/docs/api-test-cases.md (1)

10-10: Updated prerequisite Node.js version to v22.x.
This change aligns the test-case documentation with the new engine requirement in package.json and the Dockerbase image.

@@ -5,7 +5,7 @@
"author": "Osmosys Software Solutions Private Limited",
"license": "MIT",
"engines": {
"node": "20.x"
"node": "22.x"
Copy link

@coderabbitai coderabbitai bot May 12, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Update Node.js engine and align type definitions.
The engines.node field has been correctly set to "22.x". However, the @types/node dev dependency is still pinned to ^20.14.10, which may lead to mismatches in type definitions. Please bump it to a ^22.x version. Additionally, verify that your CI workflows (e.g., in .github/workflows) are updated to use Node.js v22.x.

Example diff:

 "devDependencies": {
-    "@types/node": "^20.14.10",
+    "@types/node": "^22.0.0",
     // ...
 }

🏁 Script executed:

#!/bin/bash
set -e

# Locate the package.json using Node.js 22.x engine
pkg=$(grep -RIl '"node": *"22.x"' .)
echo "Found package.json at: $pkg"
echo
echo "----- engines section -----"
grep -n -A2 '"engines"' "$pkg"
echo
echo "----- devDependencies section -----"
grep -n -A10 '"devDependencies"' "$pkg"
echo
echo "----- Checking CI workflows for Node version -----"
workflow_files=$(grep -RIl '.github/workflows')
if [ -n "$workflow_files" ]; then
  for wf in $workflow_files; do
    echo "Workflow file: $wf"
    grep -n 'node-version' "$wf" || echo "  No explicit node-version setting in this workflow."
    grep -n 'actions/setup-node' "$wf" || true
    echo
  done
else
  echo "No workflow files found under .github/workflows"
fi

Length of output: 503


🏁 Script executed:

#!/bin/bash
set -e

file="apps/api/package.json"

echo "----- Engines section -----"
grep -n -C1 '"engines"' "$file"

echo
echo "----- @types/node in devDependencies -----"
grep -n '"@types/node"' "$file" || echo "No @types/node entry found in devDependencies"

echo
echo "----- Checking CI workflows for Node.js version -----"
for wf in .github/workflows/*.yml .github/workflows/*.yaml; do
  [ -f "$wf" ] || continue
  echo "Workflow file: $wf"
  grep -n 'node-version:' "$wf" || echo "  No 'node-version:' setting"
  grep -n 'actions/setup-node' "$wf" || echo "  No 'actions/setup-node' usage"
  echo
done

Length of output: 2031


Update Node.js engine, bump types, and sync CI workflows to v22.x
Your apps/api/package.json already declares "node": "22.x", but we need to align the dev types and CI:

• In apps/api/package.json – bump the Node.js types:

 "devDependencies": {
-    "@types/node": "^20.14.10",
+    "@types/node": "^22.0.0",
     // …
 }

• In .github/workflows/backend.yml – update both node-version: '20'node-version: '22':

     uses: actions/setup-node@v3
     with:
-      node-version: '20'
+      node-version: '22'

• In .github/workflows/frontend.yml – update both node-version: '18'node-version: '22'.
• In .github/workflows/main.yml – if this workflow runs Node-based steps, add or update actions/setup-node@v3 with node-version: '22'.

After these changes, CI and local type checking will be consistent with Node.js 22.x.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"node": "22.x"
"devDependencies": {
- "@types/node": "^20.14.10",
+ "@types/node": "^22.0.0",
// …
}
Suggested change
"node": "22.x"
uses: actions/setup-node@v3
with:
- node-version: '20'
+ node-version: '22'
Suggested change
"node": "22.x"
uses: actions/setup-node@v3
with:
- node-version: '18'
+ node-version: '22'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Update typescript d46c53a
Update CI 3d92643

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if the @types/node has been updated to a version compatible with Node.js 22
echo "Checking package.json for @types/node version:"
grep -n '"@types/node"' apps/api/package.json || echo "No @types/node entry found"

echo -e "\nChecking CI workflows for Node.js version:"
for wf in .github/workflows/*.yml .github/workflows/*.yaml; do
  if [ -f "$wf" ]; then
    echo "Workflow file: $wf"
    grep -n 'node-version' "$wf" || echo "  No explicit node-version setting in this workflow."
    grep -n 'actions/setup-node' "$wf" || true
    echo
  fi
done

# Let's also check the git commits referenced by the user
echo -e "\nChecking git commits:"
git show --name-only --oneline d46c53a51c79a59414109093b6c459949a7dbe0f || echo "Cannot find typescript update commit"
echo
git show --name-only --oneline 3d926434df0140ef0ae659f165a6fcc5bd024381 || echo "Cannot find CI update commit"

Length of output: 17493


@kshitij-k-osmosys Thank you for implementing the changes! I've verified that:

  1. ✅ You've updated the @types/node to ^22.0.0 in package.json
  2. ✅ Backend workflows now use Node.js 22 as recommended

I noticed the frontend workflow still uses Node.js 18:

Workflow file: .github/workflows/frontend.yml
18:          node-version: '18'
37:          node-version: '18'

Was keeping the frontend on Node.js 18 intentional? If you'd like to update it to Node.js 22 as well, you'll need to modify those lines in the frontend.yml file.


If you found this review helpful, would you consider giving us a shout-out on X?

Thank you for using CodeRabbit!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can do in later PR

Copy link

Choose a reason for hiding this comment

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

@kshitij-k-osmosys Understood! Updating the frontend workflow to Node.js 22 in a later PR makes sense. The current changes successfully fulfill this PR's objective of making the OsmoX API compatible with Node.js 22. Would you like me to create an issue to track the frontend workflow update for future reference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in #430

Copy link

Choose a reason for hiding this comment

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

@kshitij-k-osmosys Perfect! Thank you for taking care of the frontend workflow update in PR #430. Now the entire project is consistently using Node.js 22 across all workflows. Great work on keeping everything aligned!

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

🧹 Nitpick comments (2)
.github/workflows/backend.yml (2)

19-19: Bump Node.js version to 22 for lint job
This aligns the workflow with your package.json engine requirement. Consider using a more specific semver range (e.g., '22.x') to automatically pick up patch releases.


38-38: Bump Node.js version to 22 for build job
Consistent with the lint step and your Dockerfile. Again, you may opt for '22.x' to include future patches automatically.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d46c53a and 3d92643.

📒 Files selected for processing (1)
  • .github/workflows/backend.yml (2 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/backend.yml

14-14: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


17-17: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


33-33: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)


36-36: the runner of "actions/setup-node@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🔇 Additional comments (2)
.github/workflows/backend.yml (2)

11-11: Skip whitespace/formatting-only change
No functional change at this line.


30-30: Skip whitespace/formatting-only change
No functional change at this line.

@kshitij-k-osmosys kshitij-k-osmosys changed the title build: update the OsmoX API to be compatible with and run on Node.js version 22 build: use node 22 to build osmo-x API May 12, 2025
@kshitij-k-osmosys kshitij-k-osmosys added the enhancement New feature or request label May 12, 2025
@kshitij-k-osmosys kshitij-k-osmosys marked this pull request as draft May 13, 2025 12:59
@kshitij-k-osmosys kshitij-k-osmosys added bug Something isn't working and removed ready for review labels May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant