f76038ac7d
* feat: add @astrojs/telemetry * feat: add telemetry events, add queueing system * feat(telemetry): record CLI events * chore: add note * feat: support generic TELEMETRY_DISABLED env var * Fix test script * shim telemetry in tests * Shim telemetry in other commands * Stub telemetry in the memory leak test * Disable telemetry in smoke tests * Adds a changeset * Run the formatter * few updates * Include config keys * Add shallow viteKeys array: : * Add vite keys and tests Co-authored-by: Nate Moore <nate@skypack.dev>
13 lines
369 B
TypeScript
13 lines
369 B
TypeScript
import fetch from 'node-fetch';
|
|
const ASTRO_TELEMETRY_ENDPOINT = `https://telemetry.astro.build/api/v1/record`;
|
|
const noop = () => {};
|
|
|
|
export function post(body: Record<string, any>) {
|
|
return fetch(ASTRO_TELEMETRY_ENDPOINT, {
|
|
method: 'POST',
|
|
body: JSON.stringify(body),
|
|
headers: { 'content-type': 'application/json' },
|
|
})
|
|
.catch(noop)
|
|
.then(noop, noop);
|
|
}
|