Unverified Commit 26f8793e authored by Steven's avatar Steven Committed by GitHub

chore: add telemetry for `output: export` (#47464)

fix NEXT-870 ([link](https://linear.app/vercel/issue/NEXT-870))
parent 2a257cef
......@@ -26,6 +26,7 @@ type EventCliSessionStarted = {
imageSizes: string | null
imageLoader: string | null
imageFormats: string | null
nextConfigOutput: string | null
trailingSlashEnabled: boolean
reactStrictMode: boolean
webpackVersion: number | null
......@@ -75,6 +76,7 @@ export function eventCliSession(
| 'imageSizes'
| 'imageLoader'
| 'imageFormats'
| 'nextConfigOutput'
| 'trailingSlashEnabled'
| 'reactStrictMode'
>
......@@ -111,6 +113,7 @@ export function eventCliSession(
imageSizes: images?.imageSizes ? images.imageSizes.join(',') : null,
imageLoader: images?.loader,
imageFormats: images?.formats ? images.formats.join(',') : null,
nextConfigOutput: nextConfig?.output || null,
trailingSlashEnabled: !!nextConfig?.trailingSlash,
reactStrictMode: !!nextConfig?.reactStrictMode,
webpackVersion: event.webpackVersion || null,
......
......@@ -66,6 +66,7 @@ describe('config telemetry', () => {
expect(event1).toMatch(/"imageRemotePatternsCount": 1/)
expect(event1).toMatch(/"imageSizes": "64,128,256,512,1024"/)
expect(event1).toMatch(/"imageFormats": "image\/avif,image\/webp"/)
expect(event1).toMatch(/"nextConfigOutput": null/)
expect(event1).toMatch(/"trailingSlashEnabled": false/)
expect(event1).toMatch(/"reactStrictMode": false/)
expect(event1).toMatch(/"turboFlag": false/)
......@@ -105,10 +106,32 @@ describe('config telemetry', () => {
expect(event2).toMatch(/"imageDomainsCount": 2/)
expect(event2).toMatch(/"imageRemotePatternsCount": 1/)
expect(event2).toMatch(/"imageSizes": "64,128,256,512,1024"/)
expect(event2).toMatch(/"nextConfigOutput": null/)
expect(event2).toMatch(/"trailingSlashEnabled": false/)
expect(event2).toMatch(/"reactStrictMode": false/)
})
it('detects output config for session start', async () => {
await fs.writeFile(
'./next.config.js',
'module.exports = { output: "export" }'
)
try {
const { stderr } = await nextBuild(appDir, [], {
stderr: true,
env: { NEXT_TELEMETRY_DEBUG: 1 },
})
const event1 = /NEXT_CLI_SESSION_STARTED[\s\S]+?{([\s\S]+?)}/
.exec(stderr)
.pop()
expect(event1).toContain('"nextConfigOutput": "export"')
} finally {
await fs.remove('./next.config.js')
}
})
it('emits telemetry for lint during build', async () => {
await fs.writeFile(
path.join(appDir, '.eslintrc'),
......
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