@@ -7,6 +7,7 @@ import { isNullOrUndefined } from './utils';
77
88const log = debug ( 'MongoMS:ResolveConfig' ) ;
99
10+ /** Enum of all possible config options */
1011export enum ResolveConfigVariables {
1112 DOWNLOAD_DIR = 'DOWNLOAD_DIR' ,
1213 PLATFORM = 'PLATFORM' ,
@@ -26,9 +27,11 @@ export enum ResolveConfigVariables {
2627 USE_ARCHIVE_NAME_FOR_BINARY_NAME = 'USE_ARCHIVE_NAME_FOR_BINARY_NAME' ,
2728}
2829
30+ /** The Prefix for Environmental values */
2931export const ENV_CONFIG_PREFIX = 'MONGOMS_' ;
3032/** This Value exists here, because "defaultValues" can be changed with "setDefaultValue", but this property is constant */
3133export const DEFAULT_VERSION = '5.0.8' ;
34+ /** Default values for some config options that require explicit setting, it is constant so that the default values cannot be interfered with */
3235export const defaultValues = new Map < ResolveConfigVariables , string > ( [
3336 // apply app-default values here
3437 [ ResolveConfigVariables . VERSION , DEFAULT_VERSION ] ,
@@ -39,6 +42,7 @@ export const defaultValues = new Map<ResolveConfigVariables, string>([
3942 [ ResolveConfigVariables . USE_ARCHIVE_NAME_FOR_BINARY_NAME , 'false' ] ,
4043] ) ;
4144
45+ /** Interface for storing information about the found package.json from `findPackageJson` */
4246interface PackageJSON {
4347 /** The Path where the package.json was found (directory, not the file) */
4448 filePath : string ;
@@ -57,6 +61,7 @@ export function setDefaultValue(key: ResolveConfigVariables, value: string): voi
5761}
5862
5963// let packageJsonConfig: Record<string, string> = {};
64+ /** Cache the found package.json file */
6065let packagejson : PackageJSON | undefined = undefined ;
6166/**
6267 * Find the nearest package.json (that has an non-empty config field) for the provided directory
0 commit comments