Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
else {
// find the most recent markdown documentation file based on NPM version
mdFiles.forEach((mdFile) => {
const starMdVer = mdFile.lastIndexOf(`${vueCompName}-`) + vueCompName.length + 1, endMdVer = mdFile.lastIndexOf('.')
const mdFileVer = mdFile.slice(starMdVer, endMdVer)
if (semver.valid(mdFileVer) && semver.lt(latestMdVer, mdFileVer)) {
latestMdVer = mdFileVer
latestMdDoc = mdFile
}
})
console.log(`Latest markdown documentation version for ${vueCompName}: ${latestMdVer}`)
// overwrite most recent markdown documentation if the update is a patch
if (semver.eq(latestMdVer, currentVer) || semverDiff(latestMdVer, currentVer) === 'patch') {
fs.remove(latestMdDoc)
.then(() => fs.outputFile(`${vueCompDir}/${vueCompName}-${currentVer}.md`, mdTemplate))
.then(() => console.log(`Overwrote documentation for ${vueCompName}. ${(semver.lt(latestMdVer, currentVer)) ? `Updated to version ${currentVer} from ${latestMdVer}` : ''}`))
.catch((createErr) => {
if (createErr)
throw new Error(`Error while trying to replace markdown documentation file ${latestMdDoc} with ${vueCompDir}/${vueCompName}-${currentVer}.md:\n${createErr}`)
})
}
// archive the previous markdown documentation if the update is a major or minor change
else if (semverDiff(latestMdVer, currentVer) === 'major' || semverDiff(latestMdVer, currentVer) === 'minor') {
fs.outputFile(`${vueCompDir}/${vueCompName}-${currentVer}.md`, mdTemplate)
.then(() => console.log(`Archived markdown file for ${vueCompName}, version ${latestMdVer}. Updated to version ${currentVer}`))
.catch((createErr) => {
if (createErr)
throw new Error(`Error while trying to create markdown documentation file ${vueCompDir}/${vueCompName}-${currentVer}.md:\n${createErr}`)
})
) {
return false;
}
const [savedReleaseVersion, savedRcNumber] = extractRcNumber(savedVersion);
const [kibanaReleaseVersion, kibanaRcNumber] = extractRcNumber(kibanaVersion);
// ensure that both release versions are valid, if not then abort
if (!semver.valid(savedReleaseVersion) || !semver.valid(kibanaReleaseVersion)) {
return false;
}
// ultimately if the saved config is from a previous kibana version
// or from an earlier rc of the same version, then we can upgrade
const savedIsLessThanKibana = semver.lt(savedReleaseVersion, kibanaReleaseVersion);
const savedIsSameAsKibana = semver.eq(savedReleaseVersion, kibanaReleaseVersion);
const savedRcIsLessThanKibana = savedRcNumber < kibanaRcNumber;
return savedIsLessThanKibana || (savedIsSameAsKibana && savedRcIsLessThanKibana);
}
.then(json => {
// Verify that the package is newer that latest, minor or next, or skip. This promise
// will release with an array of dist-tags.
if (json['name'] !== name) {
return null;
}
const { latest, next } = json['dist-tags'];
const isNext = semver.eq(version, next);
const gtNext = semver.gt(version, next);
const isLatest = semver.eq(version, latest);
if (isNext || isLatest) {
return null;
} else if (gtNext) {
return 'next';
} else {
return 'latest';
}
})
.then(distTag => {
function compatibleWith(a: { [key: string]: string }, b: { [key: string]: string }): boolean {
const depName = key(a);
if (!b[depName]) return false; // dependency does not exist - return false
const bVersion = b[depName];
const aVersion = a[depName];
const aType = getSemverType(aVersion);
const bType = getSemverType(bVersion);
if (!aType || !bType) return false; // in case one of the versions is invalid - return false
if (aType === 'V' && bType === 'V') {
return semver.eq(aVersion, bVersion);
}
if (aType === 'V' && bType === 'R') {
return semver.satisfies(aVersion, bVersion);
}
if (aType === 'R' && bType === 'V') {
return semver.satisfies(bVersion, aVersion);
}
if (aType === 'R' && bType === 'R') {
if (aVersion.startsWith('^') && bVersion.startsWith('^')) {
const aMajorVersion = parseInt(aVersion[1], 10);
const bMajorVersion = parseInt(bVersion[1], 10);
if (aMajorVersion === bMajorVersion) return true;
}
}
return false;
}
exports.load = function (service, accessKeyId, secretAccessKey, sessionToken, httpOptions) {
if (service === 's3') {
if (semver.eq(process.version, 'v0.6.9')) {
throw new Error('FATAL: The S3 client is NOT supported under node.js v0.6.9.');
}
}
if (semver.lt(process.version, 'v0.8.5')) {
console.error('Warning: aws2js under node.js v0.8.4 and below is deprecated. Only node.js v0.8.5+ will be supported.');
}
var clientTemplate = cfg.clients[service], key;
if ( ! clientTemplate) {
throw new Error('Invalid AWS client');
}
if (service !== 's3') {
clientTemplate.path = '/';
}
currentResult.filter(item => semver.eq(item.tag_name, gtThanVersion))
.length > 0;
allItems.sort((a, b) => {
if (a.type === b.type) {
if (a.header) {
return -1
} else if (b.header) {
return 1
} else {
if (semver.eq(a.version, b.version)) {
return 0
} else if (semver.gt(a.version, b.version)) {
return 1
} else {
return -1
}
}
} else {
const sortValForType = function (type) {
switch (type) {
case 'patch':
return 0
case 'minor':
return 1
case 'major':
return 2
fileHelper.listPlugins(function(plugins){
expect(semver.eq(plugins['cordova-plugin-geolocation'].version, '2.0.0')).toBeTruthy();
expect(true).toBeTruthy();
done();
});
}
const release = releases.data.find(r => semver.eq(r.name, releaseVersion))
for(var id in plugins){
plugin = plugins[id];
try{
if(plugin.error || (!plugin.target && !plugin.installed)){
plugin.status = "error";
}else if(!plugin.installed){
plugin.status = "new-target";
}else if(!plugin.target){
plugin.status = "new-installed";
} else if((plugin.source.type === "local" && plugin.source.path === plugin.target)
|| plugin.installed === plugin.target
|| (plugin.source.type === "git" && remote.normalizeGithubSource(plugin.source) === remote.normalizeGithubURL(plugin.target))
|| (!!plugin.source.id && plugin.source.id.match(remote.GITHUB_REGEX) && remote.normalizeGithubSource(plugin.source) === remote.normalizeGithubURL((plugin.target)))
|| (semver.validRange(plugin.target) && semver.satisfies(plugin.installed, plugin.target))
|| (semver.valid(plugin.target) && semver.eq(plugin.installed, plugin.target))) {
plugin.status = "equal";
}else if((semver.validRange(plugin.target) && semver.ltr(plugin.installed, plugin.target))
|| (semver.valid(plugin.target) && semver.lt(plugin.installed, plugin.target))) {
plugin.status = "newer-target";
}else if((semver.validRange(plugin.target) && semver.gtr(plugin.installed, plugin.target))
|| (semver.valid(plugin.target) && semver.gt(plugin.installed, plugin.target))) {
plugin.status = "newer-installed";
}else{
plugin.status = "unknown-mismatch";
}
}catch(e){
plugin.status = "error";
plugin.error = "Error comparing versions: local version="+plugin.installed+"; target version="+plugin.target+"; version error="+ e.message;
}
}
onFinish();