CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-update-notifier

Update notifications for your CLI app

Overall
score

97%

Overview
Eval results
Files

task.mdevals/scenario-7/

Version Status Reporter

Build a CLI tool that checks whether a Node.js package has available updates and reports detailed version comparison information to users.

Requirements

Your tool should accept a package name and current version as command-line arguments, then:

  1. Check if a newer version is available on npm
  2. Determine the type of update available (major, minor, patch, prerelease, or build)
  3. Display the comparison results to the user, including:
    • Current version
    • Latest available version
    • Update type classification
    • Whether an update is actually needed

The tool should handle cases where:

  • The current version is already the latest
  • The current version is newer than the published latest
  • The versions differ by major, minor, patch, or prerelease increments

Implementation

@generates

API

/**
 * Main entry point for the CLI tool
 * Usage: node version-status.js <package-name> <current-version>
 */

/**
 * Checks version status and displays results
 * @param {string} packageName - The npm package name to check
 * @param {string} currentVersion - The current version to compare against
 * @returns {Promise<void>}
 */
async function checkVersionStatus(packageName, currentVersion);

/**
 * Displays formatted version comparison results
 * @param {object} versionInfo - Object containing version comparison data
 * @param {string} versionInfo.packageName - Package name
 * @param {string} versionInfo.current - Current version
 * @param {string} versionInfo.latest - Latest available version
 * @param {string} versionInfo.type - Update type classification
 * @param {boolean} versionInfo.hasUpdate - Whether an update is available
 */
function displayResults(versionInfo);

Test Cases

  • When checking "chalk" at version "4.0.0" and latest is "4.1.2", it reports update type as "minor" and hasUpdate as true @test
  • When checking "lodash" at version "4.17.21" and that is the latest version, it reports hasUpdate as false @test
  • When checking "express" at version "5.0.0" and latest is "4.18.2", it reports hasUpdate as false since current is newer @test
  • When checking "react" at version "17.0.0" and latest is "18.2.0", it reports update type as "major" @test

Dependencies { .dependencies }

update-notifier { .dependency }

Provides package update checking functionality with semantic version intelligence.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-update-notifier

tile.json