@@ -6,15 +6,20 @@ const fsUtils = require("../utils/fsUtils");
66const yaml = require ( "yaml" ) ;
77const { consola } = require ( "consola" ) ;
88
9- async function generateOverview ( sinceDate ) {
9+ async function generateOverview ( sinceDate , workflow ) {
1010 const TODAY = new Date ( ) . toJSON ( ) . toString ( ) . slice ( 0 , 10 ) ;
11- const templateSummary = await getTemplatesSummary ( ) ;
12- const yamlSummary = await getYamlSummary ( sinceDate ) ;
13- // Terminal
14- displayOverview ( sinceDate , TODAY , templateSummary , yamlSummary ) ;
15- // File
16- const row = createRow ( sinceDate , TODAY , templateSummary , yamlSummary ) ;
17- saveOverviewToFile ( row ) ;
11+ if ( workflow ) {
12+ const templateSummary = await getWorkflowTemplateSummary ( workflow ) ;
13+ consola . log ( "Workflow summary test A" )
14+ } else {
15+ const templateSummary = await getTemplatesSummary ( ) ;
16+ const yamlSummary = await getYamlSummary ( sinceDate ) ;
17+ // Terminal
18+ displayOverview ( sinceDate , TODAY , templateSummary , yamlSummary ) ;
19+ // File
20+ const row = createRow ( sinceDate , TODAY , templateSummary , yamlSummary ) ;
21+ saveOverviewToFile ( row ) ;
22+ }
1823}
1924
2025// Return an object with the count of activities by file and by type
@@ -255,6 +260,51 @@ async function getTemplatesSummary() {
255260 return summary ;
256261}
257262
263+ async function getWorkflowTemplateSummary ( workflowHandle ) {
264+ const summary = {
265+ reconciliations : {
266+ total : 0 ,
267+ externallyManaged : 0 ,
268+ externallyManagedPerc : 0 ,
269+ yamlFiles : 0 ,
270+ yamlFilesPerc : 0 ,
271+ unitTests : 0 ,
272+ yamlFilesWithAtLeastTwoTests : 0 ,
273+ yamlFilesWithAtLeastTwoTestsPerc : 0 ,
274+ } ,
275+ exportFiles : {
276+ total : 0 ,
277+ externallyManaged : 0 ,
278+ externallyManagedPerc : 0 ,
279+ } ,
280+ accountTemplates : {
281+ total : 0 ,
282+ externallyManaged : 0 ,
283+ externallyManagedPerc : 0 ,
284+ yamlFiles : 0 ,
285+ yamlFilesPerc : 0 ,
286+ unitTests : 0 ,
287+ yamlFilesWithAtLeastTwoTests : 0 ,
288+ yamlFilesWithAtLeastTwoTestsPerc : 0 ,
289+ } ,
290+ all : {
291+ total : 0 ,
292+ externallyManaged : 0 ,
293+ externallyManagedPerc : 0 ,
294+ yamlFiles : 0 ,
295+ yamlFilesPerc : 0 ,
296+ unitTests : 0 ,
297+ yamlFilesWithAtLeastTwoTests : 0 ,
298+ yamlFilesWithAtLeastTwoTestsPerc : 0 ,
299+ } ,
300+ } ;
301+
302+ // Reconciliations
303+ // Assume no empty reconciliations within the workflow.
304+
305+ return summary ;
306+ }
307+
258308async function getYamlSummary ( sinceDate ) {
259309 const yamlActivity = await yamlFilesActivity ( sinceDate ) ;
260310 const summary = { created : 0 , updated : 0 } ;
0 commit comments