Skip to content

Instantly share code, notes, and snippets.

@tiegz
Created July 11, 2020 14:18
Show Gist options
  • Save tiegz/a6ed54c9a733bb351f503ad62cef3892 to your computer and use it in GitHub Desktop.
Save tiegz/a6ed54c9a733bb351f503ad62cef3892 to your computer and use it in GitHub Desktop.
NPM/NuGet jQuery version comparison.
# Compares a set of npm jquery files to nuget's wrapped jquery files, for the given versions.
versions = "1.11.0,1.11.0-beta3,1.11.0-pre,1.11.0-rc1,1.11.1,1.11.1-beta1,1.11.1-rc1,1.11.1-rc2,1.11.2,1.11.3,1.12.0,1.12.1,1.12.2,1.12.3,1.12.4,1.5.1,1.6.2,1.6.3,1.7.2,1.7.3,1.8.2,1.8.3,1.9.1,2.1.0,2.1.0-beta2,2.1.0-beta3,2.1.0-rc1,2.1.1,2.1.1-beta1,2.1.1-rc1,2.1.1-rc2,2.1.2,2.1.3,2.1.4,2.2.0,2.2.1,2.2.2,2.2.3,2.2.4,3.0.0,3.0.0-alpha1,3.0.0-beta1,3.0.0-rc1,3.1.0,3.1.1,3.2.0,3.2.1,3.3.0,3.3.1,3.4.0,3.4.1,3.5.0,3.5.1"
mismatches = []
missing_on_nuget = []
versions.split(',').each do |v|
print "#{v}, "
# Nuget doesn't publish prerelease version
next if v =~ /-/
`wget -cq https://code.jquery.com/jquery-#{v}.js`
`nuget install jquery -Verbosity quiet -Version #{v} &>/dev/null`
npm_file = "jquery-#{v}.js"
nuget_file = "jQuery.#{v}/Content/Scripts/jquery-#{v}.js"
if !File.exist?(nuget_file)
missing_on_nuget << v
next
end
mismatches << v if `diff -w #{npm_file} #{nuget_file}`.strip.length > 1
end
puts
puts "Missing on nuget:\t#{missing_on_nuget}"
puts "Mismatches:\t#{mismatches}"
# Output:
# 1.11.0, 1.11.0-beta3, 1.11.0-pre, 1.11.0-rc1, 1.11.1, 1.11.1-beta1, 1.11.1-rc1, 1.11.1-rc2, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.12.2, 1.12.3, 1.12.4, 1.5.1, 1.6.2, 1.6.3, 1.7.2, 1.7.3, 1.8.2, 1.8.3, 1.9.1, 2.1.0, 2.1.0-beta2, 2.1.0-beta3, 2.1.0-rc1, 2.1.1, 2.1.1-beta1, 2.1.1-rc1, 2.1.1-rc2, 2.1.2, 2.1.3, 2.1.4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 3.0.0, 3.0.0-alpha1, 3.0.0-beta1, 3.0.0-rc1, 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.3.0, 3.3.1, 3.4.0, 3.4.1, 3.5.0, 3.5.1,
# Missing on nuget: ["1.7.3", "3.2.0", "3.3.0"]
# Mismatches: ["1.9.1"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment