checkpoint
This commit is contained in:
@ -3,7 +3,13 @@ import { assert } from "tsafe/assert";
|
||||
import * as fs from "fs";
|
||||
import { join as pathJoin } from "path";
|
||||
|
||||
let cache: string | undefined = undefined;
|
||||
|
||||
export function readThisNpmPackageVersion(): string {
|
||||
if (cache !== undefined) {
|
||||
return cache;
|
||||
}
|
||||
|
||||
const version = JSON.parse(
|
||||
fs
|
||||
.readFileSync(pathJoin(getThisCodebaseRootDirPath(), "package.json"))
|
||||
@ -12,5 +18,7 @@ export function readThisNpmPackageVersion(): string {
|
||||
|
||||
assert(typeof version === "string");
|
||||
|
||||
cache = version;
|
||||
|
||||
return version;
|
||||
}
|
||||
|
Reference in New Issue
Block a user