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

add engine-strict flag to npm install args #2965

Merged
merged 1 commit into from
Apr 29, 2021
Merged

Conversation

nileio
Copy link
Contributor

@nileio nileio commented Apr 28, 2021

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

This PR adds --engine-strict flag to the npm install command for installing custom nodes. This flag ensures that if a specific nodejs version is included under engines section in package.json the npm install command will fail if it does not satisfy the nodejs version requirements rather than only generate a warning message.
to use this feature , a node developer adds an engines section in package.json and specify the version requirements such as
{ "engines" : { "node" : ">=0.11.15" } }

This is tested to check for a specific nodejs version. This could possibly be extended to also stipulate a minimum node-red version which will be very useful to ensure that end users are not installing any incompatible nodes which will prevent node-red to load in some cases [however, using this flag to check for node-red version is not tested]

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run grunt to verify the unit tests pass
    running grunt failed at 1) externalModules api checkFlowDependencies: I don't know whether the change caused grunt to fail or is it something else?! first PR so I am not sure whether I need to update the unit test or not. Please let me know
  • I have added suitable unit tests to cover the new/changed functionality

@knolleary
Copy link
Member

Given the failing unit tests are in the corresponding file to one you've modified, then yes, that needs investigating.

I can take a look tomorrow before we merge this.

@knolleary knolleary merged commit 676f790 into node-red:dev Apr 29, 2021
@knolleary
Copy link
Member

Found the issue - the externalModules tests use the module name passed to npm install in order to verify different behaviours. The test assume the module name was the 3rd argument passed in - but --engine-strict added, its now the 4th argument.

I've fixed the tests to look at the last argument so it doesn't cause problems again if we add other default args.

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.

None yet

2 participants