mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
auto get current package version
This commit is contained in:
11
apps/cli/src/utils/get-version.ts
Normal file
11
apps/cli/src/utils/get-version.ts
Normal 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";
|
||||
};
|
||||
Reference in New Issue
Block a user