diff options
author | 2023-08-17 15:34:36 -0500 | |
---|---|---|
committer | 2023-08-17 15:34:36 -0500 | |
commit | fa6b68a776c5b3cc8167fc042b7d305234ebcff9 (patch) | |
tree | 2804b71ff99bbac76b4673c3f41069e2bf9d8fdf | |
parent | 442f94611696e310f9d2a19e2ff1b6e1c55cf257 (diff) | |
download | astro-fa6b68a776c5b3cc8167fc042b7d305234ebcff9.tar.gz astro-fa6b68a776c5b3cc8167fc042b7d305234ebcff9.tar.zst astro-fa6b68a776c5b3cc8167fc042b7d305234ebcff9.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 a78a46883..32b5ebb09 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -272,15 +272,17 @@ async function generatePage( // Get paths for the route, calling getStaticPaths if needed. const paths = await getPathsForRoute(pageData, pageModule, opts, builtPaths); + let prevTimeEnd = timeStart; for (let i = 0; i < paths.length; i++) { const path = paths[i]; await generatePath(path, opts, generationOptions, manifest, onRequest); const timeEnd = performance.now(); - const timeChange = getTimeStat(timeStart, timeEnd); + const timeChange = getTimeStat(prevTimeEnd, timeEnd); const timeIncrease = `(+${timeChange})`; const filePath = getOutputFilename(opts.settings.config, path, pageData.route.type); const lineIcon = i === paths.length - 1 ? '└─' : '├─'; info(opts.logging, null, ` ${cyan(lineIcon)} ${dim(filePath)} ${dim(timeIncrease)}`); + prevTimeEnd = timeEnd; } } |