For some repo reports, we won't be able to download a graph if there isn't enough data to generate it. A file existence check is needed to check for missing graphs in the org report template and repo report template.
Solution
Created an 11ty filter fileExists that uses fs to check on whether a file exists in the project directory.
Created a component called graph-section.liquid with path to graph and section title as the parameters. First, it checks the dev file path of the graph which is located in site/_graphs. Then, it will display the graph accordingly using the graph path in the dist directory (output directory generated by 11ty after building project).
Added fileExists check to graph-toggle.liquid as well
Updated org report and repo report templates using new graph-section component
Result
Graphs are displayed accordingly based on whether graph img exists.
Reports: Check for File Existence
Problem
For some repo reports, we won't be able to download a graph if there isn't enough data to generate it. A file existence check is needed to check for missing graphs in the org report template and repo report template.
Solution
fileExists
that usesfs
to check on whether a file exists in the project directory.graph-section.liquid
with path to graph and section title as the parameters. First, it checks the dev file path of the graph which is located insite/_graphs
. Then, it will display the graph accordingly using the graph path in thedist
directory (output directory generated by 11ty after building project).fileExists
check tograph-toggle.liquid
as wellgraph-section
componentResult
Graphs are displayed accordingly based on whether graph img exists.
Test Plan
Waiting