Skip to content

Commit

Permalink
fix: log correct directory when hook moves artifacts (#3730)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound authored Oct 8, 2024
1 parent d6187ad commit 7574b36
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/api/core/src/api/make.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,28 @@ export const listrMake = (
task: childTrace<Parameters<ForgeListrTaskFn<MakeContext>>>({ name: 'run-postMake-hook', category: '@electron-forge/core' }, async (_, ctx, task) => {
// If the postMake hooks modifies the locations / names of the outputs it must return
// the new locations so that the publish step knows where to look
const originalOutputs = JSON.stringify(ctx.outputs);
ctx.outputs = await runMutatingHook(ctx.forgeConfig, 'postMake', ctx.outputs);

let outputLocations = [path.resolve(ctx.actualOutDir, 'make')];
if (originalOutputs !== JSON.stringify(ctx.outputs)) {
const newDirs = new Set<string>();
const artifactPaths = [];
for (const result of ctx.outputs) {
for (const artifact of result.artifacts) {
newDirs.add(path.dirname(artifact));
artifactPaths.push(artifact);
}
}
if (newDirs.size <= ctx.outputs.length) {
outputLocations = [...newDirs];
} else {
outputLocations = artifactPaths;
}
}
receiveMakeResults?.(ctx.outputs);

task.output = `Artifacts available at: ${chalk.green(path.resolve(ctx.actualOutDir, 'make'))}`;
task.output = `Artifacts available at: ${chalk.green(outputLocations.join(', '))})}`;
}),
rendererOptions: {
persistentOutput: true,
Expand Down

0 comments on commit 7574b36

Please sign in to comment.