From eefb57f826c9a81863628e305675058f5b6f7801 Mon Sep 17 00:00:00 2001 From: Matt Kane Date: Wed, 10 Jul 2024 09:17:15 +0100 Subject: [PATCH] Log max of 100 pages per rout --- packages/astro/src/core/build/generate.ts | 27 ++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index e394dc156de54..892c7fcb66e06 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -234,18 +234,29 @@ async function generatePage( const paths = await getPathsForRoute(route, pageModule, pipeline, builtPaths); let timeStart = performance.now(); let prevTimeEnd = timeStart; + const maxPathsToLog = 100; for (let i = 0; i < paths.length; i++) { const path = paths[i]; pipeline.logger.debug('build', `Generating: ${path}`); - const filePath = getOutputFilename(config, path, pageData.route.type); - const lineIcon = i === paths.length - 1 ? '└─' : '├─'; - logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)}`, false); + if (i < maxPathsToLog) { + const filePath = getOutputFilename(config, path, pageData.route.type); + const lineIcon = i === paths.length - 1 ? '└─' : '├─'; + logger.info(null, ` ${blue(lineIcon)} ${dim(filePath)}`, false); + } await generatePath(path, pipeline, generationOptions, route); - const timeEnd = performance.now(); - const timeChange = getTimeStat(prevTimeEnd, timeEnd); - const timeIncrease = `(+${timeChange})`; - logger.info('SKIP_FORMAT', ` ${dim(timeIncrease)}`); - prevTimeEnd = timeEnd; + if (i < maxPathsToLog) { + const timeEnd = performance.now(); + const timeChange = getTimeStat(prevTimeEnd, timeEnd); + const timeIncrease = `(+${timeChange})`; + logger.info('SKIP_FORMAT', ` ${dim(timeIncrease)}`); + prevTimeEnd = timeEnd; + } + if (i === maxPathsToLog && paths.length > maxPathsToLog) { + logger.info(null, ` ${blue('└─')} ${dim(`...`)}`, false); + } + } + if (paths.length > maxPathsToLog) { + logger.info('SKIP_FORMAT', `${dim(`${paths.length - maxPathsToLog} more paths.`)}`); } } }