Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record src directory usage with version #9023

Merged
merged 7 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions packages/next/build/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export default async function build(dir: string, conf = null): Promise<void> {
)
}

const buildSpinner = createSpinner({
prefixText: 'Creating an optimized production build',
})

const config = loadConfig(PHASE_PRODUCTION_BUILD, dir, conf)
const { target } = config
const buildId = await generateBuildId(config.generateBuildId, nanoid)
Expand All @@ -109,10 +113,6 @@ export default async function build(dir: string, conf = null): Promise<void> {
}
}

const buildSpinner = createSpinner({
prefixText: 'Creating an optimized production build',
})

const telemetry = new Telemetry({ distDir })

const publicDir = path.join(dir, 'public')
Expand All @@ -122,7 +122,12 @@ export default async function build(dir: string, conf = null): Promise<void> {

let backgroundWork: (Promise<any> | undefined)[] = []
backgroundWork.push(
telemetry.record(eventVersion({ cliCommand: 'build' })),
telemetry.record(
eventVersion({
cliCommand: 'build',
isSrcDir: pagesDir.startsWith('src'),
})
),
eventNextPlugins(path.resolve(dir)).then(events => telemetry.record(events))
)

Expand Down
2 changes: 1 addition & 1 deletion packages/next/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export default async function(
const distDir = join(dir, nextConfig.distDir)
if (!options.buildExport) {
const telemetry = new Telemetry({ distDir })
telemetry.record(eventVersion({ cliCommand: 'export' }))
telemetry.record(eventVersion({ cliCommand: 'export', isSrcDir: null }))
}

const subFolders = nextConfig.exportTrailingSlash
Expand Down
7 changes: 6 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,12 @@ export default class DevServer extends Server {
this.setDevReady!()

const telemetry = new Telemetry({ distDir: this.distDir })
telemetry.record(eventVersion({ cliCommand: 'dev' }))
telemetry.record(
eventVersion({
cliCommand: 'dev',
isSrcDir: this.pagesDir!.startsWith('src'),
})
)
}

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 @@ -4,6 +4,7 @@ type EventCliSessionStarted = {
nextVersion: string
nodeVersion: string
cliCommand: string
isSrcDir: boolean | null
}

export function eventVersion(
Expand All @@ -21,6 +22,7 @@ export function eventVersion(
nextVersion: process.env.__NEXT_VERSION,
nodeVersion: process.version,
cliCommand: event.cliCommand,
isSrcDir: event.isSrcDir,
} as EventCliSessionStarted,
},
]
Expand Down