diff options
author | 2023-08-17 15:34:36 -0500 | |
---|---|---|
committer | 2023-08-21 14:17:03 +0100 | |
commit | 42785c7b784b151e6d582570e5d74482129e8eb8 (patch) | |
tree | ce139d611c2a644919c1a7307fbac3e1ac0a81d5 | |
parent | 33b8910cfdce5713891c50a84a0a8fe926311710 (diff) | |
download | astro-42785c7b784b151e6d582570e5d74482129e8eb8.tar.gz astro-42785c7b784b151e6d582570e5d74482129e8eb8.tar.zst astro-42785c7b784b151e6d582570e5d74482129e8eb8.zip |
fix(#6965): fix build stats (#8122)
-rw-r--r-- | .changeset/lovely-walls-call.md | 5 | ||||
-rw-r--r-- | packages/astro/src/core/build/generate.ts | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/.changeset/lovely-walls-call.md b/.changeset/lovely-walls-call.md new file mode 100644 index 000000000..408fa00c5 --- /dev/null +++ b/.changeset/lovely-walls-call.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Improve fidelity of time stats when running `astro build` diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 7545fa577..646bb1d42 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -287,15 +287,17 @@ async function generatePage( builtPaths ); + let prevTimeEnd = timeStart; for (let i = 0; i < paths.length; i++) { const path = paths[i]; await generatePath(path, generationOptions, pipeline); const timeEnd = performance.now(); - const timeChange = getTimeStat(timeStart, timeEnd); + const timeChange = getTimeStat(prevTimeEnd, timeEnd); const timeIncrease = `(+${timeChange})`; const filePath = getOutputFilename(pipeline.getConfig(), path, pageData.route.type); const lineIcon = i === paths.length - 1 ? '└─' : '├─'; logger.info(null, ` ${cyan(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`); + prevTimeEnd = timeEnd; } } |