Unverified Commit 281ae418 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Fix build output logging order (#56335)

Closes NEXT-1671 

Move "Finalizing" to the bottom, and print tree view after file tracing
spinner

### After
```
 ✓ Generating static pages (5/5)
 ✓ Collecting build traces
 ✓ Finalizing page optimization

Route (app)                              Size     First Load JS
┌ ○ /                                    133 B            80 kB
└ ○ /_not-found                          876 B          80.8 kB
+ First Load JS shared by all            79.9 kB
  ├ chunks/main-app-f7da6251716e8121.js  78.2 kB
  └ chunks/webpack-bf1a64d1eafd2816.js   1.66 kB
```

### Before

```
 ✓ Generating static pages (5/5)
 ✓ Finalizing page optimization

   Collecting build traces  .Route (app)                              Size     First Load JS
┌ ○ /                                    133 B            80 kB
└ ○ /_not-found                          876 B          80.8 kB
+ First Load JS shared by all            79.9 kB
  ├ chunks/main-app-f7da6251716e8121.js  78.2 kB
  └ chunks/webpack-bf1a64d1eafd2816.js   1.66 kB


○  (Static)  automatically rendered as static HTML (uses no initial props)

 ✓ Collecting build traces
 ```
parent d7626ffb
...@@ -2080,7 +2080,6 @@ export default async function build( ...@@ -2080,7 +2080,6 @@ export default async function build(
await exportApp(dir, exportOptions, nextBuildSpan) await exportApp(dir, exportOptions, nextBuildSpan)
const postBuildSpinner = createSpinner('Finalizing page optimization')
ssgNotFoundPaths = exportConfig.ssgNotFoundPaths ssgNotFoundPaths = exportConfig.ssgNotFoundPaths
// remove server bundles that were exported // remove server bundles that were exported
...@@ -2531,12 +2530,10 @@ export default async function build( ...@@ -2531,12 +2530,10 @@ export default async function build(
JSON.stringify(pagesManifest, null, 2), JSON.stringify(pagesManifest, null, 2),
'utf8' 'utf8'
) )
if (postBuildSpinner) postBuildSpinner.stopAndPersist()
console.log()
}) })
} }
const postBuildSpinner = createSpinner('Finalizing page optimization')
let buildTracesSpinner = createSpinner(`Collecting build traces`) let buildTracesSpinner = createSpinner(`Collecting build traces`)
// ensure the worker is not left hanging // ensure the worker is not left hanging
...@@ -2697,20 +2694,6 @@ export default async function build( ...@@ -2697,20 +2694,6 @@ export default async function build(
return Promise.reject(err) return Promise.reject(err)
}) })
await nextBuildSpan.traceChild('print-tree-view').traceAsyncFn(() =>
printTreeView(pageKeys, pageInfos, {
distPath: distDir,
buildId: buildId,
pagesDir,
useStaticPages404,
pageExtensions: config.pageExtensions,
appBuildManifest,
buildManifest,
middlewareManifest,
gzipSize: config.experimental.gzipSize,
})
)
if (debugOutput) { if (debugOutput) {
nextBuildSpan nextBuildSpan
.traceChild('print-custom-routes') .traceChild('print-custom-routes')
...@@ -2857,6 +2840,23 @@ export default async function build( ...@@ -2857,6 +2840,23 @@ export default async function build(
buildTracesSpinner = undefined buildTracesSpinner = undefined
} }
if (postBuildSpinner) postBuildSpinner.stopAndPersist()
console.log()
await nextBuildSpan.traceChild('print-tree-view').traceAsyncFn(() =>
printTreeView(pageKeys, pageInfos, {
distPath: distDir,
buildId: buildId,
pagesDir,
useStaticPages404,
pageExtensions: config.pageExtensions,
appBuildManifest,
buildManifest,
middlewareManifest,
gzipSize: config.experimental.gzipSize,
})
)
await nextBuildSpan await nextBuildSpan
.traceChild('telemetry-flush') .traceChild('telemetry-flush')
.traceAsyncFn(() => telemetry.flush()) .traceAsyncFn(() => telemetry.flush())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment