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: Bump Node version, npm audit fix #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

khvn26
Copy link
Member

@khvn26 khvn26 commented Oct 9, 2024

This will fix the publish failure. Tested locally.

@@ -1,7 +1,7 @@
{
"name": "@flagsmith/serverless-plugin-canary-deployments",
"engines": {
"node": ">=4.0"
"node": ">=18.0"
Copy link
Member

Choose a reason for hiding this comment

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

I'm guessing this is the error you're talking about: https://github.com/Flagsmith/serverless-plugin-canary-deployments/actions/runs/11251575359/job/31282960668

If so, we might be able to get away with not updating the required Node version by installing the latest npm in CI, instead of upgrading both Node and npm together.

Something like npm i -g npm@latest in CI after Node is set up? That way we can avoid introducing a technically-breaking change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Something like npm i -g npm@latest in CI after Node is set up?

The question is why doesn't the action install latest NPM straight away. My guess was that NPM dropped support for Node below LTS, but I didn't confirm it, to be honest.

Bumping NPM manually in CI does seem ugly considering the setup-node action is expected to provide the latest possible version out of the box. That being said, I believe only the .nvmrc change actually affects the error in CI; the engine version bump happened to freshen up dependencies and alleviate NPM's audit warnings.

I do agree that depending on node >=18.0 is a bit radical, considering that serverless' current constraint is >=12.0. I think we could loosen the constraint to match the serverless one. I definitely don't want to keep the >=4.0 one to avoid outdated dependencies.

Copy link
Member

Choose a reason for hiding this comment

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

The question is why doesn't the action install latest NPM straight away

Node.js always comes bundled with NPM at a specific version - the latest NPM is never installed automatically. In the action logs you can see the actual Node 14 dependency that is downloaded (https://github.com/actions/node-versions/releases/download/14.21.3-4202774076/node-14.21.3-linux-x64.tar.gz). This tarball contains NPM 6.14.18.

I'm fairly sure we could fix this issue by only adding npm install npm@latest in CI and not changing anything else, though I've not tested it.

@matthewelwell matthewelwell removed their request for review October 23, 2024 09:55
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.

2 participants