@astrojs/telemetry
Advanced tools
Comparing version
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
const TELEMETRY_ENABLED = "telemetry.enabled"; | ||
@@ -2,0 +3,0 @@ const TELEMETRY_NOTIFY_DATE = "telemetry.notifiedAt"; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
import dget from "dlv"; | ||
@@ -2,0 +3,0 @@ import { dset } from "dset"; |
@@ -1,20 +0,2 @@ | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
"use strict"; | ||
import { isCI } from "ci-info"; | ||
@@ -35,4 +17,7 @@ import debug from "debug"; | ||
get astroVersion() { | ||
return this.opts.version; | ||
return this.opts.astroVersion; | ||
} | ||
get viteVersion() { | ||
return this.opts.viteVersion; | ||
} | ||
get ASTRO_TELEMETRY_DISABLED() { | ||
@@ -105,5 +90,6 @@ return process.env.ASTRO_TELEMETRY_DISABLED; | ||
} | ||
const meta = __spreadProps(__spreadValues({}, getSystemInfo(this.astroVersion)), { | ||
const meta = { | ||
...getSystemInfo({ astroVersion: this.astroVersion, viteVersion: this.viteVersion }), | ||
isGit: this.anonymousProjectInfo.isGit | ||
}); | ||
}; | ||
const context = { | ||
@@ -114,2 +100,5 @@ anonymousId: this.anonymousId, | ||
}; | ||
if (meta.isCI) { | ||
context.anonymousId = `CI.${meta.ciName || "UNKNOWN"}`; | ||
} | ||
return post({ | ||
@@ -116,0 +105,0 @@ context, |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
import fetch from "node-fetch"; | ||
@@ -2,0 +3,0 @@ const ASTRO_TELEMETRY_ENDPOINT = `https://telemetry.astro.build/api/v1/record`; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
import { execSync } from "child_process"; | ||
@@ -2,0 +3,0 @@ import { createHash } from "node:crypto"; |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
import { isCI, name as ciName } from "ci-info"; | ||
@@ -6,3 +7,3 @@ import isDocker from "is-docker"; | ||
let meta; | ||
function getSystemInfo(astroVersion) { | ||
function getSystemInfo(versions) { | ||
if (meta) { | ||
@@ -13,2 +14,5 @@ return meta; | ||
meta = { | ||
nodeVersion: process.version.replace(/^v?/, ""), | ||
viteVersion: versions.viteVersion, | ||
astroVersion: versions.astroVersion, | ||
systemPlatform: os.platform(), | ||
@@ -24,4 +28,3 @@ systemRelease: os.release(), | ||
isCI, | ||
ciName, | ||
astroVersion | ||
ciName | ||
}; | ||
@@ -28,0 +31,0 @@ return meta; |
export declare type AstroTelemetryOptions = { | ||
version: string; | ||
astroVersion: string; | ||
viteVersion: string; | ||
}; | ||
@@ -15,2 +16,3 @@ export declare type TelemetryEvent = { | ||
private get astroVersion(); | ||
private get viteVersion(); | ||
private get ASTRO_TELEMETRY_DISABLED(); | ||
@@ -17,0 +19,0 @@ private get TELEMETRY_DISABLED(); |
@@ -29,2 +29,5 @@ /// <reference types="node" /> | ||
systemArchitecture: string; | ||
astroVersion: string; | ||
nodeVersion: string; | ||
viteVersion: string; | ||
cpuCount: number; | ||
@@ -38,4 +41,6 @@ cpuModel: string | null; | ||
ciName: string | null; | ||
}; | ||
export declare function getSystemInfo(versions: { | ||
viteVersion: string; | ||
astroVersion: string; | ||
}; | ||
export declare function getSystemInfo(astroVersion: string): SystemInfo; | ||
}): SystemInfo; |
{ | ||
"name": "@astrojs/telemetry", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"type": "module", | ||
@@ -36,3 +36,3 @@ "types": "./dist/types/index.d.ts", | ||
"@types/node": "^14.18.21", | ||
"astro-scripts": "0.0.5" | ||
"astro-scripts": "0.0.6" | ||
}, | ||
@@ -39,0 +39,0 @@ "engines": { |
435
0.69%18651
-1.72%