Skip to content

Commit

Permalink
Polish auto create layout warning color
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 21, 2023
1 parent e6fbeab commit f8d3099
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/next/src/build/webpack/loaders/next-app-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from 'path'
import { stringify } from 'querystring'
import { bold } from '../../../lib/picocolors'
import { getModuleBuildInfo } from './get-module-build-info'
import { verifyRootLayout } from '../../../lib/verifyRootLayout'
import { verifyRootLayout } from '../../../lib/verify-root-layout'
import * as Log from '../../output/log'
import { APP_DIR_ALIAS, WEBPACK_RESOURCE_QUERIES } from '../../../lib/constants'
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'
import * as Log from '../build/output/log'
import { promises as fs } from 'fs'
import { bold, green } from './picocolors'
import { bold } from './picocolors'
import { APP_DIR_ALIAS } from './constants'

const globOrig =
Expand Down Expand Up @@ -123,14 +124,12 @@ export async function verifyRootLayout({
)
await fs.writeFile(rootLayoutPath, getRootLayout(hasTsConfig))

console.log(
green(
`\nYour page ${bold(
`app/${normalizedPagePath}`
)} did not have a root layout. We created ${bold(
`app${rootLayoutPath.replace(appDir, '')}`
)} for you.`
) + '\n'
Log.warn(
`Your page ${bold(
`app/${normalizedPagePath}`
)} did not have a root layout. We created ${bold(
`app${rootLayoutPath.replace(appDir, '')}`
)} for you.`
)

// Created root layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ describe('app-dir create root layout', () => {
path.join(__dirname, 'next.config.js')
),
},
dependencies: {
react: 'latest',
'react-dom': 'latest',
},
})
})
afterAll(() => next.destroy())
Expand Down

0 comments on commit f8d3099

Please sign in to comment.