Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var name = pluginInfo.name;
// Filters out pre-release versions
var latest = semver.maxSatisfying(allVersions, '>=0.0.0');
var versions = [];
var upperBound = null;
var upperBoundRange = null;
var upperBoundExists = false;
// TODO: lots of 'versions' being thrown around in this function: cordova version,
// platform version, plugin version. The below for loop: what version is it
// iterating over? plugin version? please clarify the variable name.
for (var version in engine) {
// if a single version && less than latest
if (semver.valid(semver.clean(version)) && semver.lte(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 (module.exports.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)');
function _completeToolPath(tool, version, arch) {
const folderPath = path.join(cacheRoot, tool, semver.clean(version) || version, arch || '');
const markerPath = `${folderPath}.complete`;
fs.writeFileSync(markerPath, '');
core.debug('finished caching tool');
}
function _isExplicitVersion(versionSpec) {
}).sort(function (a: Release, b: Release) {
const left = semver.clean(a.name);
const right = semver.clean(b.name);
return semver.compare(left, right, true);
});
async function getVersion(program: string, command: string, matcher: RegExp): Promise {
try {
const result = await tryExecuteCommand(undefined, program, command);
if (result.code === 0) {
const output = result.cmdOutput || result.cmdOutputIncludingStderr;
const installedVersion = output.match(matcher);
const version = semver.clean(installedVersion ? installedVersion[1] : '');
return version || '';
}
} catch (error) {
Telemetry.sendException(error);
}
return '';
}
}
var chalk = require('chalk');
var semver = require('semver');
var packageConfig = require('../package.json');
var shell = require('shelljs');
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim();
}
var versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
];
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
});
}
module.exports = function () {
var warnings = [];
for (var i = 0; i < versionRequirements.length; i++) {
var mod = versionRequirements[i];
const semver = require('semver')
const shell = require('shelljs')
const childProcess = require('child_process')
const packageConfig = require('../package.json')
function exec(cmd) {
return childProcess
.execSync(cmd)
.toString()
.trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node,
},
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm,
})
}
module.exports = () => {
const warnings = []
for (let i = 0; i < versionRequirements.length; i += 1) {
function findVersion(versions, version) {
var cleanedVersion = semver.clean(version);
for(var i = 0; i < versions.length; i++) {
if(semver.clean(versions[i]) === cleanedVersion) {
return versions[i];
}
}
return null;
}
'use strict'
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function () {
const warnings = []
for (let i = 0; i < versionRequirements.length; i++) {
function getVersionSafe() {
const version = semver.clean(readPackageJson().version);
if (!version) {
throw new Error('Error: failed to read version from package.json!');
}
return version;
}
const chalk = require('chalk')
const semver = require('semver')
const packageConfig = require('../package.json')
const shell = require('shelljs')
function exec(cmd) {
return require('child_process')
.execSync(cmd)
.toString()
.trim()
}
const versionRequirements = [
{
name: 'node',
currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node
}
]
if (shell.which('npm')) {
versionRequirements.push({
name: 'npm',
currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm
})
}
module.exports = function() {
let i
const warnings = []
for (i = 0; i < versionRequirements.length; i++) {