diff --git a/src/Util.ts b/src/Util.ts index 3358f14..a0895ca 100644 --- a/src/Util.ts +++ b/src/Util.ts @@ -4,13 +4,17 @@ import {ApiErrorResponseSchema} from "./kms/KmsApi"; import {TenantSecurityErrorCode, TenantSecurityException} from "./TenantSecurityException"; import {TenantSecurityExceptionUtils} from "./TenantSecurityExceptionUtils"; import {TspServiceException} from "./TspServiceException"; -import {version} from "../package.json"; import * as Crypto from "./kms/Crypto"; import * as DetCrypto from "./kms/DeterministicCrypto"; import * as http from "http"; import * as https from "https"; import * as Joi from "joi"; +// Loaded via require so tsc doesn't include package.json in the program and +// elevate the inferred rootDir above ./src (which would nest the build output). +// eslint-disable-next-line @typescript-eslint/no-var-requires +const {version} = require("../package.json") as {version: string}; + /** * Try to JSON parse error responses from the TSP to extract error codes and messages. */ diff --git a/tsconfig.json b/tsconfig.json index 406c78e..9ab46fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "noUnusedLocals": true, "declaration": false, "target": "ES6", + "rootDir": "./src", "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true,