Skip to content

Instantly share code, notes, and snippets.

@scicco
Last active February 8, 2023 16:14
Show Gist options
  • Save scicco/ee0cbb570dbc909dcd5c6bcdeac8ceef to your computer and use it in GitHub Desktop.
Save scicco/ee0cbb570dbc909dcd5c6bcdeac8ceef to your computer and use it in GitHub Desktop.
yarn_licences_csv.rb
# "@ampproject/remapping", # name
# "2.2.0", # version
# "Apache-2.0", # license
# "git+https://github.com/ampproject/remapping.git", # repository
# "Unknown", # homepage
# "Justin Ridgewell" # author
require 'json'
require 'csv'
# Read data from the JSON file
file = File.read('yarn_licenses.json')
data = JSON.parse(file)
# Write data to the CSV file
CSV.open("yarn_licenses.csv", "w") do |csv|
csv << %w(name version summary license author homepage )
data.each do |row|
csv << [row[0], row[1], '', row[2], row[5], row[4]]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment