class Importmap::Commands

def outdated

def outdated
  if (outdated_packages = npm.outdated_packages).any?
    table = [["Package", "Current", "Latest"]]
    outdated_packages.each { |p| table << [p.name, p.current_version, p.latest_version || p.error] }
    puts_table(table)
    packages = 'package'.pluralize(outdated_packages.size)
    puts "  #{outdated_packages.size} outdated #{packages} found"
    exit 1
  else
    puts "No outdated packages found"
  end
end