@fortedigital/nextjs-cache-handler
Version:
Next.js cache handlers
24 lines (23 loc) • 594 B
JavaScript
// src/helpers/getClientInfoTag.ts
import { readFileSync } from "fs";
import { resolve } from "path";
function getPackageVersion() {
try {
const packageJsonPath = resolve(__dirname, "..", "..", "package.json");
const content = readFileSync(packageJsonPath, "utf-8");
const packageJson = JSON.parse(content);
return packageJson.version;
} catch {
return void 0;
}
}
function getClientInfoTag() {
const version = getPackageVersion();
if (version) {
return `nextjs-cache-handler_v${version}`;
}
return "nextjs-cache-handler";
}
export {
getClientInfoTag
};