Skip to content

Commit

Permalink
Log max of 100 pages per rout
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Jul 10, 2024
1 parent c5cc647 commit eefb57f
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`)}`);
}
}
}
Expand Down

0 comments on commit eefb57f

Please sign in to comment.