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>
27 lines
821 B
TypeScript
27 lines
821 B
TypeScript
import { execSync } from 'child_process';
|
|
|
|
// Why does Astro need a project ID? Why is it looking at my git remote?
|
|
// ---
|
|
// Astro's telemetry is and always will be completely anonymous.
|
|
// Differentiating unique projects helps us track feature usage accurately.
|
|
//
|
|
// We **never** read your actual git remote! The value is hashed one-way
|
|
// with random salt data, making it impossible for us to reverse or try to
|
|
// guess the remote by re-computing hashes.
|
|
|
|
function getProjectIdFromGit() {
|
|
try {
|
|
const originBuffer = execSync(`git config --local --get remote.origin.url`, {
|
|
timeout: 1000,
|
|
stdio: `pipe`,
|
|
});
|
|
|
|
return String(originBuffer).trim();
|
|
} catch (_) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function getRawProjectId(): string {
|
|
return getProjectIdFromGit() ?? process.env.REPOSITORY_URL ?? process.cwd();
|
|
}
|