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

homey

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

homey - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

@@ -16,2 +16,6 @@ 'use strict';

const fse = require('fs-extra');
const semver = require('semver');
const AppPlugin = require('../AppPlugin');

@@ -24,5 +28,22 @@

async run() {
await NpmCommands.install({ save: true }, {
const appJson = await fse.readJSON(this._app._appJsonPath);
if (appJson.sdk === 3) {
// Check if current homey-log version is lower than 2.0.0, in that case install ^2.0.0,
// otherwise just install homey-log as specified in package.json
const currentHomeyLogVersion = await NpmCommands.getPackageVersion('homey-log');
if (currentHomeyLogVersion && semver.lt(currentHomeyLogVersion, '2.0.0')){
return NpmCommands.install({ save: true }, {
id: 'homey-log',
version: '^2.0.0'
});
}
return NpmCommands.install({ save: true }, {
id: 'homey-log',
version: this._options.version,
});
}
return NpmCommands.install({ save: true }, {
id: 'homey-log',
version: this._options.version,
version: '1.0.6',
});

@@ -33,2 +54,2 @@ }

module.exports = AppPluginLog;
module.exports = AppPluginLog;

@@ -29,2 +29,16 @@ 'use strict'

/**
* Get the version of a currently listed package.
* @param {string} packageName
* @returns {Promise<string|null>} - Semver version (e.g. 1.0.0)
*/
static async getPackageVersion(packageName) {
try {
const { stdout, stderr } = await exec(`npm view ${packageName} version`)
return stdout;
} catch (error) {
return null; // package probably not installed
}
}
/**
* Execute npm install for a given packageId or array of packageIds.

@@ -31,0 +45,0 @@ * @param {boolean} [save=true] - npm --save flag

{
"name": "homey",
"version": "2.4.0",
"version": "2.5.0",
"description": "Command-line interface and type declarations for Homey Apps",

@@ -5,0 +5,0 @@ "main": "index.js",