Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/heft > IHeftTaskSession

IHeftTaskSession interface

The task session is responsible for providing session-specific information to Heft task plugins. The session provides access to the hooks that Heft will run as part of task execution, as well as access to parameters provided via the CLI. The session is also how you request access to other task plugins.

Signature:

export interface IHeftTaskSession

Properties

PropertyModifiersTypeDescription
hooksreadonlyIHeftTaskHooksThe hooks available to the task plugin.
loggerreadonlyIScopedLoggerThe scoped logger for the task. Messages logged with this logger will be prefixed with the phase and task name, in the format [<phaseName>:<taskName>]. It is highly recommended that writing to the console be performed via the logger, as it will ensure that logging messages are labeled with the source of the message.
parametersreadonlyIHeftParametersContains default parameters provided by Heft, as well as CLI parameters requested by the task plugin.
parsedCommandLinereadonlyIHeftParsedCommandLineExposes details about the command line that was used to invoke Heft. This value is initially undefined and later filled in after the command line has been parsed.
taskNamereadonlystringThe name of the task. This is defined in "heft.json".
tempFolderPathreadonlystringThe temp folder for the task. This folder is unique for each task, and will be cleaned when Heft is run with --clean.

Methods

MethodDescription
requestAccessToPluginByName(pluginToAccessPackage, pluginToAccessName, pluginApply)Set a a callback which will be called if and after the specified plugin has been applied. This can be used to tap hooks on another plugin that exists within the same phase.