@rushstack/heft
Version:
Build all your JavaScript projects the same way: A way that works.
134 lines • 4.71 kB
TypeScript
import { type CommandLineParameterProvider, type CommandLineChoiceParameter, type CommandLineChoiceListParameter, type CommandLineFlagParameter, type CommandLineIntegerParameter, type CommandLineIntegerListParameter, type CommandLineStringParameter, type CommandLineStringListParameter } from '@rushstack/ts-command-line';
import type { HeftPluginDefinitionBase } from '../configuration/HeftPluginDefinition';
/**
* The default parameters provided by Heft.
*
* @public
*/
export interface IHeftDefaultParameters {
/**
* Whether or not the `--clean` flag was passed to Heft.
*
* @public
*/
readonly clean: boolean;
/**
* Whether or not the `--debug` flag was passed to Heft.
*
* @public
*/
readonly debug: boolean;
/**
* Whether or not the `--verbose` flag was passed to the Heft action.
*
* @public
*/
readonly verbose: boolean;
/**
* Whether or not the `--production` flag was passed to the Heft action.
*
* @public
*/
readonly production: boolean;
/**
* The locales provided to the Heft action via the `--locales` parameter.
*
* @public
*/
readonly locales: Iterable<string>;
/**
* Whether or not the Heft action is running in watch mode.
*/
readonly watch: boolean;
}
/**
* Parameters provided to a Heft plugin.
*
* @public
*/
export interface IHeftParameters extends IHeftDefaultParameters {
/**
* Get a choice parameter that has been defined in heft-plugin.json.
*
* @public
*/
getChoiceParameter(parameterLongName: string): CommandLineChoiceParameter;
/**
* Get a choice list parameter that has been defined in heft-plugin.json.
*
* @public
*/
getChoiceListParameter(parameterLongName: string): CommandLineChoiceListParameter;
/**
* Get a flag parameter that has been defined in heft-plugin.json.
*
* @public
*/
getFlagParameter(parameterLongName: string): CommandLineFlagParameter;
/**
* Get an integer parameter that has been defined in heft-plugin.json.
*
* @public
*/
getIntegerParameter(parameterLongName: string): CommandLineIntegerParameter;
/**
* Get an integer list parameter that has been defined in heft-plugin.json.
*
* @public
*/
getIntegerListParameter(parameterLongName: string): CommandLineIntegerListParameter;
/**
* Get a string parameter that has been defined in heft-plugin.json.
*
* @public
*/
getStringParameter(parameterLongName: string): CommandLineStringParameter;
/**
* Get a string list parameter that has been defined in heft-plugin.json.
*
* @public
*/
getStringListParameter(parameterLongName: string): CommandLineStringListParameter;
}
export interface IHeftParameterManagerOptions {
getIsClean: () => boolean;
getIsDebug: () => boolean;
getIsVerbose: () => boolean;
getIsProduction: () => boolean;
getIsWatch: () => boolean;
getLocales: () => Iterable<string>;
}
export declare class HeftParameterManager {
private readonly _options;
private readonly _heftParametersByDefinition;
private readonly _parametersByDefinition;
private readonly _pluginDefinitionsByScope;
private _isFinalized;
private _defaultParameters;
get defaultParameters(): IHeftDefaultParameters;
constructor(options: IHeftParameterManagerOptions);
/**
* Add parameters provided by the specified plugin definition. Parameters will be registered with the
* command line parameter provider after finalization.
*/
addPluginParameters(pluginDefinition: HeftPluginDefinitionBase): void;
/**
* Finalize and register parameters with the specified parameter provider. The parameter manager
* can only be finalized once.
*/
finalizeParameters(commandLineParameterProvider: CommandLineParameterProvider): void;
/**
* Get the finalized parameters for the specified plugin definition.
*/
getParametersForPlugin(pluginDefinition: HeftPluginDefinitionBase): IHeftParameters;
/**
* Add the parameters specified by a plugin definition to the command line parameter provider.
* Duplicate parameters are allowed, as long as they have different parameter scopes. In this
* case, the parameter will only be referenceable by the CLI argument
* "--<parameterScope>:<parameterName>". If there is no duplicate parameter, it will also be
* referenceable by the CLI argument "--<parameterName>".
*/
private _addParametersToProvider;
private _getParameter;
}
//# sourceMappingURL=HeftParameterManager.d.ts.map