From 9b9f327a3a952ce155129e3d08ec54ba5406802c Mon Sep 17 00:00:00 2001 From: hasezoey Date: Tue, 3 May 2022 17:31:40 +0200 Subject: [PATCH] style(resolveConfig): add tsdoc to some values and interfaces --- .../mongodb-memory-server-core/src/util/resolveConfig.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/mongodb-memory-server-core/src/util/resolveConfig.ts b/packages/mongodb-memory-server-core/src/util/resolveConfig.ts index 309bd6123..fc14caccf 100644 --- a/packages/mongodb-memory-server-core/src/util/resolveConfig.ts +++ b/packages/mongodb-memory-server-core/src/util/resolveConfig.ts @@ -7,6 +7,7 @@ import { isNullOrUndefined } from './utils'; const log = debug('MongoMS:ResolveConfig'); +/** Enum of all possible config options */ export enum ResolveConfigVariables { DOWNLOAD_DIR = 'DOWNLOAD_DIR', PLATFORM = 'PLATFORM', @@ -26,9 +27,11 @@ export enum ResolveConfigVariables { USE_ARCHIVE_NAME_FOR_BINARY_NAME = 'USE_ARCHIVE_NAME_FOR_BINARY_NAME', } +/** The Prefix for Environmental values */ export const ENV_CONFIG_PREFIX = 'MONGOMS_'; /** This Value exists here, because "defaultValues" can be changed with "setDefaultValue", but this property is constant */ export const DEFAULT_VERSION = '5.0.8'; +/** Default values for some config options that require explicit setting, it is constant so that the default values cannot be interfered with */ export const defaultValues = new Map([ // apply app-default values here [ResolveConfigVariables.VERSION, DEFAULT_VERSION], @@ -39,6 +42,7 @@ export const defaultValues = new Map([ [ResolveConfigVariables.USE_ARCHIVE_NAME_FOR_BINARY_NAME, 'false'], ]); +/** Interface for storing information about the found package.json from `findPackageJson` */ interface PackageJSON { /** The Path where the package.json was found (directory, not the file) */ filePath: string; @@ -57,6 +61,7 @@ export function setDefaultValue(key: ResolveConfigVariables, value: string): voi } // let packageJsonConfig: Record = {}; +/** Cache the found package.json file */ let packagejson: PackageJSON | undefined = undefined; /** * Find the nearest package.json (that has an non-empty config field) for the provided directory