mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Bake PostHog + Sentry into the published Docker image (SNAPOTTER_ANALYTICS build arg, codegen script). Delete entire consent system. Move event emission to BullMQ worker. Add cross-tier identity stitching, Sentry performance tracing on both tiers, frontend funnel events. Fix stateful regex bug. 86 files changed, 1593 insertions(+), 3747 deletions(-)
30 lines
1017 B
JavaScript
30 lines
1017 B
JavaScript
import { writeFileSync } from "node:fs";
|
|
import { resolve, dirname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
const outPath = resolve(__dirname, "../packages/shared/src/analytics/baked.ts");
|
|
|
|
const mode = process.argv[2] || "on";
|
|
|
|
const enabled = mode === "on";
|
|
const posthogApiKey = enabled ? "phc_REPLACE_WITH_REAL_KEY" : "";
|
|
const posthogHost = enabled ? "https://us.i.posthog.com" : "";
|
|
const sentryDsn = enabled
|
|
? "https://REPLACE_WITH_REAL_DSN@o0.ingest.us.sentry.io/0"
|
|
: "";
|
|
const sampleRate = enabled ? 1 : 0;
|
|
|
|
const content = `// AUTO-GENERATED by scripts/bake-analytics.mjs -- do not edit manually
|
|
export const ANALYTICS_BAKED = {
|
|
enabled: ${enabled},
|
|
posthogApiKey: "${posthogApiKey}",
|
|
posthogHost: "${posthogHost}",
|
|
sentryDsn: "${sentryDsn}",
|
|
sampleRate: ${sampleRate},
|
|
} as const;
|
|
`;
|
|
|
|
writeFileSync(outPath, content, "utf-8");
|
|
console.log(`bake-analytics: wrote ${outPath} (mode=${mode}, enabled=${enabled})`);
|