-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe 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
Suggested labels
Suggested reviewers
Poem
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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 usesnode: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 tonode:22-alpine
or adopting a multi-stage build (separate build and runtime stages). Also, please confirm that the updatedpackage-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 higherfor 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 vianvm
using `nvm insta...(MISSING_IT_THERE)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ 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 inpackage.json
and the Dockerbase image.
@@ -5,7 +5,7 @@ | |||
"author": "Osmosys Software Solutions Private Limited", | |||
"license": "MIT", | |||
"engines": { | |||
"node": "20.x" | |||
"node": "22.x" |
There was a problem hiding this comment.
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.
"node": "22.x" | |
"devDependencies": { | |
- "@types/node": "^20.14.10", | |
+ "@types/node": "^22.0.0", | |
// … | |
} |
"node": "22.x" | |
uses: actions/setup-node@v3 | |
with: | |
- node-version: '20' | |
+ node-version: '22' |
"node": "22.x" | |
uses: actions/setup-node@v3 | |
with: | |
- node-version: '18' | |
+ node-version: '22' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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:
- ✅ You've updated the
@types/node
to^22.0.0
in package.json - ✅ 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!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #430
There was a problem hiding this comment.
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!
There was a problem hiding this 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
📒 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.
API PR Checklist
Task Link
Osmosys Developers must include the Pinestem task link in the PR.
OSXT-315
Pre-requisites
.env.example
file with the required values as applicable.PR Details
PR details have been updated as per the given format (see below)
feat: add admin login endpoint
)Additional Information
ready for review
should be added if the PR is ready to be reviewed)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:
Screenshots:
Summary by CodeRabbit