lib/js_dependency.rb in js_dependency-0.3.2 vs lib/js_dependency.rb in js_dependency-0.3.3
- old
+ new
@@ -31,13 +31,14 @@
def self.export_mermaid(src_path, target_paths, orientation: "LR", alias_paths: nil, child_analyze_level: 1, parent_analyze_level: 1, name_level: 1, output_path: nil, excludes: nil)
output_pathname = Pathname.new(output_path) if output_path
index = JsDependency::IndexCreator.call(src_path, alias_paths: alias_paths, excludes: excludes)
nodes = []
+ styles = []
target_paths.each do |target_path|
target_pathname = JsDependency::TargetPathname.new(target_path)
-
+ styles += [target_pathname.mermaid_style(src_path)]
mermaid_root = JsDependency::Mermaid::Root.new(orientation)
target_pathname.each_parent_path(parent_analyze_level, index) do |parent_path, child_path|
mermaid_root.add(parent_path, child_path)
end
@@ -46,10 +47,10 @@
mermaid_root.add(parent_path, child_path)
end
nodes += mermaid_root.export_nodes(name_level: name_level, src_path: src_path)
end
- output = (["flowchart LR"] + nodes.uniq).join("\n")
+ output = (["flowchart LR"] + nodes.uniq + styles.uniq).join("\n")
output_pathname&.write(output)
output
end
# @param [String] src_path