MCPcopy Index your code
hub / github.com/loopbackio/loopback-next / checkCliVersion

Function checkCliVersion

packages/cli/lib/version-helper.js:278–291  ·  view source on GitHub ↗

* Check if the current cli is out of date * @param log - Log function

(log = console.log)

Source from the content-addressed store, hash-verified

276 * @param log - Log function
277 */
278async function checkCliVersion(log = console.log) {
279 const latestCliVersion = await latestVersion('@loopback/cli');
280 if (latestCliVersion !== cliPkg.version) {
281 const current = chalk.grey(cliPkg.version);
282 const latest = chalk.green(latestCliVersion);
283 const cmd = chalk.cyan(`npm i -g ${cliPkg.name}`);
284 const message = `
285Update available ${current} ${chalk.reset(' → ')} ${latest}
286Run ${cmd} to update.`;
287 log(message);
288 } else {
289 log(chalk.green(`${cliPkg.name}@${cliPkg.version} is up to date.`));
290 }
291}
292
293exports.printVersions = printVersions;
294exports.checkCliVersion = checkCliVersion;

Callers 1

checkDependenciesFunction · 0.85

Calls 2

logFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected