Skip to content
Permalink
Browse files

perf(publisher-nucleus): merge make results when arch/platform/versio…

…n are all the same to speed up
  • Loading branch information
MarshallOfSound committed Jul 3, 2018
1 parent 25f6777 commit fbc4db42b5df1c68693d145c2063516ea135055c
Showing with 21 additions and 2 deletions.
  1. +21 −2 packages/publisher/nucleus/src/PublisherNucleus.ts
@@ -14,11 +14,30 @@ const d = debug('electron-forge:publish:nucleus');
export default class PublisherNucleus extends PublisherBase<PublisherNucleusConfig> {
name = 'nucleus';

private collapseMakeResults = (makeResults: PublisherOptions['makeResults']) => {
const newMakeResults: typeof makeResults = [];
for (const result of makeResults) {
const existingResult = newMakeResults.find((nResult) => {
return nResult.arch === result.arch
&& nResult.platform === result.platform
&& nResult.packageJSON.version === result.packageJSON.version;
});
if (existingResult) {
existingResult.artifacts.push(...result.artifacts);
} else {
newMakeResults.push({ ...result });
}
}
return newMakeResults;
}

async publish({ makeResults }: PublisherOptions) {
const { config } = this;

for (const [i, makeResult] of makeResults.entries()) {
const msg = `Uploading result (${i}/${makeResults.length})`;
const collapsedResults = this.collapseMakeResults(makeResults);

for (const [i, makeResult] of collapsedResults.entries()) {
const msg = `Uploading result (${i + 1}/${collapsedResults.length})`;
d(msg);

await asyncOra(msg, async () => {

0 comments on commit fbc4db4

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