import ConfigurationFile from 'projext-plugin-webpack/src/abstracts/configurationFile.js'
ConfigurationFile
Direct Subclass:
A helper class for creating configuration files that can be overwritten on implementation.
Constructor Summary
Public Constructor | ||
public abstract |
constructor(pathUtils: PathUtils, overwritePaths: string | Array, asFactory: boolean, parentConfig: ConfigurationFile) Class constructor. |
Member Summary
Public Members | ||
public |
Whether the configuration should be created every time |
|
public |
A list of paths that can overwrite the configuration. |
|
public |
A parent configuration to extend. |
|
public |
A local reference for the |
Method Summary
Public Methods | ||
public abstract |
This method will be called the first time |
|
public |
This is the public method all other services uses to obtain the configuration. |
Public Constructors
public abstract constructor(pathUtils: PathUtils, overwritePaths: string | Array, asFactory: boolean, parentConfig: ConfigurationFile) source
Class constructor.
Params:
Name | Type | Attribute | Description |
pathUtils | PathUtils | To build the path to the overwrite file. |
|
overwritePaths | string | Array | A path of a list of paths for files that can
overwrite the configuration. If used as a
string, it will assume the path is inside
the |
|
asFactory | boolean |
|
If |
parentConfig | ConfigurationFile |
|
If this parameter is used, the configuration
created by the instance will be merged on top
of the configuration returned by the
|
Throw:
If instantiated directly. |
Public Members
Public Methods
public abstract createConfig() source
This method will be called the first time getConfig
gets called (or every time, depending on
the value of the asFactory
property) and it should return the configuration contents.
As parameters, it will return the same ones sent to getConfig
.
Throw:
if not overwritten. |
Example:
// Let's say the class receives this call: `getConfig({ name: 'Charito'}, 'hello')`, you could
// do something like this:
createConfig(options, prefix) {
return { message: `${prefix} ${options.name}` };
}
// And the configuration would be `{ message: 'hello Charito'}`
public getConfig(args: Array): Object source
This is the public method all other services uses to obtain the configuration. If the
configuration doesn't exists or asFactory
was set to true
on the constructor
, the
configuration will be reloaded.
Params:
Name | Type | Attribute | Description |
args | Array | A list of parameters for the service to use when creating the configuration |