keycloak_theme/src/bin/tools/readThisNpmPackageVersion.ts

17 lines
474 B
TypeScript
Raw Normal View History

import { getThisCodebaseRootDirPath } from "./getThisCodebaseRootDirPath";
import { assert } from "tsafe/assert";
import * as fs from "fs";
import { join as pathJoin } from "path";
2024-05-18 10:24:55 +02:00
export function readThisNpmPackageVersion(): string {
2024-05-20 15:48:51 +02:00
const version = JSON.parse(
fs
.readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json"))
.toString("utf8")
)["version"];
assert(typeof version === "string");
return version;
}