MCPcopy
hub / github.com/electron/forge / getHookListrTasks

Function getHookListrTasks

packages/api/core/src/util/hook.ts:35–75  ·  view source on GitHub ↗
(
  childTrace: typeof autoTrace,
  forgeConfig: ResolvedForgeConfig,
  hookName: Hook,
  ...hookArgs: ForgeSimpleHookSignatures[Hook]
)

Source from the content-addressed store, hash-verified

33};
34
35export const getHookListrTasks = async <
36 Hook extends keyof ForgeSimpleHookSignatures,
37>(
38 childTrace: typeof autoTrace,
39 forgeConfig: ResolvedForgeConfig,
40 hookName: Hook,
41 ...hookArgs: ForgeSimpleHookSignatures[Hook]
42): Promise<ForgeListrTaskDefinition[]> => {
43 const { hooks } = forgeConfig;
44 const tasks: ForgeListrTaskDefinition[] = [];
45 if (hooks) {
46 d(`hook triggered: ${hookName}`);
47 if (typeof hooks[hookName] === 'function') {
48 d('calling hook:', hookName, 'with args:', hookArgs);
49 tasks.push({
50 title: `Running ${chalk.yellow(hookName)} hook from forgeConfig`,
51 task: childTrace(
52 {
53 name: 'forge-config-hook',
54 category: '@electron-forge/hooks',
55 extraDetails: { hook: hookName },
56 },
57 async () => {
58 await (hooks[hookName] as ForgeSimpleHookFn<Hook>)(
59 forgeConfig,
60 ...hookArgs,
61 );
62 },
63 ),
64 });
65 }
66 }
67 tasks.push(
68 ...(await forgeConfig.pluginInterface.getHookListrTasks(
69 childTrace,
70 hookName,
71 hookArgs,
72 )),
73 );
74 return tasks;
75};
76
77export async function runMutatingHook<
78 Hook extends keyof ForgeMutatingHookSignatures,

Callers 3

start.tsFile · 0.90
listrMakeFunction · 0.90
listrPackageFunction · 0.90

Calls 2

childTraceFunction · 0.85
getHookListrTasksMethod · 0.65

Tested by

no test coverage detected