mirror of
https://github.com/hanzoai/analytics.git
synced 2026-10-30 15:05:29 +00:00
The route tree moves from src/app/api to src/app/v1, and every caller moves with it: the dashboard's useApi base, the tracker and recorder collect paths, the Next headers and rewrites, the container middleware, the compose healthchecks and the Cypress API tests. The /v1/analytics alias is gone; /v1 is the one prefix. The build-time telemetry post to an upstream endpoint nothing serves is deleted. v1-surface.test.ts fails if src/app/api returns or any first-party file names an /api/ path. Claude-Session: https://claude.ai/code/session_011i2AG9nwpiKUCVxAdDzYuU
17 lines
441 B
JavaScript
17 lines
441 B
JavaScript
/* eslint-disable no-console */
|
|
import 'dotenv/config';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
const endPoint = process.env.COLLECT_API_ENDPOINT;
|
|
|
|
if (endPoint) {
|
|
const file = path.resolve(process.cwd(), 'public/script.js');
|
|
|
|
const tracker = fs.readFileSync(file);
|
|
|
|
fs.writeFileSync(path.resolve(file), tracker.toString().replace(/\/v1\/send/g, endPoint));
|
|
|
|
console.log(`Updated tracker endpoint: ${endPoint}.`);
|
|
}
|