0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix(#6965): fix build stats (#8122)

This commit is contained in:
Nate Moore 2023-08-17 15:34:36 -05:00 committed by Emanuele Stoppa
parent 33b8910cfd
commit 42785c7b78
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Improve fidelity of time stats when running `astro build`

View file

@ -287,15 +287,17 @@ async function generatePage(
builtPaths builtPaths
); );
let prevTimeEnd = timeStart;
for (let i = 0; i < paths.length; i++) { for (let i = 0; i < paths.length; i++) {
const path = paths[i]; const path = paths[i];
await generatePath(path, generationOptions, pipeline); await generatePath(path, generationOptions, pipeline);
const timeEnd = performance.now(); const timeEnd = performance.now();
const timeChange = getTimeStat(timeStart, timeEnd); const timeChange = getTimeStat(prevTimeEnd, timeEnd);
const timeIncrease = `(+${timeChange})`; const timeIncrease = `(+${timeChange})`;
const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type); const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type);
const lineIcon = i === paths.length - 1 ? '└─' : '├─'; const lineIcon = i === paths.length - 1 ? '└─' : '├─';
logger.info(null, ` ${cyan(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`); logger.info(null, ` ${cyan(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`);
prevTimeEnd = timeEnd;
} }
} }