How to use the maxSatisfying function from semver
Find comprehensive JavaScript semver.maxSatisfying code examples handpicked from public code repositorys.
GitHub: qooxdoo/qooxdoo
637 638 639 640 641 642 643 644 645 646
let version = manifest.info.version; version2release[version] = tag; return version; }) .filter(version => Boolean(version)); let highestCompatibleVersion = semver.maxSatisfying( versionList, lib_range, { loose: true } );
255
758
77
+ 2 other calls in file
GitHub: cnpm/npminstall
292 293 294 295 296 297 298 299 300 301
realPkgVersion = distTags.latest; } else if (version) { // use the valid version realPkgVersion = version; } else if (range) { realPkgVersion = semver.maxSatisfying(allVersions, range); if (realPkgVersion) { // try to use latest-{major} tag version on range // ^1.0.1 =range=> get 1.0.3 in (1.0.2, 1.0.3), but latest-1 tag is 1.0.2 // finnaly we should use 1.0.2 on ^1.0.1
64
476
17
88 89 90 91 92 93 94 95 96 97
testConstraints.unshift('HEAD'); let tags = await getTags(); let matrix = await Promise.all(testConstraints.map((constraint) => { return new Promise((resolve) => { let tag = constraint === 'HEAD' ? 'HEAD' : semver.maxSatisfying(tags, constraint); let entry = { 'lens-ref': tag }; nodeVersionFromRef(tag).then((nodeEngineVersion) => { entry['node-version'] = nodeEngineVersion; resolve(entry);
12
291
4
157 158 159 160 161 162 163 164 165
const metadata = yield getMetadata(packageName); if (Object.keys(metadata['dist-tags']).includes(versionRange)) { return metadata['dist-tags'][versionRange]; } const versions = Array.isArray(metadata.versions) ? metadata.versions : Object.keys(metadata.versions); return semver.maxSatisfying(versions, versionRange); }); } exports.default = getRemoteVersion;
15
31
8
44 45 46 47 48 49 50 51 52
function matchVersion(versions, range, includePrerelease) { // If a prerelease version range is given, it will only match in that series (0.14-rc0, 0.14-rc1) // unless includePrerelease is set to true // https://www.npmjs.com/package/semver#prerelease-tags return semver.maxSatisfying(versions, range, { includePrerelease }); } module.exports = { getDownloadUrl };
4
6
0
GitHub: Serzhanov/Studies
419 420 421 422 423 424 425 426 427 428
const content = JSON.parse(packageContent.toString()); installedVersion = content.version; } if (!installedVersion) { // Find the version from NPM that fits the range to max. installedVersion = semver.maxSatisfying(Object.keys(npmPackageJson.versions), packageJsonRange); } if (!installedVersion) { throw new schematics_1.SchematicsException(`An unexpected error happened; could not determine version for package ${name}.`); }
1
0
0
84 85 86 87 88 89 90 91 92 93
const pkg = spec[name] const packument = { name, 'dist-tags': { latest: pkg.latest || semver.maxSatisfying(pkg.versions, '*'), }, versions: pkg.versions.reduce((versions, version) => { return { ...versions,
0
0
1
+ 2 other calls in file
90 91 92 93 94 95 96 97 98 99
if (semver.valid(versionInput) == versionInput || versionInput.endsWith('nightly')) { // versionInput is a valid version or a nightly version, use it directly return versionInput; } // Use the highest available version that matches versionInput let version = semver.maxSatisfying(availableReleases, versionInput); if (version == null) { throw new Error(`Could not find a Julia version that matches ${versionInput}`); } // GitHub tags start with v, remove it
0
0
0
12 13 14 15 16 17 18 19 20 21
metadata.versions[tagged] && semver.satisfies(tagged, spec, true)) { return {resolvedTo: tag, manifest: metadata.versions[tagged]} } // find the max satisfying version. var ms = semver.maxSatisfying(versions, spec, true) if (ms) { return {resolvedTo: ms, manifest: metadata.versions[ms]} } else if (spec === '*' && versions.length && tagged && metadata.versions[tagged]) { return {resolvedTo: tag, manifest: metadata.versions[tagged]}
0
0
0
30 31 32 33 34 35 36 37 38 39
.split('\n') .map(function (tag) { tag = tag.replace('macos-v', '').trim(); return semver.clean(tag); }); let previousVersion = semver.maxSatisfying(gitTags, "<" + currentVersion); /* Parse the raw changelog text and split it into individual releases.
0
0
0
156 157 158 159 160 161 162 163 164
const versionList = firmwareList.map((firmware) => { return firmware.version; }); const targetVersion = semver.maxSatisfying( versionList, "^" + currentVersion.toString() );
0
0
0
semver.gte is the most popular function in semver (528 examples)