Created
August 21, 2017 23:02
-
-
Save wagenet/16db15b72d2c64c603198814facda35b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
output = `yarn outdated --json` | |
json = JSON.parse(output) | |
items = if json['type'] == 'table' | |
keys = json['data']['head'] | |
json['data']['body'].map do |row| | |
Hash[*row.map.with_index{|v,i| [keys[i], v] }.flatten] | |
end | |
else | |
raise "Can't parse output" | |
end | |
skipped, outdated = items.partition{|i| (i['Latest'].include?('-') && !i['Current'].include?('-')) || i['Latest'] == 'exotic' } | |
puts "Skipped:" | |
skipped.each do |s| | |
puts " #{s['Package']}: #{s['Current']} (#{s['Latest']})" | |
end | |
puts "\nOutdated:" | |
outdated.each do |s| | |
puts " #{s['Package']}: #{s['Current']} (#{s['Latest']})" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment