@@ -67,17 +67,21 @@ for (const sourceFile of project.getSourceFiles()) {
6767 }
6868}
6969
70- const migrationPercent = totalFunctions > 0
70+ const asyncFunctionPercent = totalFunctions > 0
7171 ? ( ( asyncFunctions / totalFunctions ) * 100 ) . toFixed ( 1 )
7272 : '0.0' ;
7373
74+ const migrationPercent = ( asyncFunctions + callbackFunctions ) > 0
75+ ? ( ( asyncFunctions / ( asyncFunctions + callbackFunctions ) ) * 100 ) . toFixed ( 1 )
76+ : '0.0' ;
77+
7478console . log ( '=== Async/Await Migration Progress ===' ) ;
7579console . log ( `Total functions: ${ totalFunctions } ` ) ;
76- console . log ( `Async functions: ${ asyncFunctions } (${ migrationPercent } %)` ) ;
80+ console . log ( `Async functions: ${ asyncFunctions } (${ asyncFunctionPercent } %)` ) ;
7781console . log ( `Callback functions: ${ callbackFunctions } ` ) ;
7882console . log ( `Remaining .then(): ${ thenChains } ` ) ;
7983console . log ( '' ) ;
80- console . log ( `Migration: ${ asyncFunctions } /${ totalFunctions } functions (${ migrationPercent } %)` ) ;
84+ console . log ( `Migration (trend): ${ asyncFunctions } /${ asyncFunctions + callbackFunctions } (${ migrationPercent } %)` ) ;
8185
8286if ( process . env . GITHUB_STEP_SUMMARY ) {
8387 const { appendFileSync } = await import ( 'node:fs' ) ;
@@ -87,9 +91,10 @@ if (process.env.GITHUB_STEP_SUMMARY) {
8791 `| Metric | Count |` ,
8892 `|--------|-------|` ,
8993 `| Total functions | ${ totalFunctions } |` ,
90- `| Async functions | ${ asyncFunctions } (${ migrationPercent } %) |` ,
94+ `| Async functions | ${ asyncFunctions } (${ asyncFunctionPercent } %) |` ,
9195 `| Callback-style functions | ${ callbackFunctions } |` ,
9296 `| Remaining \`.then()\` chains | ${ thenChains } |` ,
97+ `| Migration trend (async / (async + callback)) | ${ asyncFunctions } /${ asyncFunctions + callbackFunctions } (${ migrationPercent } %) |` ,
9398 '' ,
9499 ] . join ( '\n' ) ) ;
95100}
0 commit comments