silverwolf-x/project / packages /next /src /cli /next-telemetry.ts
silverwolf-x's picture
download
raw
1.4 kB
#!/usr/bin/env node
import { bold, cyan, green, red, yellow } from '../lib/picocolors'
import { Telemetry } from '../telemetry/storage'
export type NextTelemetryOptions = {
enable?: boolean
disable?: boolean
}
const telemetry = new Telemetry({ distDir: process.cwd() })
let isEnabled = telemetry.isEnabled
const nextTelemetry = (options: NextTelemetryOptions, arg: string) => {
if (options.enable || arg === 'enable') {
telemetry.setEnabled(true)
isEnabled = true
console.log(cyan('Success!'))
} else if (options.disable || arg === 'disable') {
const path = telemetry.setEnabled(false)
if (isEnabled) {
console.log(
cyan(`Your preference has been saved${path ? ` to ${path}` : ''}.`)
)
} else {
console.log(yellow(`Next.js' telemetry collection is already disabled.`))
}
isEnabled = false
} else {
console.log(bold('Next.js Telemetry'))
}
console.log(
`\nStatus: ${isEnabled ? bold(green('Enabled')) : bold(red('Disabled'))}`
)
if (isEnabled) {
console.log(
'\nNext.js telemetry is completely anonymous. Thank you for participating!'
)
} else {
console.log(
`\nYou have opted-out of Next.js' anonymous telemetry program.\nNo data will be collected from your machine.`
)
}
console.log(`\nLearn more: ${cyan('https://nextjs.org/telemetry')}`)
}
export { nextTelemetry }

Xet Storage Details

Size:
1.4 kB
·
Xet hash:
8e0f5d6d77ac06ec9ac116fcd5cbb7890c1641ba217bc5e7675aedccce93fc9c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.