abstractConfiguration <T>
Hierarchy
- Contract<T>
- Configuration
Index
Events
Other
Events
readonlyonLoadedConfig
readonlyonLoadedIgnore
Called after ignore files are loaded. Can modify ignore file list.
readonlyonProcessedConfig
Called after config files are loaded and processed.
Other
constructor
Type parameters
- T: object
readonlyoptions
Validated and configured options.
publicaddProcessHandler
Add a process handler to customize the processing of key-value setting pairs. May only run a processor on settings found in the root of the configuration object.
Type parameters
- K: string | number | symbol
- V = T[K]
abstractblueprint
Define an
optimal
blueprint in which to validate and build the options object passed to the constructor, or when manual setting.A boolean is passed as the 2nd argument to determine whether this is validating on class instantiation (first time), or by calling
configure()
(all other times).
publicbootstrap
Life cycle called on initialization.
clearCache
Clear all cache.
clearFileCache
Clear all cached file contents.
clearFinderCache
Clear all cached directory and file path information.
configure
Set an options object by merging the new partial and existing options with the defined blueprint, while running all validation checks. Freeze and return the options object.
object.configure({ name: 'Boost' });
object.configure((prevOptions) => ({
nestedObject: {
...prevOptions.nestedObject,
some: 'value',
},
}));
publicconfigureFinder
Configure the finder instance.
publicconfigureProcessor
Configure the processor instance.
findRootDir
Attempt to find the root directory starting from the provided directory. Once the root is found, it will be cached for further lookups, otherwise an error is thrown based on current configuration.
loadConfigFromBranchToRoot
Traverse upwards from the branch directory, until the root directory is found, or we reach to top of the file system. While traversing, find all config files within each branch directory, and the root.
loadConfigFromRoot
Load config files from the defined root. Root is determined by a relative
.config
folder andpackage.json
file.
loadIgnoreFromBranchToRoot
Traverse upwards from the branch directory, until the root directory is found, or we reach to top of the file system. While traversing, find all ignore files within each branch directory, and the root.
loadIgnoreFromRoot
Load ignore file from the defined root. Root is determined by a relative
.config
folder andpackage.json
file.
setRootDir
Explicitly set the root directory to stop traversal at. This should only be set manually when you want full control, and know file boundaries up front.
This does not check for the existence of the root config file or folder.
Called after config files are loaded but before processed. Can modify config file list.