Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/heft > IHeftLifecycleHooks

IHeftLifecycleHooks interface

Hooks that are available to the lifecycle plugin.

Signature:

export interface IHeftLifecycleHooks 

Properties

Property

Modifiers

Type

Description

clean

AsyncParallelHook<IHeftLifecycleCleanHookOptions>

The clean hook is called at the beginning of Heft execution. It can be used to clean up any files or folders that may be produced by the plugin. To use it, call clean.tapPromise(<pluginName>, <callback>).

phaseFinish

SyncHook<IHeftPhaseFinishHookOptions>

The phaseFinish hook is called at the end of a phase. It is called after the phase has completed execution. To use it, call phaseFinish.tap(<pluginName>, <callback>).

phaseStart

SyncHook<IHeftPhaseStartHookOptions>

The phaseStart hook is called at the beginning of a phase. It is called before the phase has begun to execute. To use it, call phaseStart.tap(<pluginName>, <callback>).

recordMetrics

AsyncParallelHook<IHeftRecordMetricsHookOptions>

The recordMetrics hook is called at the end of every Heft execution pass. It is called after all phases have completed execution (or been canceled). In a watch run, it will be called several times in between toolStart and (if the session is gracefully interrupted via Ctrl+C), toolFinish. In a non-watch run, it will be invoked exactly once between toolStart and toolFinish. To use it, call recordMetrics.tapPromise(<pluginName>, <callback>).

taskFinish

SyncHook<IHeftTaskFinishHookOptions>

The taskFinish hook is called at the end of a task. It is called after the task has completed execution. To use it, call taskFinish.tap(<pluginName>, <callback>).

taskStart

SyncHook<IHeftTaskStartHookOptions>

The taskStart hook is called at the beginning of a task. It is called before the task has begun to execute. To use it, call taskStart.tap(<pluginName>, <callback>).

toolFinish

AsyncParallelHook<IHeftLifecycleToolFinishHookOptions>

The toolFinish hook is called at the end of Heft execution. It is called after all phases have completed execution. Plugins that tap this hook are resposible for handling the scenario in which toolStart threw an error, since this hook is used to clean up any resources allocated earlier in the lifecycle and therefore runs even in error conditions. To use it, call toolFinish.tapPromise(<pluginName>, <callback>).

toolStart

AsyncParallelHook<IHeftLifecycleToolStartHookOptions>

The toolStart hook is called at the beginning of Heft execution, after the clean hook. It is called before any phases have begun to execute. To use it, call toolStart.tapPromise(<pluginName>, <callback>).