Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (latestCached) {
console.log('cache latest: ', latestCached.version);
this.latestCached = latestCached;
// notify that ui can be started
this.emit('app-ready', latestCached.filePath, latestCached.version);
} else {
latestCached = {
version: '0.0.0'
};
}
// check remote repo for updates
let latestBackend = await backend.getLatest();
console.log('latest backend', latestBackend && latestBackend.version);
if (
latestBackend &&
semver.gt(latestBackend.version, latestCached.version)
) {
// -> update available
this.emit('update-available', latestBackend);
return latestBackend;
}
return null;
}
async checkIntegrity(release) {
var upperBound = null;
var upperBoundRange = null;
var upperBoundExists = false;
for(var version in engine) {
if(semver.valid(semver.clean(version)) && !semver.gt(version, latest)) {
versions.push(version);
} else {
// Check if this is an upperbound; validRange() handles whitespace
var cleanedRange = semver.validRange(version);
if(cleanedRange && UPPER_BOUND_REGEX.exec(cleanedRange)) {
upperBoundExists = true;
// We only care about the highest upper bound that our project does not support
if(getFailedRequirements(engine[version], pluginMap, platformMap, cordovaVersion).length !== 0) {
var maxMatchingUpperBound = cleanedRange.substring(1);
if (maxMatchingUpperBound && (!upperBound || semver.gt(maxMatchingUpperBound, upperBound))) {
upperBound = maxMatchingUpperBound;
upperBoundRange = version;
}
}
} else {
events.emit('verbose', 'Ignoring invalid version in ' + name + ' cordovaDependencies: ' + version + ' (must be a single version <= latest or an upper bound)');
}
}
}
// If there were no valid requirements, we fall back to old behavior
if(!upperBoundExists && versions.length === 0) {
events.emit('verbose', 'Ignoring ' + name + ' cordovaDependencies entry because it did not contain any valid plugin version entries');
return null;
}
let latest;
try {
latest = await latestVersion(npmOptions, packageName, constraint);
} catch (e) {
if (current) {
logger.warn(`\n ${chalk.yellow(e.message)}`);
return current;
}
logger.error(`\n ${chalk.red(e.message)}`);
process.exit(1);
}
const versionToUse =
current && (!constraint || satisfies(current, constraint)) && gt(current, latest)
? current
: latest;
return `^${versionToUse}`;
}
versionsFilter: version => semver.gt(version, '2.3.3')
},
.sort((a, b) => semver.gt(a, b) ? -1 : 1);
}
};
helpers.typedArrayToBuffer = function (arr) {
assert(_.isTypedArray(arr), 'Argument "arr" is not a typed array.');
return _typedArrayToBuffer(arr);
};
function _typedArrayToBuffer(arr) {
if (arr.byteLength !== arr.buffer.byteLength) {
return helpers.arrayToBuffer(arr.buffer, arr.byteOffset, arr.byteLength);
}
return helpers.arrayToBuffer(arr.buffer);
}
if (semver.gt(process.versions.node, '5.1.0')) {
helpers.arrayToBuffer = function (arr, byteOffset, length) {
return Buffer.from(arr, byteOffset, length);
};
}
else {
helpers.arrayToBuffer = function (arr, byteOffset, length) {
return new Buffer(arr, byteOffset, length);
};
}
isUpdateAvailable () {
let availableVersion = window.localStorage.getItem(AvailableUpdateVersion)
return availableVersion && semver.gt(availableVersion, atom.getVersion())
},
.sort((a, b) => {
if (!semver.valid(a) && !semver.valid(b)) {
return a.localeCompare(b);
}
if (!semver.valid(a)) {
return -1;
}
if (!semver.valid(b)) {
return 1;
}
return semver.gt(a, b, true) ? -1 : 1;
})
.map((key) => mapFn(key, versions[key])) as Array;
compareVersions(v1, v2) {
if (semver.gt(v1.version, v2.version)) {
return -1;
}
if (semver.lt(v1.version, v2.version)) {
return 1;
}
return 0;
}
}