Make analyze.rb find its own files and generate JS

This commit is contained in:
Danila Fedorin 2022-03-15 15:08:46 -07:00
parent 7fb3c26633
commit a658286776

View File

@ -21,7 +21,7 @@ end
files = Set.new files = Set.new
refs = {} refs = {}
ARGF.each do |file| Dir['content/blog/**/*.md'].each do |file|
file = file.chomp file = file.chomp
files << file files << file
arr = refs[file] || (refs[file] = []) arr = refs[file] || (refs[file] = [])
@ -78,5 +78,5 @@ end
edges.uniq edges.uniq
# edges.filter! { |e| e[:from] < e[:to] } # edges.filter! { |e| e[:from] < e[:to] }
puts ("const nodes = " + JSON.pretty_unparse(data.values) + ";") puts ("export const nodes = " + JSON.pretty_unparse(data.values) + ";")
puts ("const edges = " + JSON.pretty_unparse(edges) + ";") puts ("export const edges = " + JSON.pretty_unparse(edges) + ";")