|
1 | | -import os from 'os' |
| 1 | +import { platform } from 'node:os' |
2 | 2 | import ci from 'ci-info' |
3 | 3 | import Conf from 'conf' |
4 | 4 | import fetch from 'node-fetch' |
5 | 5 | 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' |
7 | 13 | import { type DatabaseProvider } from '../types' |
8 | | -import { telemetryEndpoint as defaultTelemetryEndpoint } from './defaults' |
9 | 14 | import type { InitialisedList } from './core/initialise-lists' |
10 | 15 |
|
| 16 | +const defaultTelemetryEndpoint = 'https://telemetry.keystonejs.com' |
| 17 | + |
11 | 18 | const packageNames: PackageName[] = [ |
12 | 19 | '@keystone-6/core', |
13 | 20 | '@keystone-6/auth', |
@@ -60,7 +67,7 @@ function getTelemetryConfig () { |
60 | 67 | // dont copy garbage |
61 | 68 | if (typeof project !== 'object') continue |
62 | 69 | 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 |
64 | 71 |
|
65 | 72 | // only lastSentDate is retained |
66 | 73 | replacement.projects[projectPath] = { |
@@ -100,7 +107,7 @@ function getDefaultedTelemetryConfig () { |
100 | 107 |
|
101 | 108 | const todaysDate = new Date().toISOString().slice(0, 10) |
102 | 109 |
|
103 | | -function collectFieldCount (lists: Record<string, InitialisedList>) { |
| 110 | +function collectFieldCount(lists: Record<string, InitialisedList>) { |
104 | 111 | const fields: Project['fields'] = { unknown: 0 } |
105 | 112 |
|
106 | 113 | for (const list of Object.values(lists)) { |
@@ -273,7 +280,7 @@ async function sendDeviceTelemetryEvent () { |
273 | 280 |
|
274 | 281 | await sendEvent('device', { |
275 | 282 | previous: lastSentDate, |
276 | | - os: os.platform(), |
| 283 | + os: platform(), |
277 | 284 | node: process.versions.node.split('.')[0], |
278 | 285 | }) |
279 | 286 |
|
|
0 commit comments