auto get current package version

This commit is contained in:
Aman Varshney
2025-02-12 17:13:02 +05:30
parent 8a716bf9db
commit 5554818335
5 changed files with 26 additions and 2 deletions

View File

@@ -0,0 +1,11 @@
import path from "node:path";
import fs from "fs-extra";
import { PKG_ROOT } from "../consts";
export const getVersion = () => {
const packageJsonPath = path.join(PKG_ROOT, "package.json");
const packageJsonContent = fs.readJSONSync(packageJsonPath);
return packageJsonContent.version ?? "1.0.0";
};