Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Fix node version check to match against package
Browse files Browse the repository at this point in the history
Fixes #104
  • Loading branch information
voxpelli committed Jul 29, 2019
1 parent 01271e9 commit c8fca5d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

'use strict'

if (process.version.match(/^v(\d+)\./)[1] < 6) {
console.error('dependency-check: Node 6 or greater is required. `dependency-check` did not run.')
const requiredNodeEngineMinimum = parseInt(require('./package.json').engines.node.match(/^>=(\d+)\./)[1], 10)
const currentNodeEngine = parseInt(process.version.match(/^v(\d+)\./)[1], 10)

if (currentNodeEngine < requiredNodeEngineMinimum) {
console.error('dependency-check: Node ' + requiredNodeEngineMinimum + ' or greater is required. `dependency-check` did not run.')
process.exit(0)
}

Expand Down

0 comments on commit c8fca5d

Please sign in to comment.