Unverified Commit 85157419 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

Fix logging order of build jobs (#60564)

The Next.js version should always be output first instead of other jobs
in `next build`

Closes NEXT-2078
parent 10e8f4d4
...@@ -806,6 +806,15 @@ export default async function build( ...@@ -806,6 +806,15 @@ export default async function build(
telemetry.record(events) telemetry.record(events)
) )
// Always log next version first then start rest jobs
const { envInfo, expFeatureInfo } = await getStartServerInfo(dir)
logStartInfo({
networkUrl: null,
appUrl: null,
envInfo,
expFeatureInfo,
})
const ignoreESLint = Boolean(config.eslint.ignoreDuringBuilds) const ignoreESLint = Boolean(config.eslint.ignoreDuringBuilds)
const shouldLint = !ignoreESLint && runLint const shouldLint = !ignoreESLint && runLint
...@@ -845,14 +854,6 @@ export default async function build( ...@@ -845,14 +854,6 @@ export default async function build(
payload: buildLintEvent, payload: buildLintEvent,
}) })
const { envInfo, expFeatureInfo } = await getStartServerInfo(dir)
logStartInfo({
networkUrl: null,
appUrl: null,
envInfo,
expFeatureInfo,
})
const validFileMatcher = createValidFileMatcher( const validFileMatcher = createValidFileMatcher(
config.pageExtensions, config.pageExtensions,
appDir appDir
......
...@@ -5,8 +5,8 @@ createNextDescribe( ...@@ -5,8 +5,8 @@ createNextDescribe(
'production - app dir - build output', 'production - app dir - build output',
{ {
files: { files: {
'app/page.js': `export default function Page() { return null }`, 'app/page.tsx': `export default function Page() { return null }`,
'app/layout.js': `export default function Layout({ children }) { 'app/layout.tsx': `export default function Layout({ children }) {
return ( return (
<html><body>{children}</body></html> <html><body>{children}</body></html>
) )
...@@ -14,15 +14,30 @@ createNextDescribe( ...@@ -14,15 +14,30 @@ createNextDescribe(
}, },
}, },
({ next }) => { ({ next }) => {
let output = ''
beforeAll(() => {
output = stripAnsi(next.cliOutput)
})
it('should only log app routes', async () => { it('should only log app routes', async () => {
const output = next.cliOutput
expect(output).toContain('Route (app)') expect(output).toContain('Route (app)')
expect(output).not.toContain('Route (pages)') expect(output).not.toContain('Route (pages)')
expect(output).not.toContain('/favicon.ico') expect(output).not.toContain('/favicon.ico')
}) })
it('should always log version first then the rest jobs', async () => {
const indexOfVersion = output.indexOf('▲ Next.js')
const indexOfStartCompiling = output.indexOf(
'Creating an optimized production build'
)
const indexOfLinting = output.indexOf(
'Linting and checking validity of types'
)
expect(indexOfVersion).toBeLessThan(indexOfLinting)
expect(indexOfStartCompiling).toBeLessThan(indexOfLinting)
})
it('should match the expected output format', async () => { it('should match the expected output format', async () => {
const output = stripAnsi(next.cliOutput)
expect(output).toContain('Size') expect(output).toContain('Size')
expect(output).toContain('First Load JS') expect(output).toContain('First Load JS')
expect(output).toContain('+ First Load JS shared by all') expect(output).toContain('+ First Load JS shared by all')
......
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