Skip to content
Permalink
Browse files

fix(packager): packager hooks should be executed sequentially

  • Loading branch information
MarshallOfSound committed Jan 8, 2018
1 parent be49a9a commit e844b1d167ccee55601ffd7ea18eb4f42a969984
Showing with 14 additions and 3 deletions.
  1. +14 −3 src/api/package.js
@@ -39,6 +39,17 @@ function resolveHooks(hooks, dir) {
return [];
}

function sequentialHooks(hooks) {
return [async (...args) => {
const done = args[args.length - 1];
const passedArgs = args.splice(0, args.length - 1);
for (const hook of hooks) {
await pify(hook)(...passedArgs);
}
done();
}];
}

/**
* Package an Electron application into an platform dependent format.
*
@@ -128,9 +139,9 @@ export default async (providedOptions = {}) => {
asar: false,
overwrite: true,
}, forgeConfig.electronPackagerConfig, {
afterCopy: afterCopyHooks,
afterExtract: resolveHooks(forgeConfig.electronPackagerConfig.afterExtract, dir),
afterPrune: afterPruneHooks,
afterCopy: sequentialHooks(afterCopyHooks),
afterExtract: sequentialHooks(resolveHooks(forgeConfig.electronPackagerConfig.afterExtract, dir)),
afterPrune: sequentialHooks(afterPruneHooks),
dir,
arch,
platform,

0 comments on commit e844b1d

Please sign in to comment.
You can’t perform that action at this time.