Unverified Commit b79591cd authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

simplify output messages (#31454)

remove all `client/server/middleware only` messages and show `client and server` instead only when both compilers has been used.
parent 93754859
...@@ -110,7 +110,7 @@ function runNextCommandDev(argv, opts = {}) { ...@@ -110,7 +110,7 @@ function runNextCommandDev(argv, opts = {}) {
function handleStdout(data) { function handleStdout(data) {
const message = data.toString() const message = data.toString()
const bootupMarkers = { const bootupMarkers = {
dev: /compiled successfully/i, dev: /compiled .*successfully/i,
start: /started server/i, start: /started server/i,
} }
if ( if (
......
...@@ -139,12 +139,8 @@ buildStore.subscribe((state) => { ...@@ -139,12 +139,8 @@ buildStore.subscribe((state) => {
loading: false, loading: false,
typeChecking: false, typeChecking: false,
partial: partial:
clientWasLoading && !serverWasLoading && !serverWebWasLoading clientWasLoading && (serverWasLoading || serverWebWasLoading)
? 'client' ? 'client and server'
: serverWasLoading && !clientWasLoading && !serverWebWasLoading
? 'server'
: serverWebWasLoading && !clientWasLoading && !serverWasLoading
? 'serverWeb'
: undefined, : undefined,
modules: modules:
(clientWasLoading ? client.modules : 0) + (clientWasLoading ? client.modules : 0) +
......
...@@ -15,7 +15,7 @@ export type OutputState = ...@@ -15,7 +15,7 @@ export type OutputState =
| { | {
loading: false loading: false
typeChecking: boolean typeChecking: boolean
partial: 'client' | 'server' | 'serverWeb' | undefined partial: 'client and server' | undefined
modules: number modules: number
errors: string[] | null errors: string[] | null
warnings: string[] | null warnings: string[] | null
......
...@@ -259,13 +259,9 @@ export default function onDemandEntryHandler( ...@@ -259,13 +259,9 @@ export default function onDemandEntryHandler(
if (entriesChanged) { if (entriesChanged) {
reportTrigger( reportTrigger(
isApiRoute isApiRoute || isMiddleware || clientOnly
? `${normalizedPage} (server only)` ? normalizedPage
: isMiddleware : `${normalizedPage} (client and server)`
? `${normalizedPage} (middleware only)`
: clientOnly
? `${normalizedPage} (client only)`
: normalizedPage
) )
invalidator.invalidate() invalidator.invalidate()
} }
......
...@@ -57,9 +57,11 @@ describe('basic HMR', () => { ...@@ -57,9 +57,11 @@ describe('basic HMR', () => {
expect(next.cliOutput.slice(start)).toContain('compiling...') expect(next.cliOutput.slice(start)).toContain('compiling...')
expect(next.cliOutput.slice(start)).toContain( expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/contact...' 'compiling /hmr/contact (client and server)...'
)
expect(next.cliOutput).toContain(
'compiling /_error (client and server)...'
) )
expect(next.cliOutput).toContain('compiling /_error...')
} finally { } finally {
if (browser) { if (browser) {
await browser.close() await browser.close()
...@@ -327,9 +329,11 @@ describe('basic HMR', () => { ...@@ -327,9 +329,11 @@ describe('basic HMR', () => {
) )
expect(next.cliOutput.slice(start)).toContain( expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/new-page...' 'compiling /hmr/new-page (client and server)...'
)
expect(next.cliOutput).toContain(
'compiling /_error (client and server)...'
) )
expect(next.cliOutput).toContain('compiling /_error...')
} catch (err) { } catch (err) {
await next.deleteFile(newPage) await next.deleteFile(newPage)
throw err throw err
...@@ -358,9 +362,11 @@ describe('basic HMR', () => { ...@@ -358,9 +362,11 @@ describe('basic HMR', () => {
await check(() => getBrowserBodyText(browser), /This is the about page/) await check(() => getBrowserBodyText(browser), /This is the about page/)
expect(next.cliOutput.slice(start)).toContain( expect(next.cliOutput.slice(start)).toContain(
'compiling /hmr/about2...' 'compiling /hmr/about2 (client and server)...'
)
expect(next.cliOutput).toContain(
'compiling /_error (client and server)...'
) )
expect(next.cliOutput).toContain('compiling /_error...')
} catch (err) { } catch (err) {
await next.patchFile(aboutPage, aboutContent) await next.patchFile(aboutPage, aboutContent)
if (browser) { if (browser) {
......
...@@ -519,7 +519,7 @@ describe('AMP Usage', () => { ...@@ -519,7 +519,7 @@ describe('AMP Usage', () => {
}) })
it('should not contain missing files warning', async () => { it('should not contain missing files warning', async () => {
expect(output).toContain('compiled successfully') expect(output).toContain('compiled client and server successfully')
expect(output).toContain('compiling /only-amp') expect(output).toContain('compiling /only-amp')
expect(output).not.toContain('Could not find files for') expect(output).not.toContain('Could not find files for')
}) })
......
/* eslint-env jest */ /* eslint-env jest */
import fs from 'fs-extra' import fs from 'fs-extra'
import { join } from 'path' import { join } from 'path'
import { launchApp, findPort, nextBuild } from 'next-test-utils' import { launchApp, findPort, nextBuild, killApp } from 'next-test-utils'
const appDir = join(__dirname, '..') const appDir = join(__dirname, '..')
const nextConfig = join(appDir, 'next.config.js') const nextConfig = join(appDir, 'next.config.js')
...@@ -27,7 +27,7 @@ const runTests = () => { ...@@ -27,7 +27,7 @@ const runTests = () => {
const stdout = await getStdout() const stdout = await getStdout()
expect(stdout).toContain('ompiled successfully') expect(stdout).toMatch(/compiled .*successfully/i)
}) })
it('should ignore configs set to `null` in next.config.js', async () => { it('should ignore configs set to `null` in next.config.js', async () => {
...@@ -48,7 +48,7 @@ const runTests = () => { ...@@ -48,7 +48,7 @@ const runTests = () => {
const stdout = await getStdout() const stdout = await getStdout()
expect(stdout).toContain('ompiled successfully') expect(stdout).toMatch(/compiled .*successfully/i)
}) })
} }
...@@ -59,11 +59,12 @@ describe('Nullish configs in next.config.js', () => { ...@@ -59,11 +59,12 @@ describe('Nullish configs in next.config.js', () => {
beforeAll(() => { beforeAll(() => {
getStdout = async () => { getStdout = async () => {
let stdout = '' let stdout = ''
await launchApp(appDir, await findPort(), { const app = await launchApp(appDir, await findPort(), {
onStdout: (msg) => { onStdout: (msg) => {
stdout += msg stdout += msg
}, },
}) })
await killApp(app)
return stdout return stdout
} }
}) })
......
...@@ -240,7 +240,7 @@ export function runNextCommandDev(argv, stdOut, opts = {}) { ...@@ -240,7 +240,7 @@ export function runNextCommandDev(argv, stdOut, opts = {}) {
function handleStdout(data) { function handleStdout(data) {
const message = data.toString() const message = data.toString()
const bootupMarkers = { const bootupMarkers = {
dev: /compiled successfully/i, dev: /compiled .*successfully/i,
start: /started server/i, start: /started server/i,
} }
if ( if (
......
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