Commit 4a60e31a authored by devjiwonchoi's avatar devjiwonchoi

Add match logging to --debug-build-paths

When glob patterns match files, log 'Pattern "..." did match N files'
to provide feedback on successful pattern matching.
parent 54d12035
...@@ -1068,5 +1068,6 @@ ...@@ -1068,5 +1068,6 @@
"1067": "The Next.js unhandled rejection filter is being installed more than once. This is a bug in Next.js.", "1067": "The Next.js unhandled rejection filter is being installed more than once. This is a bug in Next.js.",
"1068": "Expected workStore to be initialized", "1068": "Expected workStore to be initialized",
"1069": "Invariant: cache entry \"%s\" not found in dir \"%s\"", "1069": "Invariant: cache entry \"%s\" not found in dir \"%s\"",
"1070": "image of size %s could not be tracked by lru cache" "1070": "image of size %s could not be tracked by lru cache",
"1071": "Pattern \"%s\" did not match any files"
} }
...@@ -72,7 +72,11 @@ export async function resolveBuildPaths( ...@@ -72,7 +72,11 @@ export async function resolveBuildPaths(
})) as string[] })) as string[]
if (matches.length === 0) { if (matches.length === 0) {
Log.warn(`Pattern "${patterns.join(',')}" did not match any files`) throw new Error(`Pattern "${patterns.join(',')}" did not match any files`)
} else {
Log.info(
`Pattern "${patterns.join(',')}" did match ${matches.length} files`
)
} }
for (const file of matches) { for (const file of matches) {
......
// This is an auto-generated entry file that re-exports route types.
// Do not edit this file directly.
export type * from './../../.next/types/route-types.d.ts'
...@@ -251,6 +251,19 @@ describe('debug-build-paths', () => { ...@@ -251,6 +251,19 @@ describe('debug-build-paths', () => {
expect(buildResult.cliOutput).not.toContain('○ /about') expect(buildResult.cliOutput).not.toContain('○ /about')
expect(buildResult.cliOutput).not.toContain('○ /dashboard') expect(buildResult.cliOutput).not.toContain('○ /dashboard')
}) })
it('should log when pattern matches files', async () => {
const buildResult = await next.build({
args: [
'--debug-build-paths',
'app/**/page.tsx,!app/with-type-error/**',
],
})
expect(buildResult.exitCode).toBe(0)
expect(buildResult.cliOutput).toMatch(
/Pattern ".*" did match \d+ file\(s\)/
)
})
}) })
describe('typechecking with debug-build-paths', () => { describe('typechecking with debug-build-paths', () => {
......
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