Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

check-node-version

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-node-version - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

4

CHANGELOG.md
## Releases
### 4.0.3
* Fix crash due to non-semver valid version strings
### 4.0.2

@@ -4,0 +8,0 @@

32

cli.js

@@ -118,19 +118,23 @@ "use strict";

function printInstalledVersion(name, info) {
if (info.version) {
const versionNote = name + ": " + chalk.bold(info.version);
if (info.isSatisfied) {
console.log(versionNote);
} else {
console.log(chalk.red(versionNote));
}
function printInstalledVersion(name, { version, isSatisfied, invalid, notfound }) {
let versionNote = "";
if (version) {
versionNote = name + ": " + chalk.bold(version);
}
if (info.notfound) {
if (info.isSatisfied) {
console.log(chalk.gray(name + ': not installed'));
} else {
console.error(chalk.red(name + ': not installed'));
}
if (invalid) {
versionNote = name + ": " + chalk.bold("given version not semver-compliant");
}
if (notfound) {
versionNote = name + ": not found";
}
if (isSatisfied) {
if (version) console.log(versionNote);
else console.log(chalk.gray(versionNote));
} else {
console.log(chalk.red(versionNote));
}
}

@@ -81,2 +81,7 @@ /**

/**
* Whether the program version string is non-compliant with semver.
*/
invalid?: boolean;
/**
* Retrieved version, if available.

@@ -83,0 +88,0 @@ */

@@ -134,3 +134,3 @@ "use strict";

const versions = mapValues(versionsResult, (_, name) => {
const versions = mapValues(versionsResult, ({ version, notfound, invalid }, name) => {
const programInfo = {

@@ -140,10 +140,14 @@ isSatisfied: true,

if (versionsResult[name].version) {
programInfo.version = semver(versionsResult[name].version);
if (version) {
programInfo.version = semver(version);
}
if (versionsResult[name].notfound) {
programInfo.notfound = versionsResult[name].notfound;
if (invalid) {
programInfo.invalid = invalid;
}
if (notfound) {
programInfo.notfound = notfound;
}
if (wanted[name]) {

@@ -157,2 +161,3 @@ programInfo.wanted = new semver.Range(wanted[name]);

}
return programInfo;

@@ -196,5 +201,13 @@ });

if (!execError) {
return callback(null, {
version: stdout,
});
const version = stdout.trim();
if (semver.valid(version)) {
return callback(null, {
version,
});
} else {
return callback(null, {
invalid: true,
})
}
}

@@ -201,0 +214,0 @@

{
"name": "check-node-version",
"version": "4.0.2",
"version": "4.0.3",
"engines": {

@@ -49,3 +49,3 @@ "node": ">=8.3.0"

"husky": "^3.1.0",
"npm": "3.10.10",
"npm": "6.13.4",
"npm-run-all": "^4.1.5",

@@ -52,0 +52,0 @@ "proxyquire": "^2.1.3"

@@ -125,6 +125,6 @@ <a name="check-node-version"></a>

$ check-node-version --print
yarn: not found
node: 11.12.0
npm: 6.9.0
npx: 10.2.0
yarn: not installed
$ $LASTEXITCODE

@@ -138,2 +138,15 @@ 0

> **NOTE:**
> As per [Issue 36](https://github.com/parshap/check-node-version/issues/36),
> non-semver-compliant versions (looking at yarn here) will be handled similarly to missing tools,
> just with a different error message.
>
> At the time of writing, we think that
> 1. all tools should always use semver
> 2. exceptions are bound too be very rare
> 3. preventing a crash is sufficient
>
> Consequently, we do not intend to support non-compliant versions to any further extent.
<a name="check-node-version-command-line-usage-examples-use-with-a-nvmrc-file"></a>

@@ -140,0 +153,0 @@ #### Use with a <code>.nvmrc</code> file

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc