Skip to content

Commit

Permalink
- Further docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Oct 6, 2019
1 parent 6b030b8 commit e463516
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions lib/versionmanager.js
Expand Up @@ -146,10 +146,21 @@ function upgradeDependencies(currentDependencies, latestVersions, options = {})

// Determines if the given version (range) should be upgraded to the latest (i.e. it is valid, it does not currently

// Return true if the version satisfies the range
/**
* Return true if the version satisfies the range.
* @type {function}
* @param {string} version
* @param {string} range
* @returns {boolean}
*/
const isSatisfied = semver.satisfies;

// satisfy the latest, and it is not beyond the latest)
/**
* Satisfy the latest, and it is not beyond the latest).
* @param {string} current
* @param {string} latest
* @returns {boolean}
*/
function isUpgradeable(current, latest) {

// do not upgrade non-npm version declarations (such as git tags)
Expand Down Expand Up @@ -228,7 +239,7 @@ function filterAndReject(filter, reject) {
}

/**
* Returns an 2-tuple of upgradedDependencies and their latest versions
* Returns an 2-tuple of upgradedDependencies and their latest versions.
* @param {Object} currentDependencies
* @param {Object} options
* @returns {Array}
Expand Down Expand Up @@ -258,7 +269,7 @@ function upgradePackageDefinitions(currentDependencies, options) {
}

/**
* Upgrade the dependency declarations in the package data
* Upgrade the dependency declarations in the package data.
* @param {string} pkgData The package.json data, as utf8 text
* @param {Object} oldDependencies Old dependencies {package: range}
* @param {Object} newDependencies New dependencies {package: range}
Expand Down Expand Up @@ -300,7 +311,7 @@ async function upgradePackageData(pkgData, oldDependencies, newDependencies, new
}

/**
* Get the current dependencies from the package file
* Get the current dependencies from the package file.
* @param {Object} [pkgData={}] Object with dependencies, devDependencies, peerDependencies, optionalDependencies, and/or bundleDependencies properties
* @param {Object} [options={}]
* @param {string} options.dep
Expand Down Expand Up @@ -356,10 +367,10 @@ function getInstalledPackages(options = {}) {
}

/**
* Get the latest or greatest versions from the NPM repository based on the version target
* @param {Object} packageMap an object whose keys are package name and values are current versions
* @param {Object} [options={}] Options. Default: { versionTarget: 'latest' }. You may also specify { versionTarget: 'greatest' }
* @returns {Promise<Object>} Promised {packageName: version} collection
* Get the latest or greatest versions from the NPM repository based on the version target.
* @param {Object} packageMap An object whose keys are package name and values are current versions
* @param {Object} [options={}] Options. Default: { versionTarget: 'latest' }. You may also specify { versionTarget: 'greatest' }
* @returns {Promise<Object>} Promised {packageName: version} collection
*/
function queryVersions(packageMap, options = {}) {
let getPackageVersion;
Expand Down Expand Up @@ -426,7 +437,7 @@ function queryVersions(packageMap, options = {}) {
}

/**
* Zip up the array of versions into to a nicer object keyed by package name
* Zip up the array of versions into to a nicer object keyed by package name.
* @param {Array} versionList
* @returns {Object}
*/
Expand Down Expand Up @@ -493,6 +504,7 @@ function getVersionTarget(options) {
* @param {string|Object} packageManagerNameOrObject
* @param packageManagerNameOrObject.global
* @param packageManagerNameOrObject.packageManager
* @returns {Object}
*/
function getPackageManager(packageManagerNameOrObject) {

Expand Down

0 comments on commit e463516

Please sign in to comment.