Go to repository

Class Config

This class represents the main configuration object generated by the application. The configuration is automatically loaded once the init method is called. This object is also the main entry point to obtain configuration options of the tool as to obtain the located directories, tooling files and obtain location for the executable scripts for different tools.

Constructors

Create a new instance of the configuration.

Returns Config

Properties

Private
_binaryFilesCache: Record<string, undefined | ExecutableScriptDefinition>

A cache for the executable scripts already detected.

Private
_environment: ConfigEnvironment

The subpart of the configuration corresponding to the environment.

Private
_executionEnvironment: ConfigExecutionEnvironment

The subpart of the configuration corresponding to the current execution environment.

Private
_filteredProjectTypes: ConfigFilteredProjectTypes

The subpart of the configuration corresponding to the different project type filtered files.

Private Optional
_lastInitializationValues?: {
    apiGivenPackageManager?: string;
    apiGivenProjectType?: string;
    debug: boolean;
    test: boolean;
    useLocalTsconfigJson: boolean;
}

Whether the configuration has been initialized.

Private
_locations: ConfigLocations

The subpart of the configuration corresponding to the different path locations.

Private
_packageManagers: ConfigPackageManagers

The subpart of the configuration corresponding to package managers.

Private
_projectTypes: ConfigProjectTypes

The subpart of the configuration corresponding to the different project types.

Accessors

get environment(): ConfigEnvironment

Returns subpart of the configuration corresponding to the environment.

Returns ConfigEnvironment

get executionEnvironment(): ConfigExecutionEnvironment

Returns the subpart of the configuration corresponding to the current execution environment.

Returns ConfigExecutionEnvironment

get filteredProjectTypes(): ConfigFilteredProjectTypes

The subpart of the configuration corresponding to the different project type filtered files.

Returns ConfigFilteredProjectTypes

get locations(): ConfigLocations

Returns the subpart of the configuration corresponding to the different path locations.

Returns ConfigLocations

get packageManagers(): ConfigPackageManagers

Returns the subpart of the configuration corresponding to package managers.

Returns ConfigPackageManagers

get projectTypeFilteredFiles(): FilteredFilesDefinition
get projectTypes(): ConfigProjectTypes

Returns the subpart of the configuration corresponding to the different project types.

Returns ConfigProjectTypes

Methods

Private

Initialize the current environment from detected information.

Returns void

Private

Return a file definition with defaults, that will be overwritten by the partial file definition given.

Parameters

Returns FileDefinition

A full file definition.

Private

Return a file definition with defaults, that will be overwritten by the partial file definition given.

Parameters

Returns FileDefinitionWithTooling

A full file definition.

Private

Returns the file information for all files that are common to any project. Expects the route of the project's subfolder.

Parameters

  • projectTypePath: string

    The route of the project's subfolder (e.g. 'CLILibrary' or 'NonCode')

  • noCommonFiles: (keyof ProjectTypeDefinition)[]

    The filenames to search in the project specific folder, instead of the common.

  • excludedFiles: (keyof ProjectTypeDefinition)[]

    Files from the common folder to exclude from this project definition.

Returns ProjectTypeDefinition

A partial ProjectTypeDefinition.

Private

Initialize the different available package managers.

Returns void

Private

Initialize the current execution environment. This is obtained by a mix between possible CLI/API given parameters (such as using -t or -m), given as input, and the information read in the current's project package.json, as well as defaults in case no configuration is provided.

Priority is given to CLI/API given, then the package.json configuration and lastly defaults.

Parameters

  • Optional
    apiGivenProjectType: string

    The CLI/API given value for project type to use, if any.

  • Optional
    apiGivenPackageManager: string

    The CLI/API given value for package manager to use, if any.

  • Optional
    debug: boolean

    The CLI/API given value to know if we are running in debug mode.

  • Optional
    test: boolean

    The CLI/API given value to know if we are running in test mode.

  • Optional
    useLocalTsconfigJson: boolean

    The CLI/API given value to know if we should use the default tsconfig.json file.

Returns void

Private

Initialize the different locations by attempting to detect the current folder containing a project and the folder containing the gobstones-scripts Library.

Returns void

Private

Joins multiple partial project type definitions into a single cohesive one. Does not verify that the result contains all keys.

Parameters

Returns ProjectTypeDefinition

Private

Initialize the different project type definitions with all their file information filtered accordingly to their type.

Returns void

Private

Initialize the different project type definitions with all their file information.

Returns void

Change the current directory of the process to another one. Additionally, update the global configuration to match.

Parameters

  • dir: string

    The directory to change to

Returns string

Return the information for executing a binary file, if it can be found by the configuration system. Additionally, and differently from the simple getBin helper, this method provides caching, as to not attempt to find the element twice.

Parameters

  • packageName: string

    The package name that contains the binary file.

  • binName: string

    The binary file to execute.

Returns undefined | ExecutableScriptDefinition

The executable to run, or undefined if not found.

Orchestrate the initialization of the Config object. This initialization is needed in order to access any of the sub-configuration sections, except for retrieving executable scripts.

Parameters

  • Optional
    apiGivenProjectType: string
  • Optional
    apiGivenPackageManager: string
  • Optional
    debug: boolean
  • Optional
    test: boolean
  • Optional
    useLocalTsconfigJson: boolean

Returns this