@@ -5,6 +5,7 @@ import logger from './logger/index.mjs';
55import { isAsyncGenerator , createStreamingCache } from './streaming.mjs' ;
66import createWorkerPool from './threading/index.mjs' ;
77import createParallelWorker from './threading/parallel.mjs' ;
8+ import createProgressBar from './utils/progressBar.mjs' ;
89
910const generatorsLogger = logger . child ( 'generators' ) ;
1011
@@ -92,7 +93,7 @@ const createGenerator = () => {
9293 /**
9394 * Runs all requested generators with their dependencies.
9495 *
95- * @param {import('./utils/configuration/types').Configuration } options - Runtime options
96+ * @param {import('./utils/configuration/types').Configuration } configuration - Runtime options
9697 * @returns {Promise<unknown[]> } Results of all requested generators
9798 */
9899 const runGenerators = async configuration => {
@@ -111,6 +112,9 @@ const createGenerator = () => {
111112 await scheduleGenerator ( name , configuration ) ;
112113 }
113114
115+ const progress = createProgressBar ( { enabled : configuration . progress } ) ;
116+ progress ?. start ( generators . length , 0 , { phase : 'Starting...' } ) ;
117+
114118 // Start all collections in parallel (don't await sequentially)
115119 const resultPromises = generators . map ( async name => {
116120 let result = await cachedGenerators [ name ] ;
@@ -119,14 +123,17 @@ const createGenerator = () => {
119123 result = await streamingCache . getOrCollect ( name , result ) ;
120124 }
121125
126+ progress ?. increment ( { phase : name } ) ;
122127 return result ;
123128 } ) ;
124129
125- const results = await Promise . all ( resultPromises ) ;
126-
127- await pool . destroy ( ) ;
128-
129- return results ;
130+ try {
131+ const results = await Promise . all ( resultPromises ) ;
132+ return results ;
133+ } finally {
134+ await pool . destroy ( ) ;
135+ progress ?. stop ( ) ;
136+ }
130137 } ;
131138
132139 return { runGenerators } ;
0 commit comments