mirror of
https://github.com/fosrl/pangolin.git
synced 2025-06-21 04:45:41 +02:00
16 lines
495 B
TypeScript
16 lines
495 B
TypeScript
import path from "path";
|
|
import { __DIRNAME } from "@server/lib/consts";
|
|
import fs from "fs";
|
|
|
|
export function loadAppVersion() {
|
|
const packageJsonPath = path.join("package.json");
|
|
let packageJson: any;
|
|
if (fs.existsSync && fs.existsSync(packageJsonPath)) {
|
|
const packageJsonContent = fs.readFileSync(packageJsonPath, "utf8");
|
|
packageJson = JSON.parse(packageJsonContent);
|
|
|
|
if (packageJson.version) {
|
|
return packageJson.version;
|
|
}
|
|
}
|
|
}
|