Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dthampy
Copy link
Contributor

@dthampy dthampy commented Apr 12, 2025

Description

Checks for node major version greater than 22 and displays a warning message when a non supported node version is detected

Related Issue

725

Motivation and Contex

How Has This Been Tested?

npm link your project locally
Run any aio command. For example: aio --version or aio app

Screenshots (if appropriate):

Screenshot 2025-04-11 at 7 33 58 PM

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (4f7ad4f) to head (fdf63fc).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #744   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          238       243    +5     
  Branches        48        49    +1     
=========================================
+ Hits           238       243    +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

pru55e11
pru55e11 previously approved these changes Apr 15, 2025
Copy link

@pru55e11 pru55e11 left a comment

Choose a reason for hiding this comment

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

LGTM

@pru55e11
Copy link

@purplecabbage what are your thoughts on placing this check here? Also, do we want a more generic error message that maybe links to the docs about supported version so this file doesn't become a dependency that needs to get updated every year when we add support for the next version?

@pru55e11 pru55e11 dismissed their stale review April 15, 2025 17:10

let's discuss with Jesse and I'll re-review after

@dthampy
Copy link
Contributor Author

dthampy commented Apr 15, 2025

Would love to get some feedback on the verbiage used here. I couldn't find devdocs that point to supported node versions, hence added the link to nvm documentation.
The reason(s) why the check was placed there
(i) By adding the check in src/index.js, we can make sure it runs at the earliest possible stage of CLI execution before any commands are processed
(ii) Also I thought that by placing it in the run method allows the execution to continue while creating a non-intrusive warning to the users

@purplecabbage
Copy link
Member

This is good, I would avoid using the term Adobe I/O anywhere new as we have sort of abandoned it ( even though it IS the aio cli ... )
It might be easiest to just cut it off with "... which is not officially supported." or "Warning: Node version ${nodeVersion} not supported."

@purplecabbage
Copy link
Member

@dthampy regarding your question about how best not to create future work
This might be an opportunity to be more specific with our supported node engines in package.json

"engines": {
  "node": "^18 || ^21 || ^22"
},

Then instead of looking just for >22 you could do:

const nodeVersion = process.version
if (!semver.satisfies(nodeVersion, config.pjson.engines.node)) {
  // output warning
}

@dthampy
Copy link
Contributor Author

dthampy commented Apr 15, 2025

@pru55e11 @purplecabbage
Simplified the warning to just show the relevant text.
Also now using the Config object to take care of reading and parsing the package.json file. Updated the unit tests as well

Screenshot 2025-04-15 at 4 32 17 PM

Copy link

@pru55e11 pru55e11 left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks @dthampy


// Check Node.js version
const nodeVersion = process.version
if (!semver.satisfies(nodeVersion, config.pjson.engines.node)) {
Copy link
Member

Choose a reason for hiding this comment

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

Is it too geeky to output this?
Supported versions are ${config.pjson.engines.node}.
Then we would just have to update package.json and not look at this again :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about that. But wasn't sure if its ok to show the versions from package json. Made the change though
Screenshot 2025-04-15 at 6 58 24 PM

@dthampy dthampy merged commit 504f519 into master Apr 16, 2025
8 checks passed
@dthampy dthampy deleted the bugfix/ACNA-3561 branch April 16, 2025 14:10
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.

4 participants