Skip to content

Commit 4bc4670

Browse files
committed
inline telemetryEndpoint constant
1 parent 336a9af commit 4bc4670

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

packages/core/src/lib/defaults.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export const healthCheckPath = '/_healthcheck'
2-
export const telemetryEndpoint = 'https://telemetry.keystonejs.com'

packages/core/src/lib/telemetry.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
import os from 'os'
1+
import { platform } from 'node:os'
22
import ci from 'ci-info'
33
import Conf from 'conf'
44
import fetch from 'node-fetch'
55
import chalk from 'chalk'
6-
import { type Configuration, type Telemetry, type Project, type Device, type PackageName } from '../types/telemetry'
6+
import {
7+
type Configuration,
8+
type Device,
9+
type PackageName,
10+
type Project,
11+
type Telemetry,
12+
} from '../types/telemetry'
713
import { type DatabaseProvider } from '../types'
8-
import { telemetryEndpoint as defaultTelemetryEndpoint } from './defaults'
914
import type { InitialisedList } from './core/initialise-lists'
1015

16+
const defaultTelemetryEndpoint = 'https://telemetry.keystonejs.com'
17+
1118
const packageNames: PackageName[] = [
1219
'@keystone-6/core',
1320
'@keystone-6/auth',
@@ -60,7 +67,7 @@ function getTelemetryConfig () {
6067
// dont copy garbage
6168
if (typeof project !== 'object') continue
6269
if (typeof project.lastSentDate !== 'string') continue
63-
if (new Date(project.lastSentDate).toString() === 'Invalid Date') continue
70+
if (new Date(project.lastSentDate).toString () === 'Invalid Date') continue
6471

6572
// only lastSentDate is retained
6673
replacement.projects[projectPath] = {
@@ -100,7 +107,7 @@ function getDefaultedTelemetryConfig () {
100107

101108
const todaysDate = new Date().toISOString().slice(0, 10)
102109

103-
function collectFieldCount (lists: Record<string, InitialisedList>) {
110+
function collectFieldCount(lists: Record<string, InitialisedList>) {
104111
const fields: Project['fields'] = { unknown: 0 }
105112

106113
for (const list of Object.values(lists)) {
@@ -273,7 +280,7 @@ async function sendDeviceTelemetryEvent () {
273280

274281
await sendEvent('device', {
275282
previous: lastSentDate,
276-
os: os.platform(),
283+
os: platform(),
277284
node: process.versions.node.split('.')[0],
278285
})
279286

0 commit comments

Comments
 (0)