keycloak_theme/src/bin/tools/readThisNpmPackageVersion.ts
2024-05-20 15:50:58 +02:00

17 lines
474 B
TypeScript

import { getThisCodebaseRootDirPath } from "./getThisCodebaseRootDirPath";
import { assert } from "tsafe/assert";
import * as fs from "fs";
import { join as pathJoin } from "path";
export function readThisNpmPackageVersion(): string {
const version = JSON.parse(
fs
.readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json"))
.toString("utf8")
)["version"];
assert(typeof version === "string");
return version;
}