Skip to content

Commit

Permalink
Add tracking src dir usage to telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Oct 10, 2019
1 parent ec40d51 commit 915bc77
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ export default async function build(dir: string, conf = null): Promise<void> {

let backgroundWork: (Promise<any> | undefined)[] = []
backgroundWork.push(
recordVersion({ cliCommand: 'build' }),
recordVersion({
cliCommand: 'build',
pagesDir: path.relative(dir, pagesDir),
}),
recordNextPlugins(path.resolve(dir))
)

Expand Down
1 change: 0 additions & 1 deletion packages/next/next-server/server/next-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import Router, { Params, route, Route, RouteMatch } from './router'
import { sendHTML } from './send-html'
import { serveStatic } from './serve-static'
import { isBlockedPage, isInternalUrl } from './utils'
import { findPagesDir } from '../../lib/find-pages-dir'
import { initializeSprCache, getSprCache, setSprCache } from './spr-cache'

type NextConfig = any
Expand Down
5 changes: 4 additions & 1 deletion packages/next/server/next-dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ export default class DevServer extends Server {
this.setDevReady!()

setTelemetryDir(this.distDir)
recordVersion({ cliCommand: 'dev' })
recordVersion({
cliCommand: 'dev',
pagesDir: relative(this.dir, this.pagesDir!),
})
}

protected async close() {
Expand Down
2 changes: 2 additions & 0 deletions packages/next/telemetry/events/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type EventCliSessionStarted = {
nextVersion: string
nodeVersion: string
cliCommand: string
pagesDir?: string
}

export function recordVersion(
Expand All @@ -22,6 +23,7 @@ export function recordVersion(
nextVersion: process.env.__NEXT_VERSION,
nodeVersion: process.version,
cliCommand: event.cliCommand,
pagesDir: event.pagesDir,
} as EventCliSessionStarted,
})
}

0 comments on commit 915bc77

Please sign in to comment.