lib/js_dependency/report/markdown.rb in js_dependency-0.3.14 vs lib/js_dependency/report/markdown.rb in js_dependency-0.3.15

- old
+ new

@@ -8,11 +8,11 @@ # @param [Array] orphan_list # @param [String] mermaid_markdown # @param [nil, String] identifier def initialize(orphan_list, mermaid_markdown, identifier: nil) @orphan_list = orphan_list || [] - @mermaid_markdown = mermaid_markdown || "" + @mermaid_markdown = mermaid_markdown @identifier = identifier || "js_dependency_report_identifier" end # @return [String] def export @@ -28,20 +28,25 @@ else markdown += "#{@orphan_list.size} orphaned modules.\n\n" markdown += "#{@orphan_list.map { |str| "* ``#{str}``" }.join("\n")}\n\n" end - markdown += <<~"MAKRDOWNTEXT" - ### Module dependency + markdown += "### Module dependency\n\n" - ```mermaid - MAKRDOWNTEXT - markdown += @mermaid_markdown.to_s + if @mermaid_markdown.nil? || @mermaid_markdown.empty? + markdown += ".vue or .js or .jsx files are not changed.\n\n" + else + markdown += <<~"MAKRDOWNTEXT" + ```mermaid + MAKRDOWNTEXT - markdown += <<~"MAKRDOWNTEXT" - ``` + markdown += @mermaid_markdown.to_s - MAKRDOWNTEXT + markdown += <<~"MAKRDOWNTEXT" + ``` + + MAKRDOWNTEXT + end markdown += "<!-- #{@identifier} -->" markdown end end